diff --git a/src/api/index.js b/src/api/index.js index 976f38d..ddfd816 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -25,4 +25,5 @@ export default { reviewPaper: `/nakadai/evaluation/reviewPaper`, setComments: `/nakadai/evaluation/setComments`, getTheLabReportIdUpAndDown: `/nakadai/evaluation/getTheLabReportIdUpAndDown`, + deleteComments: `/nakadai/evaluation/deleteComments`, } \ No newline at end of file diff --git a/src/pages/myReview/records/index.vue b/src/pages/myReview/records/index.vue index 3239a9b..41a84b0 100644 --- a/src/pages/myReview/records/index.vue +++ b/src/pages/myReview/records/index.vue @@ -292,7 +292,7 @@ export default { }, // 评阅 toReview (row, i) { - window.open(this.$router.resolve(`/theoryReview?id=${row.reportId}&u=${+this.showUserInfo}&m=${this.setup.hasManualScoreType}&c=${this.competitionId}&s=${this.stageId}&i=${(this.page - 1) * this.pageSize + i + 1}`).href) + window.open(this.$router.resolve(`/theoryReview?id=${row.reportId}&u=${+this.showUserInfo}&m=${this.setup.hasManualScoreType}&c=${this.competitionId}&s=${this.stageId}`).href) }, } }; diff --git a/src/pages/myReview/theoryReview/index.vue b/src/pages/myReview/theoryReview/index.vue index e8cd38c..67c0b1c 100644 --- a/src/pages/myReview/theoryReview/index.vue +++ b/src/pages/myReview/theoryReview/index.vue @@ -4,8 +4,8 @@

{{ paperName }}

- 上一个 - 下一个 + 上一个 + 下一个 一键保存分数
@@ -31,7 +31,7 @@
  • {{ j + 1 }}

    -

    {{ ques.userScore }}

    +

    {{ ques.originUserScore }}

  • @@ -140,11 +140,12 @@
    题目分值:{{ ques.questionScore }}分
    考生得分:分  - 保存分数 + v-model.number="ques.reviewScore" />分  + 保存分数 + v-model="ques.newComments" />
    保存
    @@ -153,12 +154,13 @@
    -
    +
    评语:
    - 2024-12-12 + {{ ques.commentSetTime }} -
    xxx
    + +
    @@ -207,7 +209,7 @@ export default { return { numToLetter: Util.numToLetter, arabicToChinese: Util.arabicToChinese, - reportId: '', + reportId: this.$route.query.id, competitionId: this.$route.query.c, stageId: this.$route.query.s, showUserInfo: +this.$route.query.u, // 是否展示学生信息 @@ -253,28 +255,19 @@ export default { ], info: {}, paper: [], - records: [], + showNext: true, + showPrev: true, page: 1, recordTotal: 0, previewImgVisible: false, previewImg: '', pdfVisible: false, pdfSrc: '', - exporting: false, + submiting: false, }; }, - watch: { - $route: { - handler () { - this.curIndex = +this.$route.query.i - this.reportId = this.$route.query.id - this.getData() - }, - immediate: true - } - }, mounted () { - this.getRecords() + this.getData() }, methods: { async getData () { @@ -300,7 +293,6 @@ export default { n.difficultTheme = curDiff.theme } } - if (!n.comments) n.comments = '' const opts = n.questionAnswerVersionsList if (type !== 'fill_blank' && type !== 'essay') { // 选择题 @@ -353,8 +345,11 @@ export default { n.isCorrect = n.userScore && n.questionScore === n.userScore ? 1 : (rightLen ? 3 : 2) } else if (type === 'essay') { // 简答题 if (!n.userScore) n.userScore = '' + if (!n.reviewScore) n.reviewScore = '' n.isCorrect = 4 // 简答题显示待判分 } + n.originUserScore = n.reviewScore + n.newComments = n.comments || '' }) paper.push(e) } @@ -367,19 +362,6 @@ export default { this.loading = false } }, - // 查询批阅记录列表,用以上一页下一页切换 - async getRecords () { - this.page = Math.ceil(this.curIndex / 10) || 1 - const { page } = await this.$post(this.api.myReviewTaskByReviewList, { - pageNum: this.page, - pageSize: 10, - competitionId: this.competitionId, - stageId: this.stageId, - }) - const list = page.records - this.records = list - this.recordTotal = page.total - }, scrollToSmooth (position, duration) { let startTime = Date.now() @@ -431,69 +413,77 @@ export default { }, // 保存分数 async saveScore (ques) { + if (ques.reviewScore === '') return Util.warningMsg('请输入考生得分!') + if (ques.questionScore < ques.reviewScore) return Util.warningMsg('考生得分不得大于题目分值!') + await this.$post(this.api.reviewPaper, [{ assignmentDetailId: ques.assignmentDetailId, - score: ques.userScore, + reviewScore: ques.reviewScore, }]) + ques.originUserScore = ques.reviewScore Util.successMsg('保存成功') }, // 保存评语 async saveComment (ques) { - await this.$post(this.api.setComments, { + const res = await this.$post(this.api.setComments, { assignmentDetailId: ques.assignmentDetailId, - comments: ques.comments, + comments: ques.newComments, }) + this.$set(ques, 'commentSetTime', res.commentSetTime) + this.$set(ques, 'comments', ques.newComments) Util.successMsg('保存成功') }, // 删除评语 async delComment (ques) { - await this.$post(this.api.reviewPaper, { - assignmentDetailId: ques.assignmentDetailId, - score: ques.userScore, + await this.$confirm(`确定要删除该评语吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', }) + await this.$post(`${this.api.deleteComments}?assignmentDetailId=${ques.assignmentDetailId}`) + ques.comments = '' Util.successMsg('删除成功') }, // 上一个 async prev () { - this.exporting = true - const res = await axios.get(`${this.api.exportExamPaperReport}?reportId=${this.reportId}`, { - headers: { - token: this.token - }, - responseType: 'blob' - }) - const name = res.headers['content-disposition'] - Util.downloadFileDirect(name ? decodeURI(name) : '标准成绩报告.docx', new Blob([res.data])) - this.exporting = false + }, // 下一个 - async next () { - const i = this.curIndex + 1 - const newPage = Math.ceil(i / 10) || 1 - // debugger - if (newPage > this.page) { - await this.getRecords() - } - if (this.records[i % 10 - 1]) { - let reportId = this.records[i % 10 - 1].reportId - this.$router.push(`/theoryReview?id=${reportId}&u=${this.showUserInfo}&c=${this.competitionId}&s=${this.stageId}&i=${i}`) + async switchRecord (isNext) { + const res = await this.$post(this.api.getTheLabReportIdUpAndDown, { + competitionId: this.competitionId, + stageId: this.stageId, + currentReportId: this.reportId + }) + const id = res[isNext ? 'nextReportId' : 'previousReportId'] + this[isNext ? 'showNext' : 'showPrev'] = !!id + if (id) { + this.reportId = id + this.$router.push(`/theoryReview?id=${id}&u=${this.showUserInfo}&c=${this.competitionId}&s=${this.stageId}`) + this.getData() } }, // 一键保存分数 async saveAll () { - const { paper } = this - const params = [] - paper.forEach(e => { - e.userAnswerList.forEach(n => { - n.userScore !== '' && params.push({ - assignmentDetailId: n.assignmentDetailId, - score: n.userScore, + if (this.submiting) return false + try { + this.submiting = true + const { paper } = this + const params = [] + paper.forEach(e => { + e.userAnswerList.forEach(n => { + n.reviewScore !== '' && params.push({ + assignmentDetailId: n.assignmentDetailId, + reviewScore: n.reviewScore, + }) }) }) - }) - await this.$post(this.api.reviewPaper, params) - Util.successMsg('保存成功') + await this.$post(this.api.reviewPaper, params) + Util.successMsg('保存成功') + } finally { + this.submiting = false + } }, close () { window.close()