From c6066fc6e44645203c1647a0faa2c5b20d8f36f6 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Wed, 8 Feb 2023 10:41:42 +0800 Subject: [PATCH] fix --- src/pages/account/login/index.vue | 9 +- src/pages/match/details/index.vue | 110 ++++++++++------ src/pages/match/list/index.vue | 172 +++++++++++++----------- src/pages/station/preview/index.vue | 2 +- src/pages/touristMatch/list/index.vue | 183 ++++++++++++++------------ 5 files changed, 274 insertions(+), 202 deletions(-) diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index 10bef34..db33aca 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -330,6 +330,9 @@ export default { ...mapActions("user", [ "setInfo" ]), + ...mapMutations('match', [ + 'SET_SOURCE' + ]), // 赋值学校列表及id setSchool(list) { this.schoolList = list @@ -417,10 +420,12 @@ export default { util.cookies.remove('serverLogin') this.reloadIndex() util.successMsg('登录成功') + const { toMatch } = this + this.SET_SOURCE('') this.$router.replace(this.courseId ? `/preCourse/details?id=${this.courseId}` : - this.toMatch ? - `/touristMatch` : + toMatch ? + `/touristMatch/details?id=` + toMatch : '/station') }, // 提交登录 diff --git a/src/pages/match/details/index.vue b/src/pages/match/details/index.vue index c49a712..5cfa4b5 100644 --- a/src/pages/match/details/index.vue +++ b/src/pages/match/details/index.vue @@ -14,7 +14,15 @@ 距离{{ endList[status] }}还有 {{ end }}

- {{ statusList[status] }} + + + 选择竞赛 + + + 进入{{ item.stageName }} + + + {{ statusList[status] }}
@@ -246,7 +254,7 @@ {{tag.name}} @@ -415,7 +423,7 @@ export default { id: +this.$route.query.id, end: '', status: '', - statusList: ["等待报名", "取消报名", "立即报名", "报名截止", "进入初赛", "已结束"], + statusList: ["等待报名", "取消报名", "立即报名", "报名截止", "进入竞赛", "已结束"], endList: ["报名开始", "报名截止", "报名截止", "竞赛开始", "竞赛结束", ""], rules: Const.rules, methods: Const.methods, @@ -508,7 +516,8 @@ export default { checkedMember: '', checkedMembers: [], chooses: [], - lastType: 1 + lastType: 1, + playingStages: [] }; }, computed: { @@ -572,7 +581,7 @@ export default { }) this.getInfo() } - this.token() && this.getRank() + this.token && this.getRank() } else { this.typeList = this.typeList.slice(0, 3) } @@ -596,48 +605,64 @@ export default { status = 0 total = signUpStartTime - now } else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 - status = form.competitionRegistration ? 1 : 2 // 1已报名,2立即报名 + // 1已报名,2立即报名(没登录的情况下,直接显示立即报名,登录了则取报名信息,有则已报名,无则立即报名) + status = this.token ? + (form.competitionRegistration ? + 1 : + 2) : + 2 total = signUpEndTime - now } else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 status = 3 total = playStartTime - now } else if (now > playStartTime && now < playEndTime) { // 比赛进行中 - // 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 - let curStage = null - const stages = form.competitionStage - if (stages) { - let endText = '' - for (const i in stages) { - const e = stages[i] - const startTime = new Date(e.startTime) - const endTime = new Date(e.endTime) - if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 - endText = '阶段开始' - total = startTime - now - break - } else if (now >= startTime && now <= endTime && e.method !== 2) { // 阶段比赛进行中,显示进入比赛按钮 - if (form.competitionRegistration) { // 报名了才能进入比赛 - this.statusList[4] = e.count ? '已提交' : '进入' + e.stageName - curStage = e + // 如果是完整比赛 + if (form.releaseType) { + // 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 + let curStage = null + const stages = form.competitionStage + if (stages) { + this.playingStages = [] + stages.forEach(e => { + if (now >= new Date(e.startTime) && now <= new Date(e.endTime) && e.method !== 2) this.playingStages.push(e) + }) + let endText = '' + for (const i in stages) { + const e = stages[i] + const startTime = new Date(e.startTime) + const endTime = new Date(e.endTime) + if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 + endText = '阶段开始' + total = startTime - now + break + } else if (now >= startTime && now <= endTime && e.method !== 2) { // 阶段比赛进行中,显示进入比赛按钮 + if (form.competitionRegistration) { // 报名了才能进入比赛 + this.statusList[4] = e.count ? '已提交' : '进入' + e.stageName + curStage = e + } else if (!this.token) { + this.statusList[4] = '进入' + e.stageName + curStage = e + } + endText = '阶段结束' + total = endTime - now + break + } else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 + endText = '阶段开始' + total = new Date(stages[i + 1].startTime) - now + break + } else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 + this.$set(form, 'stageName', '') + endText = '竞赛结束' + total = playEndTime - now + break } - - endText = '阶段结束' - total = endTime - now - break - } else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 - endText = '阶段开始' - total = new Date(stages[i + 1].startTime) - now - break - } else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 - this.$set(form, 'stageName', '') - endText = '竞赛结束' - total = playEndTime - now - break } + this.endList[4] = endText } - this.endList[4] = endText + this.curStage = curStage + } else { // 仅发布信息 + total = playEndTime - now } - this.curStage = curStage status = 4 } else if (now > playEndTime) { // 比赛结束 status = 5 @@ -646,7 +671,7 @@ export default { total = total / 1000 --total if (total > 86400) { // 超过一天则显示天数 - clearInterval(this.timer) + // clearInterval(this.timer) this.end = Math.floor(total / 86400) + '天' } else if (total > 0) { // 一天之内,显示时分秒 let hours = Math.floor(total / (60 * 60)) @@ -1074,6 +1099,11 @@ export default { } }, + // 选择要进入的阶段 + chooseStage(e) { + this.curStage = e + this.signup() + }, // 判断是否能进赛事 getAllow() { // 是否允许参加赛事(淘汰赛制) @@ -1097,7 +1127,7 @@ export default { if (util.local.get(Setting.tokenKey)) { const { competitionType } = form.completeCompetitionSetup if (status == 4) { // 进入比赛 - if (this.curStage.count) return // 参加过比赛不让参加 + if (this.curStage && this.curStage.count) return // 参加过比赛不让参加 if (form.competitionRegistration.isDisable === 1) return util.errorMsg('当前用户已被禁赛,如有疑问,请联系平台管理员。') // 被禁用的用户不能进入大赛 // 团队赛,则判断是否为参赛人员 if (competitionType) { diff --git a/src/pages/match/list/index.vue b/src/pages/match/list/index.vue index d6c801c..7e9df80 100644 --- a/src/pages/match/list/index.vue +++ b/src/pages/match/list/index.vue @@ -100,8 +100,16 @@
+ + + 选择竞赛 + + + 进入{{ stage.stageName }} + +

{{ item.status == 4 ? item.stageName : statusList[item.status] }}

@@ -316,6 +324,7 @@ export default { 'SET_TYPE' ]), getList() { + this.clearTimer() const { form } = this const { eventType, competitionScope } = form const data = { @@ -357,82 +366,93 @@ export default { // 定时处理时间及状态 handleStatus() { this.listData.map(item => { - let total = '' - let time = '' - let status = '' - let signUpStartTime = new Date(this.core.dateCompatible(item.signUpStartTime)) // 报名开始时间 - let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // 报名结束时间 - let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // 比赛开始时间 - let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // 比赛结束时间 - let timer = setInterval(() => { - const now = new Date() - if (now < signUpStartTime) { // 报名没开始 - status = 0 - total = signUpStartTime - now - } else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 - // whetherToSignUp 0已报名,1未报名 - status = item.whetherToSignUp ? 2 : 1 // 1已报名,2立即报名 - total = signUpEndTime - now - } else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 - status = 3 - total = playStartTime - now - } else if (now > playStartTime && now < playEndTime) { // 比赛进行中 - // 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 - let curStage = null - const stages = item.competitionStageList - if (stages) { - for (const i in stages) { - const e = stages[i] - const startTime = new Date(e.startTime) - const endTime = new Date(e.endTime) - if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 - this.$set(item, 'stageName', '') - this.$set(item, 'endText', '阶段开始') - total = startTime - now - break - } else if (now >= startTime && now <= endTime) { // 阶段比赛进行中,显示进入比赛按钮 - if (item.whetherToSignUp === 0 && e.method !== 2) this.$set(item, 'stageName', e.count ? '已提交' : '进入' + e.stageName) // 报名了并且没参加比赛才能进入比赛 - this.$set(item, 'endText', '阶段结束') - curStage = e - total = endTime - now - break - } else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 - this.$set(item, 'stageName', '') - this.$set(item, 'endText', '阶段开始') - total = new Date(stages[i + 1].startTime) - now - break - } else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 - this.$set(item, 'stageName', '') - this.$set(item, 'endText', '竞赛结束') - total = playEndTime - now - break + if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) { + let total = '' + let time = '' + let status = '' + let signUpStartTime = new Date(this.core.dateCompatible(item.signUpStartTime)) // 报名开始时间 + let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // 报名结束时间 + let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // 比赛开始时间 + let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // 比赛结束时间 + let timer = setInterval(() => { + const now = new Date() + if (now < signUpStartTime) { // 报名没开始 + status = 0 + total = signUpStartTime - now + } else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 + // whetherToSignUp 0已报名,1未报名 + status = item.whetherToSignUp ? 2 : 1 // 1已报名,2立即报名 + total = signUpEndTime - now + } else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 + status = 3 + total = playStartTime - now + } else if (now > playStartTime && now < playEndTime) { // 比赛进行中 + // 如果是完整比赛 + if (item.releaseType) { + // 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 + let curStage = null + const stages = item.competitionStageList + if (stages) { + item.playingStages = [] + stages.forEach(e => { + if (now >= new Date(e.startTime) && now <= new Date(e.endTime) && e.method !== 2) item.playingStages.push(e) + }) + for (const i in stages) { + const e = stages[i] + const startTime = new Date(e.startTime) + const endTime = new Date(e.endTime) + if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 + this.$set(item, 'stageName', '') + this.$set(item, 'endText', '阶段开始') + total = startTime - now + break + } else if (now >= startTime && now <= endTime) { // 阶段比赛进行中,显示进入比赛按钮 + if (item.whetherToSignUp === 0 && e.method !== 2) this.$set(item, 'stageName', e.count ? '已提交' : '进入' + e.stageName) // 报名了并且没参加比赛才能进入比赛 + this.$set(item, 'endText', '阶段结束') + curStage = e + total = endTime - now + break + } else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 + this.$set(item, 'stageName', '') + this.$set(item, 'endText', '阶段开始') + total = new Date(stages[i + 1].startTime) - now + break + } else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 + this.$set(item, 'stageName', '') + this.$set(item, 'endText', '竞赛结束') + total = playEndTime - now + break + } + } } + item.curStage = curStage + } else { // 仅发布信息 + this.$set(item, 'endText', '竞赛结束') + total = playEndTime - now } + status = 4 + } else if (now > playEndTime) { // 比赛结束 + status = 5 } - item.curStage = curStage - status = 4 - } else if (now > playEndTime) { // 比赛结束 - status = 5 - } - this.$set(item, 'status', status) - total = total / 1000 - --total - if (total > 86400) { // 超过一天则显示天数 - clearInterval(timer) - this.$set(item, 'end', Math.floor(total / 86400) + '天') - } else if (total > 0) { // 一天之内,显示时分秒 - let hours = Math.floor(total / (60 * 60)) - let minutes = Math.floor(total % (60 * 60) / 60) - let seconds = Math.floor(total % (60 * 60) % 60) - time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` - if (total > 0) this.$set(item, 'end', time) - } else if (item.status === 5) { // 竞赛结束,清除定时器 - clearInterval(timer) - } - }, 1000) - this.timerList.push(timer) + this.$set(item, 'status', status) + total = total / 1000 + --total + if (total > 86400) { // 超过一天则显示天数 + // clearInterval(timer) + this.$set(item, 'end', Math.floor(total / 86400) + '天') + } else if (total > 0) { // 一天之内,显示时分秒 + let hours = Math.floor(total / (60 * 60)) + let minutes = Math.floor(total % (60 * 60) / 60) + let seconds = Math.floor(total % (60 * 60) % 60) + time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` + if (total > 0) this.$set(item, 'end', time) + } else if (item.status === 5) { // 竞赛结束,清除定时器 + clearInterval(timer) + } + }, 1000) + this.timerList.push(timer) + } }) - console.log("🚀 ~ file: index.vue:434 ~ handleStatus ~ timerList", this.listData) }, // 清除定时器 clearTimer() { @@ -492,7 +512,6 @@ export default { this.$router.push(`/match/details?id=${item.id}`); }, handleCurrentChange(val) { - this.clearTimer() this.page = val; this.getData(); }, @@ -546,6 +565,11 @@ export default { util.successMsg('报名成功!') }).catch(res => {}) }, + // 选择要进入的阶段 + chooseStage(e, item) { + item.curStage = e + this.signup(item) + }, // 判断是否能进赛事 getAllow(item) { // 是否允许参加赛事(淘汰赛制) diff --git a/src/pages/station/preview/index.vue b/src/pages/station/preview/index.vue index 9748b6c..c34669c 100644 --- a/src/pages/station/preview/index.vue +++ b/src/pages/station/preview/index.vue @@ -90,7 +90,7 @@

diff --git a/src/pages/touristMatch/list/index.vue b/src/pages/touristMatch/list/index.vue index 5c54e56..a5e629b 100644 --- a/src/pages/touristMatch/list/index.vue +++ b/src/pages/touristMatch/list/index.vue @@ -83,8 +83,16 @@
+ + + 选择竞赛 + + + 进入{{ stage.stageName }} + +

{{ item.status == 4 ? item.stageName : statusList[item.status] }}

@@ -279,6 +287,7 @@ export default { 'SET_SOURCE' ]), getList() { + this.clearTimer() const { form } = this const scope = form.competitionScope const data = { @@ -312,16 +321,6 @@ export default { this.listData = records this.totals = data.total this.handleStatus() - - // 如果是登录前点报名去登录的,则跳转到该赛事,toMatch存的是点击的赛事id,通过scrollIntoView去跳到赛事的位置 - const id = this.toMatch - if (id) { - this.$nextTick(() => { - this.SET_SOURCE('') - const item = records.find(e => e.id === id) - item && this.toDetail(item) - }) - } this.loadIns.close() }).catch(res => { this.loadIns.close() @@ -330,82 +329,92 @@ export default { // 定时处理时间及状态 handleStatus() { this.listData.map(item => { - let total = '' - let time = '' - let status = '' - let signUpStartTime = new Date(this.core.dateCompatible(item.signUpStartTime)) // 报名开始时间 - let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // 报名结束时间 - let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // 比赛开始时间 - let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // 比赛结束时间 - let timer = setInterval(() => { - const now = new Date() - if (now < signUpStartTime) { // 报名没开始 - status = 0 - total = signUpStartTime - now - } else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 - // whetherToSignUp 0已报名,1未报名 - status = item.whetherToSignUp === 0 ? 1 : 2 // 1已报名,2立即报名 - total = signUpEndTime - now - } else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 - status = 3 - total = playStartTime - now - } else if (now > playStartTime && now < playEndTime) { // 比赛进行中 - // 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 - let curStage = null - const stages = item.competitionStageList - if (stages) { - for (const i in stages) { - const e = stages[i] - const startTime = new Date(e.startTime) - const endTime = new Date(e.endTime) - if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 - this.$set(item, 'stageName', '') - this.$set(item, 'endText', '阶段开始') - total = startTime - now - break - } else if (now >= startTime && now <= endTime) { // 阶段比赛进行中,显示进入比赛按钮 - if ((item.whetherToSignUp === 0 || !util.local.get(Setting.tokenKey)) && e.method !== 2) this.$set(item, 'stageName', e.count ? '已提交' : '进入' + e.stageName) // 报名了并且没参加比赛才能进入比赛 - this.$set(item, 'endText', '阶段结束') - curStage = e - total = endTime - now - break - } else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 - this.$set(item, 'stageName', '') - this.$set(item, 'endText', '阶段开始') - total = new Date(stages[i + 1].startTime) - now - break - } else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 - this.$set(item, 'stageName', '') - this.$set(item, 'endText', '竞赛结束') - total = playEndTime - now - break + if (item.signUpStartTime && item.signUpEndTime && item.playStartTime && item.playEndTime) { + let total = '' + let time = '' + let status = '' + let signUpStartTime = new Date(this.core.dateCompatible(item.signUpStartTime)) // 报名开始时间 + let signUpEndTime = new Date(this.core.dateCompatible(item.signUpEndTime)) // 报名结束时间 + let playStartTime = new Date(this.core.dateCompatible(item.playStartTime)) // 比赛开始时间 + let playEndTime = new Date(this.core.dateCompatible(item.playEndTime)) // 比赛结束时间 + let timer = setInterval(() => { + const now = new Date() + if (now < signUpStartTime) { // 报名没开始 + status = 0 + total = signUpStartTime - now + } else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 + // whetherToSignUp 0已报名,1未报名 + status = item.whetherToSignUp === 0 ? 1 : 2 // 1已报名,2立即报名 + total = signUpEndTime - now + } else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 + status = 3 + total = playStartTime - now + } else if (now > playStartTime && now < playEndTime) { // 比赛进行中 + // 如果是完整比赛 + if (item.releaseType) { + // 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 + let curStage = null + const stages = item.competitionStageList + if (stages) { + item.playingStages = [] + stages.forEach(e => { + if (now >= new Date(e.startTime) && now <= new Date(e.endTime) && e.method !== 2) item.playingStages.push(e) + }) + for (const i in stages) { + const e = stages[i] + const startTime = new Date(e.startTime) + const endTime = new Date(e.endTime) + if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 + this.$set(item, 'stageName', '') + this.$set(item, 'endText', '阶段开始') + total = startTime - now + break + } else if (now >= startTime && now <= endTime) { // 阶段比赛进行中,显示进入比赛按钮 + if ((item.whetherToSignUp === 0 || !util.local.get(Setting.tokenKey)) && e.method !== 2) this.$set(item, 'stageName', e.count ? '已提交' : '进入' + e.stageName) // 报名了并且没参加比赛才能进入比赛 + this.$set(item, 'endText', '阶段结束') + curStage = e + total = endTime - now + break + } else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 + this.$set(item, 'stageName', '') + this.$set(item, 'endText', '阶段开始') + total = new Date(stages[i + 1].startTime) - now + break + } else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 + this.$set(item, 'stageName', '') + this.$set(item, 'endText', '竞赛结束') + total = playEndTime - now + break + } + } } + item.curStage = curStage + } else { // 仅发布信息 + this.$set(item, 'endText', '竞赛结束') + total = playEndTime - now } + status = 4 + } else if (now > playEndTime) { // 比赛结束 + status = 5 } - item.curStage = curStage - status = 4 - } else if (now > playEndTime) { // 比赛结束 - status = 5 - } - this.$set(item, 'status', status) - total = total / 1000 - --total - if (total > 86400) { // 超过一天则显示天数 - clearInterval(timer) - this.$set(item, 'end', Math.floor(total / 86400) + '天') - } else if (total > 0) { // 一天之内,显示时分秒 - let hours = Math.floor(total / (60 * 60)) - let minutes = Math.floor(total % (60 * 60) / 60) - let seconds = Math.floor(total % (60 * 60) % 60) - time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` - if (total > 0) this.$set(item, 'end', time) - } else if (item.status === 5) { // 竞赛结束,清除定时器 - clearInterval(timer) - } - console.log(33, this.listData) - }, 1000) - this.timerList.push(timer) - + this.$set(item, 'status', status) + total = total / 1000 + --total + if (total > 86400) { // 超过一天则显示天数 + // clearInterval(timer) + this.$set(item, 'end', Math.floor(total / 86400) + '天') + } else if (total > 0) { // 一天之内,显示时分秒 + let hours = Math.floor(total / (60 * 60)) + let minutes = Math.floor(total % (60 * 60) / 60) + let seconds = Math.floor(total % (60 * 60) % 60) + time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` + if (total > 0) this.$set(item, 'end', time) + } else if (item.status === 5) { // 竞赛结束,清除定时器 + clearInterval(timer) + } + }, 1000) + this.timerList.push(timer) + } }) }, // 清除定时器 @@ -456,7 +465,6 @@ export default { this.$router.push(`/touristMatch/details?id=${item.id}`); }, handleCurrentChange(val) { - this.clearTimer() this.page = val; this.getData(); }, @@ -509,6 +517,11 @@ export default { util.successMsg('报名成功!') }).catch(res => {}) }, + // 选择要进入的阶段 + chooseStage(e, item) { + item.curStage = e + this.signup(item) + }, // 判断是否能进赛事 getAllow(item) { // 是否允许参加赛事(淘汰赛制)