新增教练端,实现业务闭环:会员登录注册→查询团课→预约团课→扫码签到→教练端开课→记录实际开课时间→教练端结课→记录实际结课时间→后台查询数据

This commit is contained in:
2026-07-20 17:21:28 +08:00
parent df0e68469b
commit 4a4697c816
84 changed files with 6914 additions and 258 deletions
@@ -233,10 +233,28 @@
let canBook = false
let btnText = '立即预约'
// 检查是否距离课程开始至少30分钟
const nowTime = new Date()
const minutesUntilStart = dt && !isNaN(dt) ? Math.round((dt - nowTime) / 60000) : 0
const isTooLate = minutesUntilStart < 30
const isPastStart = minutesUntilStart <= 0
if (statusStr === 0) {
canBook = !isFull
btnText = isFull ? '已约满' : '立即预约'
statusText = isFull ? '已约满' : ''
if (isPastStart) {
canBook = false
btnText = '课程已开始'
statusText = '课程已开始'
} else if (isTooLate) {
canBook = false
btnText = '需提前30分钟预约'
} else if (isFull) {
canBook = false
btnText = '已约满'
statusText = '已约满'
} else {
canBook = true
btnText = '立即预约'
}
} else if (statusStr === 1) {
statusText = '已取消'
statusClass = 'status-cancel'
+5 -1
View File
@@ -44,7 +44,11 @@ http.interceptors.response.use(
if (response.statusCode === 200) {
return response.data
}
return response
// 非200状态码:构造错误对象,确保 catch 块能正确读取 message
const error = new Error(response.data?.message || '请求失败')
error.statusCode = response.statusCode
error.data = response.data
return Promise.reject(error)
},
(error) => {
// 401 处理:清除登录态,跳转登录页