新增e2e测试脚本,修复部分问题

This commit was merged in pull request #51.
This commit is contained in:
2026-07-22 20:00:13 +08:00
parent 53d1ce6fb2
commit 4c07ec5455
105 changed files with 21700 additions and 318 deletions
@@ -65,9 +65,9 @@
<view class="info-item">
<text class="info-label">人数</text>
<text class="info-value">
{{ course.currentMembers }} / {{ course.maxMembers }}
<text v-if="course.maxMembers - course.currentMembers > 0" class="remain-text">
({{ course.maxMembers - course.currentMembers }})
{{ realMemberCount }} / {{ course.maxMembers }}
<text v-if="course.maxMembers - realMemberCount > 0" class="remain-text">
({{ course.maxMembers - realMemberCount }})
</text>
</text>
</view>
@@ -165,7 +165,8 @@
statusClass: '',
coverImage: '',
coverError: false
}
},
realMemberCount: 0
}
},
onLoad(options) {
@@ -187,7 +188,11 @@
async loadCourseDetail(id) {
this.loading = true
try {
const detail = await courseApi.getCourseDetail(id)
// 并行加载课程详情和实时预约列表
const [detail, bookings] = await Promise.all([
courseApi.getCourseDetail(id),
bookingApi.getCourseBookings(id).catch(() => [])
])
if (detail) {
// 基础难度:优先 calculatedDifficulty,其次 baseDifficulty
const bd = detail.calculatedDifficulty || detail.baseDifficulty || 0
@@ -222,11 +227,14 @@
}
}
// 实时预约人数:booking表中 status='0'(已预约) + status='2'(已出席) 的记录数
const bookingsArr = Array.isArray(bookings) ? bookings : []
this.realMemberCount = bookingsArr.filter(b => b.status === '0' || b.status === '2').length
const maxMems = detail.maxMembers != null ? detail.maxMembers : 0
const isFull = maxMems > 0 && this.realMemberCount >= maxMems
// 状态:数据库 status 字段 (0正常 1已取消 2已结束 3进行中 4超时)
const statusStr = detail.status != null ? Number(detail.status) : 0
const curMembers = detail.currentMembers != null ? detail.currentMembers : 0
const maxMems = detail.maxMembers != null ? detail.maxMembers : 0
const isFull = maxMems > 0 && curMembers >= maxMems
let statusText = ''
let statusClass = ''
@@ -288,7 +296,7 @@
endShortTime: (ehh && emm) ? ehh + ':' + emm : '--',
duration: durationStr,
maxMembers: maxMems,
currentMembers: curMembers,
currentMembers: this.realMemberCount,
isFull: isFull,
canBook: canBook,
btnText: btnText,