Add 卓米会 mini program and admin server.
Initial commit of the WeChat mini program, Express backend, and admin console. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
const api = require('../../utils/api')
|
||||
const authUtil = require('../../utils/auth')
|
||||
const activityUtil = require('../../utils/activity')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
activity: null,
|
||||
failed: false
|
||||
},
|
||||
|
||||
onLoad(query) {
|
||||
authUtil.captureSharer(query)
|
||||
this.activityId = (query && query.id) || ''
|
||||
wx.showShareMenu({ menus: ['shareAppMessage'] })
|
||||
this.loadActivity()
|
||||
},
|
||||
|
||||
loadActivity() {
|
||||
if (!this.activityId) {
|
||||
this.setData({ failed: true })
|
||||
return
|
||||
}
|
||||
api
|
||||
.activity(this.activityId)
|
||||
.then((activity) => {
|
||||
this.setData({ activity: activity, failed: false })
|
||||
if (activity && activity.title) wx.setNavigationBarTitle({ title: activity.title })
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setData({ failed: true })
|
||||
activityUtil.toast(error)
|
||||
})
|
||||
},
|
||||
|
||||
openMap() {
|
||||
activityUtil.openMap(this.data.activity)
|
||||
},
|
||||
|
||||
goSignup() {
|
||||
activityUtil.goSignup(this.data.activity)
|
||||
},
|
||||
|
||||
goHome() {
|
||||
wx.switchTab({ url: '/pages/index/index' })
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return activityUtil.shareMessage(this.data.activity, this.activityId)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "卓米会",
|
||||
"usingComponents": {
|
||||
"activity-board": "/components/activity-board/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<activity-board
|
||||
wx:if="{{activity}}"
|
||||
activity="{{activity}}"
|
||||
show-past="{{false}}"
|
||||
bind:map="openMap"
|
||||
bind:signup="goSignup"
|
||||
/>
|
||||
<view wx:elif="{{failed}}" class="empty">
|
||||
<text>活动不存在或已下线</text>
|
||||
<view class="home" bindtap="goHome">回到首页</view>
|
||||
</view>
|
||||
<view wx:else class="empty">加载中</view>
|
||||
@@ -0,0 +1,17 @@
|
||||
.empty {
|
||||
padding: 160rpx 32rpx;
|
||||
text-align: center;
|
||||
color: #9ca3af;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.home {
|
||||
display: inline-block;
|
||||
margin-top: 32rpx;
|
||||
padding: 0 40rpx;
|
||||
height: 76rpx;
|
||||
line-height: 76rpx;
|
||||
border-radius: 38rpx;
|
||||
border: 2rpx solid #128a80;
|
||||
color: #128a80;
|
||||
}
|
||||
Reference in New Issue
Block a user