Compare commits
2 Commits
6a7e216e4f
...
54515c6e23
| Author | SHA1 | Date | |
|---|---|---|---|
| 54515c6e23 | |||
| 12bf47c756 |
|
|
@ -96,6 +96,7 @@ Page({
|
|||
heat: item.heat || 0, // 使用后端返回的热度字段
|
||||
isFree: item.priceType === 'free',
|
||||
price: item.priceText || '',
|
||||
participants: item.current_participants || item.currentParticipants || 0,
|
||||
status: item.status || ((item.current_participants || item.currentParticipants || 0) >= (item.max_participants || item.maxParticipants || 0) && (item.max_participants || item.maxParticipants || 0) > 0 ? 'full' : 'upcoming'),
|
||||
activityGuideQrcode: item.activityGuideQrcode || item.activity_guide_qrcode || ''
|
||||
}))
|
||||
|
|
@ -275,19 +276,16 @@ Page({
|
|||
return
|
||||
}
|
||||
|
||||
wx.showModal({
|
||||
title: '确认报名',
|
||||
content: '确定要报名参加这个活动吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.handleSignUp(id, index)
|
||||
}
|
||||
}
|
||||
// 2025-02-04: 点击报名直接显示二维码弹窗,不再请求后端报名接口
|
||||
const qrCode = activity.activityGuideQrcode || activity.activity_guide_qrcode || this.data.qrcodeImageUrl || 'https://ai-c.maimanji.com/api/common/qrcode?type=group'
|
||||
this.setData({
|
||||
qrcodeImageUrl: qrCode,
|
||||
showQrcodeModal: true
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理报名
|
||||
* 处理报名 (Deprecated)
|
||||
*/
|
||||
async handleSignUp(activityId, index) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
<!-- 底部操作栏 -->
|
||||
<view class="activity-footer">
|
||||
<view class="participants">
|
||||
<!-- <text class="participant-text">{{item.participants}}人已报名</text> -->
|
||||
<text class="participant-text">{{item.participants}}人已报名</text>
|
||||
</view>
|
||||
<view class="signup-btn" catchtap="onSignUp" data-id="{{item.id}}" data-index="{{index}}">
|
||||
立即报名
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@
|
|||
<!-- 报名信息 -->
|
||||
<view class="activity-footer">
|
||||
<view class="participants">
|
||||
<!-- <text class="participant-text">{{item.participants}}人已报名</text> -->
|
||||
<text class="participant-text">{{item.participants}}人已报名</text>
|
||||
</view>
|
||||
<view class="signup-btn {{item.isSignedUp ? 'signed' : ''}}"
|
||||
catchtap="onSignUp"
|
||||
|
|
|
|||
|
|
@ -258,59 +258,12 @@ Page({
|
|||
return
|
||||
}
|
||||
|
||||
try {
|
||||
if (activity.isSignedUp) {
|
||||
// 取消报名
|
||||
const res = await api.activity.cancelSignup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '已取消报名', icon: 'success' })
|
||||
this.loadActivityList() // 刷新列表获取最新人数
|
||||
}
|
||||
} else {
|
||||
// 报名
|
||||
const res = await api.activity.signup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '报名成功', icon: 'success' })
|
||||
this.loadActivityList() // 刷新列表获取最新人数
|
||||
} else {
|
||||
// 检查是否需要显示二维码(后端开关关闭或活动已结束)
|
||||
if (res.code === 'QR_CODE_REQUIRED' || res.error === 'QR_CODE_REQUIRED' || res.code === 'ACTIVITY_ENDED' || res.error === '活动已结束') {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
if (res.code === 'ACTIVITY_ENDED' || res.error === '活动已结束') {
|
||||
wx.showToast({ title: '活动已结束,进群查看更多', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.error || '报名失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('报名操作失败', err)
|
||||
// 捕获特定错误码以显示二维码
|
||||
const isQrRequired = err && (err.code === 'QR_CODE_REQUIRED' || (err.data && err.data.code === 'QR_CODE_REQUIRED'))
|
||||
const isActivityEnded = err && (err.code === 'ACTIVITY_ENDED' || (err.data && err.data.code === 'ACTIVITY_ENDED') || err.error === '活动已结束')
|
||||
|
||||
if (isQrRequired || isActivityEnded) {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
if (isActivityEnded) {
|
||||
wx.showToast({ title: '活动已结束,进群查看更多', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: err.error || err.message || '操作失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
// 2025-02-04: 点击报名直接显示二维码弹窗,不再请求后端报名接口
|
||||
const qrCode = activity.activityGuideQrcode || activity.activity_guide_qrcode || this.data.qrcodeImageUrl || 'https://ai-c.maimanji.com/api/common/qrcode?type=group'
|
||||
this.setData({
|
||||
qrcodeImageUrl: qrCode,
|
||||
showQrcodeModal: true
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
<!-- 报名信息 -->
|
||||
<view class="activity-footer">
|
||||
<view class="participants">
|
||||
<!-- <text class="participant-text">{{item.participants}}人已报名</text> -->
|
||||
<text class="participant-text">{{item.participants}}人已报名</text>
|
||||
</view>
|
||||
<view class="signup-btn {{item.isSignedUp ? 'signed' : ''}}"
|
||||
catchtap="onSignUp"
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@
|
|||
</view>
|
||||
<view class="option-info">
|
||||
<text class="option-title">成为会员</text>
|
||||
<text class="option-desc">解锁更多权益</text>
|
||||
<text class="option-desc">心伴会员 品质服务</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="option-btn hearts-btn">
|
||||
|
|
|
|||
|
|
@ -104,7 +104,9 @@ Page({
|
|||
'exchange_vip': '兑换会员',
|
||||
'exchange_gift': '兑换礼品',
|
||||
'admin': '管理员操作',
|
||||
'system': '系统赠送'
|
||||
'system': '系统赠送',
|
||||
'register': '新客平台赠送奖励',
|
||||
'login': '每日登录奖励'
|
||||
}
|
||||
return sourceMap[source] || source
|
||||
},
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<view wx:if="{{transactions.length > 0}}" class="records-list">
|
||||
<view wx:for="{{transactions}}" wx:key="id" class="record-item">
|
||||
<view class="record-left">
|
||||
<text class="record-title">{{item.description || formatSource(item.source)}}</text>
|
||||
<text class="record-title">{{item.description === '首次注册赠送100爱心值' ? '新客平台赠送奖励' : (item.description || formatSource(item.source))}}</text>
|
||||
<text class="record-time">{{formatTime(item.created_at)}}</text>
|
||||
</view>
|
||||
<view class="record-right">
|
||||
|
|
|
|||
|
|
@ -259,57 +259,12 @@ Page({
|
|||
return
|
||||
}
|
||||
|
||||
try {
|
||||
if (activity.isSignedUp) {
|
||||
// 取消报名
|
||||
const res = await api.activity.cancelSignup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '已取消报名', icon: 'success' })
|
||||
this.loadActivityList()
|
||||
}
|
||||
} else {
|
||||
// 报名
|
||||
const res = await api.activity.signup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '报名成功', icon: 'success' })
|
||||
this.loadActivityList()
|
||||
} else {
|
||||
// 检查是否需要显示二维码(后端开关关闭或活动已结束)
|
||||
if (res.code === 'QR_CODE_REQUIRED' || res.error === 'QR_CODE_REQUIRED' || res.code === 'ACTIVITY_ENDED' || res.error === '活动已结束') {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.error || '操作失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('报名操作失败', err)
|
||||
// 捕获特定错误码以显示二维码
|
||||
const isQrRequired = err && (err.code === 'QR_CODE_REQUIRED' || (err.data && err.data.code === 'QR_CODE_REQUIRED'))
|
||||
const isActivityEnded = err && (err.code === 'ACTIVITY_ENDED' || (err.data && err.data.code === 'ACTIVITY_ENDED') || err.error === '活动已结束')
|
||||
|
||||
if (isQrRequired || isActivityEnded) {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
|
||||
if (isActivityEnded) {
|
||||
wx.showToast({ title: '活动已结束,进群查看更多', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: err.error || err.message || '操作失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
// 2025-02-04: 点击报名直接显示二维码弹窗,不再请求后端报名接口
|
||||
const qrCode = activity.activityGuideQrcode || activity.activity_guide_qrcode || this.data.qrcodeImageUrl || 'https://ai-c.maimanji.com/api/common/qrcode?type=group'
|
||||
this.setData({
|
||||
qrcodeImageUrl: qrCode,
|
||||
showQrcodeModal: true
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -76,25 +76,23 @@
|
|||
<view class="activity-info">
|
||||
<text class="activity-title">{{item.title}}</text>
|
||||
<view class="activity-meta">
|
||||
<view class="meta-item">
|
||||
<view class="meta-item meta-date">
|
||||
<image src="/images/icon-clock.png" class="meta-icon" mode="aspectFit"></image>
|
||||
<text class="meta-text">{{item.date}}</text>
|
||||
</view>
|
||||
<view class="meta-row">
|
||||
<view class="meta-item">
|
||||
<image src="/images/icon-location.png" class="meta-icon" mode="aspectFit"></image>
|
||||
<text class="meta-text">{{item.location}}</text>
|
||||
</view>
|
||||
<view class="meta-item heat-item" wx:if="{{item.heat}}">
|
||||
<app-icon name="flame-hot" size="32" color="#F97316" />
|
||||
<text class="meta-text heat-text">{{item.heat}}</text>
|
||||
</view>
|
||||
<view class="meta-item meta-location">
|
||||
<image src="/images/icon-location.png" class="meta-icon" mode="aspectFit"></image>
|
||||
<text class="meta-text">{{item.location}}</text>
|
||||
</view>
|
||||
<view class="meta-item heat-item" wx:if="{{item.heat}}">
|
||||
<app-icon name="flame-hot" size="32" color="#F97316" />
|
||||
<text class="meta-text heat-text">{{item.heat}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="activity-footer">
|
||||
<view class="participants">
|
||||
<!-- <text class="participant-text">{{item.participants}}人已报名</text> -->
|
||||
<text class="participant-text">{{item.participants}}人已报名</text>
|
||||
</view>
|
||||
<view class="signup-btn {{item.isSignedUp ? 'signed' : ''}}" catchtap="onSignUp" data-id="{{item.id}}" data-index="{{index}}">
|
||||
{{item.isSignedUp ? '已报名' : '立即报名'}}
|
||||
|
|
|
|||
|
|
@ -357,6 +357,14 @@ page {
|
|||
color: #43A047;
|
||||
}
|
||||
|
||||
.meta-date {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.meta-date .meta-text {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.meta-icon {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
|
|
@ -367,12 +375,17 @@ page {
|
|||
color: #4A5565;
|
||||
}
|
||||
|
||||
.meta-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
margin-top: 8rpx;
|
||||
.meta-location {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.meta-location .meta-text {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* 活动底部 */
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
<view class="icon-wrap-sm">
|
||||
<image src="/images/icon-trending-up.png" class="card-icon-img" mode="aspectFit" />
|
||||
</view>
|
||||
<text class="card-name">业绩数据</text>
|
||||
<text class="card-name">我的业绩</text>
|
||||
</view>
|
||||
<view class="card-bottom">
|
||||
<text class="card-num">¥{{counts.performance || '0.00'}}</text>
|
||||
|
|
|
|||
|
|
@ -211,58 +211,12 @@ Page({
|
|||
return
|
||||
}
|
||||
|
||||
try {
|
||||
if (activity.isSignedUp) {
|
||||
// 取消报名
|
||||
const res = await api.activity.cancelSignup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '已取消报名', icon: 'success' })
|
||||
this.loadActivityList()
|
||||
}
|
||||
} else {
|
||||
// 报名
|
||||
const res = await api.activity.signup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '报名成功', icon: 'success' })
|
||||
this.loadActivityList()
|
||||
} else {
|
||||
// 检查是否需要显示二维码
|
||||
if (res.code === 'QR_CODE_REQUIRED' || res.error === 'QR_CODE_REQUIRED' || res.code === 'ACTIVITY_ENDED' || res.error === '活动已结束') {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
if (res.code === 'ACTIVITY_ENDED' || res.error === '活动已结束') {
|
||||
wx.showToast({ title: '活动已结束,进群查看更多', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.error || '操作失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('报名操作失败', err)
|
||||
const isQrRequired = err && (err.code === 'QR_CODE_REQUIRED' || (err.data && err.data.code === 'QR_CODE_REQUIRED'))
|
||||
const isActivityEnded = err && (err.code === 'ACTIVITY_ENDED' || (err.data && err.data.code === 'ACTIVITY_ENDED') || err.error === '活动已结束')
|
||||
|
||||
if (isQrRequired || isActivityEnded) {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
if (isActivityEnded) {
|
||||
wx.showToast({ title: '活动已结束,进群查看更多', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: err.error || err.message || '操作失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
// 2025-02-04: 点击报名直接显示二维码弹窗,不再请求后端报名接口
|
||||
const qrCode = activity.activityGuideQrcode || activity.activity_guide_qrcode || this.data.qrcodeImageUrl || 'https://ai-c.maimanji.com/api/common/qrcode?type=group'
|
||||
this.setData({
|
||||
qrcodeImageUrl: qrCode,
|
||||
showQrcodeModal: true
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
<!-- 报名信息 -->
|
||||
<view class="activity-footer">
|
||||
<view class="participants">
|
||||
<!-- <text class="participant-text">{{item.participants}}人已报名</text> -->
|
||||
<text class="participant-text">{{item.participants}}人已报名</text>
|
||||
</view>
|
||||
<view class="signup-btn {{item.isSignedUp ? 'signed' : ''}}" catchtap="onSignUp" data-id="{{item.id}}" data-index="{{index}}">
|
||||
{{item.isSignedUp ? '已报名' : '立即报名'}}
|
||||
|
|
|
|||
|
|
@ -249,59 +249,12 @@ Page({
|
|||
return
|
||||
}
|
||||
|
||||
try {
|
||||
if (activity.isSignedUp) {
|
||||
// 取消报名
|
||||
const res = await api.activity.cancelSignup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '已取消报名', icon: 'success' })
|
||||
this.loadActivityList()
|
||||
}
|
||||
} else {
|
||||
// 报名
|
||||
const res = await api.activity.signup(id)
|
||||
if (res.success) {
|
||||
wx.showToast({ title: '报名成功', icon: 'success' })
|
||||
this.loadActivityList()
|
||||
} else {
|
||||
// 检查是否需要显示二维码(后端开关关闭或活动已结束)
|
||||
if (res.code === 'QR_CODE_REQUIRED' || res.error === 'QR_CODE_REQUIRED' || res.code === 'ACTIVITY_ENDED' || res.error === '活动已结束') {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
if (res.code === 'ACTIVITY_ENDED' || res.error === '活动已结束') {
|
||||
wx.showToast({ title: '活动已结束,进群查看更多', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.error || '报名失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('报名操作失败', err)
|
||||
// 捕获特定错误码以显示二维码
|
||||
const isQrRequired = err && (err.code === 'QR_CODE_REQUIRED' || (err.data && err.data.code === 'QR_CODE_REQUIRED'))
|
||||
const isActivityEnded = err && (err.code === 'ACTIVITY_ENDED' || (err.data && err.data.code === 'ACTIVITY_ENDED') || err.error === '活动已结束')
|
||||
|
||||
if (isQrRequired || isActivityEnded) {
|
||||
if (activity.activityGuideQrcode || activity.activity_guide_qrcode) {
|
||||
this.setData({ qrcodeImageUrl: activity.activityGuideQrcode || activity.activity_guide_qrcode })
|
||||
}
|
||||
this.setData({ showQrcodeModal: true })
|
||||
if (isActivityEnded) {
|
||||
wx.showToast({ title: '活动已结束,进群查看更多', icon: 'none' })
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: err.error || err.message || '操作失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
// 2025-02-04: 点击报名直接显示二维码弹窗,不再请求后端报名接口
|
||||
const qrCode = activity.activityGuideQrcode || activity.activity_guide_qrcode || this.data.qrcodeImageUrl
|
||||
this.setData({
|
||||
qrcodeImageUrl: qrCode,
|
||||
showQrcodeModal: true
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
<!-- 报名信息 -->
|
||||
<view class="activity-footer">
|
||||
<view class="participants">
|
||||
<!-- <text class="participant-text">{{item.participants}}人已报名</text> -->
|
||||
<text class="participant-text">{{item.participants}}人已报名</text>
|
||||
</view>
|
||||
<view class="signup-btn {{item.isSignedUp ? 'signed' : ''}}"
|
||||
catchtap="onSignUp"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user