|
|
@@ -62,8 +62,8 @@
|
|
|
<text class="card-meta">{{ act.startTime }}</text>
|
|
|
<text class="card-meta" v-if="act.location">📍 {{ act.location }}</text>
|
|
|
<view class="card-bottom">
|
|
|
- <text class="card-status" :class="getStatusClass(act)">
|
|
|
- {{ getStatusText(act) }}
|
|
|
+ <text class="card-status" :class="'status-' + (act._cls || 'upcoming')">
|
|
|
+ {{ act._txt || '待开始' }}
|
|
|
</text>
|
|
|
<text class="card-price" v-if="act.price > 0">¥{{ formatPrice(act.price) }}</text>
|
|
|
<text class="card-price free" v-else>免费</text>
|
|
|
@@ -343,6 +343,9 @@ export default {
|
|
|
}
|
|
|
records = filtered
|
|
|
}
|
|
|
+ for (var di = 0; di < records.length; di++) {
|
|
|
+ self.decorateActivity(records[di])
|
|
|
+ }
|
|
|
if (refresh) {
|
|
|
self.myActivities = records
|
|
|
} else {
|
|
|
@@ -519,6 +522,26 @@ export default {
|
|
|
formatPrice: function(price) {
|
|
|
return (price / 100).toFixed(2)
|
|
|
},
|
|
|
+ // Pre-compute display properties for WXML compatibility (no method calls in :class)
|
|
|
+ decorateActivity: function(act) {
|
|
|
+ if (act.status) {
|
|
|
+ act._cls = act.status
|
|
|
+ var map = { pending: '待审核', approved: '报名成功', rejected: '已拒绝', cancelled: '已取消', checked_in: '已签到' }
|
|
|
+ act._txt = map[act.status] || act.status
|
|
|
+ } else {
|
|
|
+ if (act.endTime) {
|
|
|
+ var endTime = new Date(act.endTime.replace(/-/g, '/'))
|
|
|
+ if (endTime < new Date()) {
|
|
|
+ act._cls = 'ended'
|
|
|
+ act._txt = '已结束'
|
|
|
+ return act
|
|
|
+ }
|
|
|
+ }
|
|
|
+ act._cls = 'upcoming'
|
|
|
+ act._txt = '待开始'
|
|
|
+ }
|
|
|
+ return act
|
|
|
+ },
|
|
|
onCheckin: function(act) {
|
|
|
var self = this
|
|
|
var childId = uni.getStorageSync('currentChildId')
|