From 23986d7b7e00791b0f6902113a3e0906f2629d45 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Mon, 3 Jun 2024 15:21:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/api.js | 2 ++ src/views/match/add/step1.vue | 3 +- src/views/match/add/step2.vue | 1 + src/views/match/add/step3.vue | 44 +++++++++++-------------- src/views/match/manage/abnormalTeam.vue | 2 +- src/views/match/manage/matchInfo.vue | 10 ++++-- src/views/match/manage/matchSignup.vue | 16 ++++++--- 7 files changed, 44 insertions(+), 34 deletions(-) diff --git a/src/utils/api.js b/src/utils/api.js index 1c4630d..46f2a0c 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -386,9 +386,11 @@ export default { schoolsInCompetitionArea: `competition/competition/range/schoolsInCompetitionArea`, batchDeleteApplicants: `competition/competition/registration/batchDeleteApplicants`, deleteAllData: `competition/competition/registration/deleteAllData`, + whetherThereIsReport: `competition/competitionAutomaticAllocationRecord/whetherThereIsReport`, batchImportPersonalData: `${host}competition/competition/registration/batchImportPersonalData`, batchImportTeamData: `${host}competition/competition/registration/batchImportTeamData`, TeamDataExportFailure: `${host}competition/competition/registration/exportFailure`, + exportAbnormalData: `${host}competition/teamAbnormalInformation/exportAbnormalData`, // 赛事公告 addAnnouncement: `competition/competition/announcement/addAnnouncement`, amendmentAnnouncement: `competition/competition/announcement/amendmentAnnouncement`, diff --git a/src/views/match/add/step1.vue b/src/views/match/add/step1.vue index 4a56467..0bba398 100644 --- a/src/views/match/add/step1.vue +++ b/src/views/match/add/step1.vue @@ -609,11 +609,12 @@ export default { const now = await Util.getNow() // 报名结束之后修改的报名结束时间早于当前现实时间的话,就调接口 - if (this.originSignUpEndTime && signUpEndTime !== this.originSignUpEndTime && new Date(signUpEndTime) < now) { + if (this.originSignUpEndTime && signUpEndTime !== this.originSignUpEndTime && (new Date(signUpEndTime) < now || (new Date(this.originSignUpEndTime) < now && new Date(signUpEndTime) > now))) { await this.$post(this.api.updateEventAllocationRecord, { competitionId: id, whetherToModifyTheRule: 1, }) + this.originSignUpEndTime = signUpEndTime } } }, diff --git a/src/views/match/add/step2.vue b/src/views/match/add/step2.vue index e5b192e..2204b8a 100644 --- a/src/views/match/add/step2.vue +++ b/src/views/match/add/step2.vue @@ -330,6 +330,7 @@ export default { break } } + // new Date(this.$parent.$refs.step1.form.signUpEndTime) if (form.rule !== originForm.rule || form.stageNum !== originForm.stageNum || form.teamLimit !== originForm.teamLimit || changeLimit) { await this.$post(this.api.updateEventAllocationRecord, { competitionId: +this.id, diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue index b43cdf9..d680493 100644 --- a/src/views/match/add/step3.vue +++ b/src/views/match/add/step3.vue @@ -319,7 +319,7 @@ export default { // 自动分配人员弹框 async autoAllocationConfirm (next) { const { data } = await this.$post(`${this.api.viewEventAllocationInformation}?competitionId=${this.competitionId}`) - if (data.assignOrNot === undefined || !this.form[0].contentId) { + if (!data || data.assignOrNot === undefined || !this.form[0].contentId) { // 首次发布 or 新增 才需要弹框 this.$confirm('

团队赛发布成功,是否要自动分配阶段参赛人员?

(点击“是”将会在报名结束后给报名的团队自动分配阶段参赛人员

', '提示', { confirmButtonText: '是', @@ -333,31 +333,25 @@ export default { this.automaticAllocation(0, next) }) } else { - const now = await Util.getNow() - // 报名结束时间>当前时间 - if (new Date(this.$parent.$refs.step1.form.signUpEndTime) > now) { - this.$emit('next', next) - } else { - // 查询是否需要弹框 - const res = await this.$post(`${this.api.editWhetherPopUpsAppear}?competitionId=${this.competitionId}`) - if (res.popupState) { - this.$confirm('

团队赛发布成功,是否要重新自动分配阶段参赛人员?

(点击“是”将会立即给报名的团队自动分配阶段参赛人员

', '提示', { - confirmButtonText: '是', - cancelButtonText: '否', - type: 'success', - closeOnClickModal: false, - showClose: false, - dangerouslyUseHTMLString: true, - }).then(async () => { - await this.$post(`${this.api.automaticAllocation}?competitionId=${this.id}`) // 立马分配 - this.$emit('next', next) - }).catch(() => { - this.automaticAllocation(0, next) - }) - } else { - // 无需弹框 + // 查询是否需要弹框 + const res = await this.$post(`${this.api.editWhetherPopUpsAppear}?competitionId=${this.competitionId}`) + if (res.popupState) { + this.$confirm('

团队赛发布成功,是否要重新自动分配阶段参赛人员?

(点击“是”将会立即给报名的团队自动分配阶段参赛人员

', '提示', { + confirmButtonText: '是', + cancelButtonText: '否', + type: 'success', + closeOnClickModal: false, + showClose: false, + dangerouslyUseHTMLString: true, + }).then(async () => { + await this.$post(`${this.api.automaticAllocation}?competitionId=${this.id}`) // 立马分配 this.$emit('next', next) - } + }).catch(() => { + this.automaticAllocation(0, next) + }) + } else { + // 无需弹框 + this.$emit('next', next) } } }, diff --git a/src/views/match/manage/abnormalTeam.vue b/src/views/match/manage/abnormalTeam.vue index 5f4bb2a..d8245da 100644 --- a/src/views/match/manage/abnormalTeam.vue +++ b/src/views/match/manage/abnormalTeam.vue @@ -563,7 +563,7 @@ export default { this.exporting = false }) } else { - axios.get(`${this.api.excelExport}?competitionId=${this.id}`, { + axios.get(`${this.api.exportAbnormalData}?competitionId=${this.id}`, { headers: { token: this.token }, diff --git a/src/views/match/manage/matchInfo.vue b/src/views/match/manage/matchInfo.vue index 4ca85d5..8bcec0c 100644 --- a/src/views/match/manage/matchInfo.vue +++ b/src/views/match/manage/matchInfo.vue @@ -6,7 +6,7 @@ - +
@@ -229,6 +229,7 @@ export default { return { id: +this.$route.query.id, accountId: +this.$route.query.accountId, + loading: false, status: 5, form: { competitionStage: [], @@ -296,6 +297,7 @@ export default { }, methods: { getData () { + this.loading = true this.$post(`${this.api.getCompetition}?competitionId=${this.id}`).then(({ competition }) => { this.form = competition this.timer = setInterval(this.handleStatus, 1000) @@ -335,6 +337,7 @@ export default { }) this.info = info this.form.completeCompetitionSetup.competitionType && this.getErrorInfo() + this.loading = false }).catch(err => { }); }, // 获取团队异常信息 @@ -344,7 +347,8 @@ export default { teamId: this.info.teamId }) this.teamErrors = res.teamTip.split(';').filter(e => e) - if (Object.keys(res.stageTip)) { + + if (Object.keys(res.stageTip).length) { this.stageTip = res.stageTip } }, @@ -529,7 +533,7 @@ export default { this.chooses = this.info.teamDetail } this.curRow = row - this.checkedMembers = row.participants.map(e => e.id) + this.checkedMembers = row.participants ? row.participants.map(e => e.id) : [] this.chooseVisible = true } }, diff --git a/src/views/match/manage/matchSignup.vue b/src/views/match/manage/matchSignup.vue index 0c95511..57759fc 100644 --- a/src/views/match/manage/matchSignup.vue +++ b/src/views/match/manage/matchSignup.vue @@ -18,7 +18,8 @@
{{ !notBeginSign && allocated ? '取消' : '' + :disabled="hasReport" :loading="allocating" @click="autoAllocationConfirm">{{ !notBeginSign && allocated ? + '取消' : '' }}自动分配阶段成员 导入 新增 @@ -284,6 +285,7 @@ export default { now: '', notBeginSign: true, allocated: true, + hasReport: false, allocating: false, loaded: 0, }; @@ -348,21 +350,27 @@ export default { // 团队赛才有自动分配 if (this.info.completeCompetitionSetup.competitionType) { - this.getAutomaticAllocation() - this.notBeginSign = this.now > new Date(this.info.signUpEndTime) // 是否在报名结束时间之前 // 判断当前处于报名结束前还是后,报名结束前显示:自动分配/取消分配。报名结束后显示:自动分配。 clearInterval(this.timer) this.now = await Util.getNow() + this.notBeginSign = this.now > new Date(this.info.signUpEndTime) // 是否在报名结束时间之前 + this.getAutomaticAllocation() this.timer = setInterval(() => { this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1)) this.notBeginSign = this.now > new Date(this.info.signUpEndTime) // 是否在报名结束时间之前 }, 1000) } }, - // 获取是否已分配 + // 查询分配状态 async getAutomaticAllocation () { + // 查询是否已分配 const res = await this.$post(`${this.api.viewEventAllocationInformation}?competitionId=${this.id}`) this.allocated = res.data && res.data.assignOrNot + + // 查询赛事是否存在实验报告 + const res1 = await this.$post(`${this.api.whetherThereIsReport}?competitionId=${this.id}`) + this.hasReport = res1.hasReport + this.allocating = false this.loaded = 1 },