新增e2e测试脚本,修复部分问题
This commit was merged in pull request #51.
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">人数</text>
|
||||
<text class="info-value">{{ course.currentMembers || 0 }} / {{ course.maxMembers || 0 }}人</text>
|
||||
<text class="info-value">{{ realMemberCount }} / {{ course.maxMembers || 0 }}人</text>
|
||||
</view>
|
||||
<view class="info-item" v-if="course.storedValueAmount">
|
||||
<text class="info-label">消耗</text>
|
||||
@@ -112,7 +112,8 @@
|
||||
loading: true,
|
||||
actionLoading: false,
|
||||
course: {},
|
||||
now: Date.now()
|
||||
now: Date.now(),
|
||||
realMemberCount: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -169,12 +170,19 @@
|
||||
async loadDetail() {
|
||||
this.loading = true
|
||||
try {
|
||||
const data = await coachApi.getCourseDetail(this.courseId)
|
||||
// 并行加载课程详情和实时预约列表
|
||||
const [data, bookings] = await Promise.all([
|
||||
coachApi.getCourseDetail(this.courseId),
|
||||
coachApi.getCourseBookings(this.courseId).catch(() => [])
|
||||
])
|
||||
this.course = {
|
||||
...(data || {}),
|
||||
coverImage: resolveCoverUrl((data || {}).coverImage),
|
||||
coverError: false
|
||||
}
|
||||
// 实时预约人数 = booking表中 status='0'(已预约) + status='2'(已出席) 的记录数
|
||||
const bookingsArr = Array.isArray(bookings) ? bookings : []
|
||||
this.realMemberCount = bookingsArr.filter(b => b.status === '0' || b.status === '2').length
|
||||
this.now = Date.now()
|
||||
} catch (e) {
|
||||
console.error('加载课程详情失败:', e)
|
||||
|
||||
Reference in New Issue
Block a user