From f65c4178f6acb19bb4d39232527d4de2cdb0d432 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Mon, 30 Sep 2024 13:45:23 +0800 Subject: [PATCH] fix --- src/pages/allocationReview/list/setup.vue | 5 +- src/pages/myReview/theoryReview/index.vue | 114 ++++++++++++++-------- 2 files changed, 75 insertions(+), 44 deletions(-) diff --git a/src/pages/allocationReview/list/setup.vue b/src/pages/allocationReview/list/setup.vue index 96f9826..4d224a6 100644 --- a/src/pages/allocationReview/list/setup.vue +++ b/src/pages/allocationReview/list/setup.vue @@ -169,14 +169,15 @@ export default { // 获取详情 async getDetail () { try { - const id = this.row.evaluationId + const { row } = this + const id = row.evaluationId if (id) { const { data } = await this.$post(`${this.api.evaluationFind}?id=${id}`) this.form = { allowManualGrading: data.allowManualGrading, anonymizeStudents: data.anonymizeStudents, evaluationId: data.evaluationId, - isTimed: data.isTimed, + isTimed: row.resultsDetails ? data.isTimed : 1, // 成绩没公布,则取保存的isTimed;成绩公布,则限时不限时不可选择,并且固定限时 reviewersPerQuestion: data.reviewersPerQuestion, scoreAggregationRule: data.scoreAggregationRule, } diff --git a/src/pages/myReview/theoryReview/index.vue b/src/pages/myReview/theoryReview/index.vue index eeb26ea..dce01b5 100644 --- a/src/pages/myReview/theoryReview/index.vue +++ b/src/pages/myReview/theoryReview/index.vue @@ -282,8 +282,8 @@ export default { async getData (init) { this.loading = true try { - const { userAnswers: outline, report } = await this.$get(`${this.api.reviewTheDetailsReport}?reportId=${this.reportId}&status=${this.curReview}`) - this.info = report + const { userAnswers: outline, entryInformation: info } = await this.$get(`${this.api.reviewTheDetailsReport}?reportId=${this.reportId}&status=${this.curReview}`) + this.info = info // 处理试题信息 const { questionTypes: types, difficults } = QuesConst @@ -481,52 +481,82 @@ export default { }, // 判断是否需要弹框提示保存分数 - async handleLeave (cb) { - const { paper } = this - let invalid = 0 - for (const e of paper) { - if (e.userAnswerList.some(n => n.originUserScore !== n.reviewScore)) { - invalid = 1 - break + async handleLeave (type, cb) { + if (this.readonly) { + cb() + } else { + const { paper } = this + let invalid = 0 + for (const e of paper) { + if (e.userAnswerList.some(n => n.originUserScore !== n.reviewScore)) { + invalid = 1 + break + } } - } - - if (invalid) { - try { - await this.$confirm('还有未保存的分数,是否保存并继续?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - closeOnClickModal: false, - }) - await this.saveAll() - cb() - } catch (e) { } - } else { - cb() + if (invalid) { + try { + await this.$confirm('还有未保存的分数,是否保存并继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + closeOnClickModal: false, + }) + await this.saveAll() + + cb() + } catch (e) { } + } else { + // 如果没有未保存的分数,则判断是否还有未评阅的试题 + const { userAnswers: outline } = await this.$get(`${this.api.reviewTheDetailsReport}?reportId=${this.reportId}&status=0`) + for (const e of outline) { + if (e.userAnswerList.length) { + invalid = 1 + break + } + } + if (invalid) { + await this.$confirm(`还有试题未评阅,确定要${!type ? '前往上一个' : type === 1 ? '前往下一个' : '退出'}吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + closeOnClickModal: false, + }) + cb() + } else { + cb() + } + } + } + }, + // 查询上一个下一个id + async queryRecord (isNext, init) { + const res = await this.$post(this.api.getTheLabReportIdUpAndDown, { + competitionId: this.competitionId, + stageId: this.stageId, + currentReportId: this.reportId + }) + this.showNext = !init && !isNext && res.previousReportId ? true : (init ? !!res.nextReportId : !!res.nextNextReportId) + this.showPrev = !init && isNext && res.nextReportId ? true : (init ? !!res.previousReportId : !!res.previousPreviousReportId) + + if (!init) { + const id = res[isNext ? 'nextReportId' : 'previousReportId'] + if (id) { + this.reportId = id + this.$router.push(`/theoryReview?id=${id}&u=${this.showUserInfo}&m=${this.hasManualScoreType}&c=${this.competitionId}&s=${this.stageId}&r=${this.readonly ? 1 : 0}`) + this.getData() + } } }, // 下一个、上一个 async switchRecord (isNext, init) { - this.handleLeave(async () => { - const res = await this.$post(this.api.getTheLabReportIdUpAndDown, { - competitionId: this.competitionId, - stageId: this.stageId, - currentReportId: this.reportId + if (init) { + this.queryRecord(isNext, init) + } else { + this.handleLeave(isNext, async () => { + this.queryRecord(isNext, init) }) - this.showNext = !init && !isNext && res.previousReportId ? true : (init ? !!res.nextReportId : !!res.nextNextReportId) - this.showPrev = !init && isNext && res.nextReportId ? true : (init ? !!res.previousReportId : !!res.previousPreviousReportId) - - if (!init) { - const id = res[isNext ? 'nextReportId' : 'previousReportId'] - if (id) { - this.reportId = id - this.$router.push(`/theoryReview?id=${id}&u=${this.showUserInfo}&m=${this.hasManualScoreType}&c=${this.competitionId}&s=${this.stageId}&r=${this.readonly ? 1 : 0}`) - this.getData() - } - } - }) + } }, // 一键保存分数 async saveAll () { @@ -552,7 +582,7 @@ export default { } }, close () { - this.handleLeave(window.close) + this.handleLeave(2, window.close) }, } };