整合api请求、添加购买会员卡页面、登陆页面
This commit is contained in:
@@ -57,6 +57,14 @@ export function canCancelBooking(item) {
|
||||
return diff >= 2 * 3600000
|
||||
}
|
||||
|
||||
export function canSigninCourse(item) {
|
||||
if (!item?.courseDate || !item?.startTime) return false
|
||||
if (item.status !== 'booked' && item.status !== 0) return false
|
||||
const start = new Date(`${item.courseDate} ${item.startTime}`.replace(/-/g, '/'))
|
||||
const diff = start - Date.now()
|
||||
return diff <= 2 * 3600000 && diff >= -2 * 3600000
|
||||
}
|
||||
|
||||
export function bookCourse(store, courseId) {
|
||||
const course = store.courseCatalog.find((c) => c.id === Number(courseId))
|
||||
if (!course) return { ok: false, message: '课程不存在' }
|
||||
|
||||
Reference in New Issue
Block a user