From c8f2222f1f06ba6937f91ff1e8d59632e3ddd589 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Tue, 5 Nov 2024 16:11:12 +0800
Subject: [PATCH] fix
---
src/api/index.js | 4 ++
src/pages/station/preview/index.vue | 16 +++--
src/pages/theoryExam/index.vue | 106 ++++++++++++++++++++++------
3 files changed, 100 insertions(+), 26 deletions(-)
diff --git a/src/api/index.js b/src/api/index.js
index 59476c6..34ac49d 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -37,6 +37,10 @@ export default {
getSandTableLastCache: `product/product/bank/operation/getSandTableLastCache`,
getSchoolCourseAuthority: `nakadai/nakadai/curriculum/getSchoolCourseAuthority`,
requestRenewalNotice: `nakadai/nakadai/curriculum/requestRenewalNotice`,
+ getTestPaperPracticeCache: `exam/exam/paper/getTestPaperPracticeCache`,
+ recordTestPaperPracticeCache: `exam/exam/paper/recordTestPaperPracticeCache`,
+ getRecentTestPaperPracticeCache: `exam/exam/paper/getRecentTestPaperPracticeCache`,
+ getRecentTestPaperPracticeByCid: `exam/exam/paper/getRecentTestPaperPracticeByCid`,
// 课程笔记
addNote: `nakadai/curriculumNotes/addNote`,
curriculumNoteList: `nakadai/curriculumNotes/curriculumNoteList`,
diff --git a/src/pages/station/preview/index.vue b/src/pages/station/preview/index.vue
index 44371a9..aceb791 100644
--- a/src/pages/station/preview/index.vue
+++ b/src/pages/station/preview/index.vue
@@ -816,8 +816,7 @@ export default {
this.curProject = item.projectId
},
// 展示选择项目弹框
- showProjectDia (isTheory) {
- this.isTheory = isTheory
+ showProjectDia () {
this.projectVisible = true
},
// 查询项目
@@ -833,7 +832,7 @@ export default {
}).catch(res => { })
},
// 进入实验
- entryProject (projectId) {
+ entryProject (projectId = '', paperId = '') {
this.$confirm('是否要继续上次的实验?', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
@@ -841,16 +840,23 @@ export default {
closeOnClickModal: false
}).then(() => {
this.curProject = projectId
+ this.curPaper = paperId
this.toSub()
}).catch(() => {
this.showProjectDia()
})
},
// 进入实验
- entry (isTheory) {
+ async entry (isTheory) {
+ this.isTheory = isTheory
if (isTheory) {
// 理论试卷
- this.showProjectDia(1)
+ const res = await this.$post(`${this.api.getRecentTestPaperPracticeByCid}?cid=${this.courseId}`)
+ if (res.recentCacheInfo) {
+ this.entryProject('', res.recentCacheInfo.paperId)
+ } else {
+ this.showProjectDia(1)
+ }
} else {
// 实训系统
// 查询上次做的项目(python跟沙盘接口不一样)
diff --git a/src/pages/theoryExam/index.vue b/src/pages/theoryExam/index.vue
index a990096..92708f2 100644
--- a/src/pages/theoryExam/index.vue
+++ b/src/pages/theoryExam/index.vue
@@ -25,8 +25,16 @@
{{ timeSum.seconds }}秒
-
点击重新开始,之前操作会清空。
确定重新开始吗?
', '提示', { + await this.$confirm('重新开始会清除答题记录,确定要继续吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', closeOnClickModal: false, dangerouslyUseHTMLString: true, }) + await this.clearPracticeCache() location.reload() } catch (e) { } } @@ -675,11 +714,11 @@ export default { }, // 提交 async submit (isSubmit, autoSubmit) { - if ((isSubmit && this.submiting) || (!isSubmit && this.paperId)) return false + if ((isSubmit && this.submiting) || (!isSubmit && this.per === 1)) return false try { if (isSubmit) this.submiting = true const form = _.cloneDeep(this.form) - const { entryTime, curStage } = this + const { entryTime, curStage, per } = this const ques = [] form.paperOutline.map(e => { const type = e.questionType @@ -709,7 +748,7 @@ export default { }) const data = { - competitionId: this.id, + competitionId: this.competitionId, stageId: curStage.stageId, teamId: this.teamId, startTime: Util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), // 取页面进入的时间 @@ -733,18 +772,26 @@ export default { data.assessmentId = this.assessmentId data.classId = this.classId } - // 缓存跟提交接口的参数一样 - await this.$post(this.api[this.assessmentId ? 'submitTheExamPaperForAssessment' : this.paperId ? 'submitTheExamPaperForPractice' : isSubmit ? 'submitTheExamPaper' : 'examPaperRecordCache'], data) + // 缓存跟提交接口的参数一样,(练习、考核、竞赛的提交是不同接口) + const res = await this.$post(this.api[isSubmit ? (per === 1 ? + 'submitTheExamPaperForAssessment' : !per ? 'submitTheExamPaperForPractice' : 'submitTheExamPaper') : + (!per ? 'recordTestPaperPracticeCache' : 'examPaperRecordCache')], data) if (isSubmit) { window.opener && window.opener.location.reload() clearInterval(this.counterTimer) this.submiting = false + if (res.reportId) { + this.reportId = res.reportId + this.score = res.score + } this.submited = true + per !== 2 && clearPracticeCache() + // 如果是时间到了自动提交,则提交完不弹框,直接关闭页面 if (autoSubmit) { - this.$alert(`${this.per == 2 ? '竞赛' : '考核'}时间已到,系统已自动交卷`, '提示', { + this.$alert(`${per == 2 ? '竞赛' : '考核'}时间已到,系统已自动交卷`, '提示', { confirmButtonText: '确定', type: 'warning', callback: _ => { @@ -753,7 +800,7 @@ export default { }) } else { // 如果是竞赛,并且勾选了公布成绩详情的选项,则弹框提示 - if (this.id) { + if (this.competitionId) { const time = curStage.resultAnnouncementTime const msg = time === 0 ? '提交成功!成绩将在比赛结束后公布,请前往参赛信息模块查看' : time > 0 ? `提交成功!成绩将在比赛结束后${time}小时公布,请前往参赛信息模块查看` : '提交成功'; @@ -807,8 +854,25 @@ export default { font-weight: 600; } - .submit { - width: 106px; + .score { + margin: 0 30px; + display: inline-flex; + align-items: center; + font-size: 15px; + color: #fff; + + .num { + padding: 0 8px; + margin-left: 7px; + color: #f00; + line-height: 2.4; + background-color: #fff; + border-radius: 20px; + } + } + + .btn { + min-width: 106px; font-size: 15px; }