diff --git a/src/libs/util.js b/src/libs/util.js index 79c63f6..90d034c 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -106,15 +106,15 @@ const util = { }, // 成功提示 successMsg(message) { - Message.success({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration: 1500}) + Message.success({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration: 3000}) }, // 警告提示 warningMsg(message) { - Message.warning({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration: 1500}) + Message.warning({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration: 3000}) }, // 错误提示 errorMsg(message) { - Message.error({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration: 1500}) + Message.error({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration: 3000}) }, } diff --git a/src/mixins/examDo/index.js b/src/mixins/examDo/index.js index fc4f7d1..df54629 100644 --- a/src/mixins/examDo/index.js +++ b/src/mixins/examDo/index.js @@ -29,6 +29,12 @@ export default { }, updateProgress(item,isFillBlank){ let subjects = this.subjects + + let singleAnswered = [] + let multipleAnswered = [] + let judgeAnswered = [] + let fillBlankAnswered = [] + let briefAnswerAnswered = [] if(isFillBlank){ let index = item.getAttribute('data-index') if([...item.parentElement.querySelectorAll('input')].some(n => n.value)){ @@ -37,12 +43,35 @@ export default { subjects[3][index].hadAnswer = 0 } this.fillBlankAnsweredCount = subjects[3].filter(n => n.hadAnswer).length + subjects[3].map((n,i) => { + n.hadAnswer && fillBlankAnswered.push(i) + }) + this.fillBlankAnswered = fillBlankAnswered }else{ this.singleAnsweredCount = subjects[0].filter(n => n.val).length this.multipleAnsweredCount = subjects[1].filter(n => n.val.length).length this.judgeAnsweredCount = subjects[2].filter(n => n.val).length this.briefAnswerAnsweredCount = subjects[4].filter(n => n.val).length + + subjects[0].map((n,i) => { + n.val && singleAnswered.push(i) + }) + subjects[1].map((n,i) => { + n.val.length && multipleAnswered.push(i) + }) + subjects[2].map((n,i) => { + n.val && judgeAnswered.push(i) + }) + subjects[4].map((n,i) => { + n.val && briefAnswerAnswered.push(i) + }) + + this.singleAnswered = singleAnswered + this.multipleAnswered = multipleAnswered + this.judgeAnswered = judgeAnswered + this.briefAnswerAnswered = briefAnswerAnswered } + let answered = this.singleAnsweredCount + this.multipleAnsweredCount + this.judgeAnsweredCount + this.fillBlankAnsweredCount + this.briefAnswerAnsweredCount this.progress = this.totalLen ? Math.floor((answered / this.totalLen * 100)) : 0 }, diff --git a/src/pages/achievement/assessment/index.vue b/src/pages/achievement/assessment/index.vue index 38961f3..1db668f 100644 --- a/src/pages/achievement/assessment/index.vue +++ b/src/pages/achievement/assessment/index.vue @@ -87,8 +87,6 @@
- 下载 - 下载 @@ -196,6 +194,7 @@ export default { if(n.typeName == '填空题'){ n.answer = answer.join(',') n.user_answer = n.user_answer ? n.user_answer.split('<>').filter(n => n).join(',') : '' + n.question_stem = n.question_stem.replace(/\(\)\(\)\(\)/g,`______`) } n.options = options } diff --git a/src/pages/achievement/list/examResults.vue b/src/pages/achievement/list/examResults.vue index 34d060c..b6e5a16 100644 --- a/src/pages/achievement/list/examResults.vue +++ b/src/pages/achievement/list/examResults.vue @@ -65,7 +65,7 @@ export default { keyword: function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.getData() + this.initData() },500) } }, @@ -82,6 +82,10 @@ export default { this.total = res.data.list.totalCount }).catch(res => {}) }, + initData(){ + this.page = 1 + this.getData() + }, handleCurrentChange(val) { this.page = val this.getData() diff --git a/src/pages/achievement/list/practiceResults.vue b/src/pages/achievement/list/practiceResults.vue index cc2c2f8..76de454 100644 --- a/src/pages/achievement/list/practiceResults.vue +++ b/src/pages/achievement/list/practiceResults.vue @@ -70,7 +70,7 @@ export default { keyword: function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.getData() + this.initData() },500) } }, @@ -89,6 +89,10 @@ export default { this.total = res.data.list.totalCount }).catch(res => {}) }, + initData(){ + this.page = 1 + this.getData() + }, handleDelete(row) { this.$confirm('确定要删除吗?', '提示', { type: 'warning' diff --git a/src/pages/achievement/practice/index.vue b/src/pages/achievement/practice/index.vue index 3bca8e6..956e0d4 100644 --- a/src/pages/achievement/practice/index.vue +++ b/src/pages/achievement/practice/index.vue @@ -157,6 +157,7 @@ export default { } n.answer = answer.join(',') n.userAnswer = n.userAnswer ? n.userAnswer.split('<>').filter(n => n).join(',') : '' + n.questionStem = n.questionStem.replace(/\(\)\(\)\(\)/g,`______`) } if(n.fileUrl) n.fileUrl = JSON.parse(n.fileUrl) if(n.videoAudio) n.videoAudio = JSON.parse(n.videoAudio) diff --git a/src/pages/exam/do/index.vue b/src/pages/exam/do/index.vue index 50819dc..f2434bb 100644 --- a/src/pages/exam/do/index.vue +++ b/src/pages/exam/do/index.vue @@ -10,34 +10,34 @@
-
-

单选题(共{{singleCount}}题,合计{{singlePoint}}分)

+
+

单选题({{singlePoint}}分/{{singleCount}}题,合计{{singlePoint * singleCount}}分)

- {{n}} + {{n}}
-
-

多选题(共{{multipleCount}}题,合计{{multipleChoiceScore}}分)

+
+

多选题({{multipleChoiceScore}}分/{{multipleCount}}题,合计{{multipleChoiceScore * multipleCount}}分)

- {{n}} + {{n}}
-
-

判断题(共{{judgeCount}}题,合计{{judgeScore}}分)

+
+

判断题({{judgeScore}}分/{{judgeCount}}题,合计{{judgeScore * judgeCount}}分)

- {{n}} + {{n}}
-
-

填空题(共{{fillBlankCount}}题,合计{{fillBlanksScore}}分)

+
+

填空题({{fillBlanksScore}}分/{{fillBlankCount}}题,合计{{fillBlanksScore * fillBlankCount}}分)

- {{n}} + {{n}}
-
-

简答题(共{{briefAnswerCount}}题,合计{{briefAnswerScore}}分)

+
+

简答题({{briefAnswerScore}}分/{{briefAnswerCount}}题,合计{{briefAnswerScore * briefAnswerCount}}分)

- {{n}} + {{n}}
@@ -87,7 +87,7 @@ > 上传文件 - +
@@ -121,6 +121,11 @@ export default { judgeAnsweredCount: 0, fillBlankAnsweredCount: 0, briefAnswerAnsweredCount: 0, + singleAnswered: [], + multipleAnswered: [], + judgeAnswered: [], + fillBlankAnswered: [], + briefAnswerAnswered: [], singlePoint: 0, multipleChoiceScore: 0, @@ -188,6 +193,7 @@ export default { this.$get(`${this.api.enterExam}?testPaperId=${this.testPaperId}&userId=${this.userId}&assessmentId=${this.assessmentId}`) .then(res => { let data = res.data + if(res.data.entertime) this.startTime = new Date(res.data.entertime).getTime() this.subjects = [ [...data.singleChoiceList], [...data.multipleChoiceList], @@ -209,8 +215,7 @@ export default { this.scoreList = [this.singlePoint,this.multipleChoiceScore,this.fillBlanksScore,this.briefAnswerScore,this.briefAnswerScore] this.handleOptions() - }) - .catch(err => {}) + }).catch(err => {}) }, getAnswer() { this.$get(`${this.api.queryGzAnswerDetails}?userId=${this.userId}&assessmentId=${this.assessmentId}&testPaperId=${this.testPaperId}`) @@ -239,6 +244,7 @@ export default { n.value = answer[j] }) n.val = answered.userAnswer + if(answer.filter(n => n).length) n.hadAnswer = 1 }else{ n.val = answered.userAnswer } @@ -248,6 +254,33 @@ export default { } }) }) + let subjects = this.subjects + let singleAnswered = [] + let multipleAnswered = [] + let judgeAnswered = [] + let fillBlankAnswered = [] + let briefAnswerAnswered = [] + subjects[0].map((n,i) => { + n.val && singleAnswered.push(i) + }) + subjects[1].map((n,i) => { + n.val.length && multipleAnswered.push(i) + }) + subjects[2].map((n,i) => { + n.val && judgeAnswered.push(i) + }) + subjects[3].map((n,i) => { + n.hadAnswer && fillBlankAnswered.push(i) + }) + subjects[4].map((n,i) => { + n.val && briefAnswerAnswered.push(i) + }) + + this.singleAnswered = singleAnswered + this.multipleAnswered = multipleAnswered + this.judgeAnswered = judgeAnswered + this.fillBlankAnswered = fillBlankAnswered + this.briefAnswerAnswered = briefAnswerAnswered }) .catch(err => {}) }, @@ -300,6 +333,7 @@ export default { this.$post(`${this.api.getStateById}?id=${this.assessmentId}`) .then(res => { if(res.data.state == '已结束'){ + clearInterval(this.queryStateTimer) this.isDone = true this.save() } @@ -328,14 +362,16 @@ export default { if(i == 1){ userAnswer = n.val.join('') }else if(i == 3){ - userAnswer = [...document.querySelectorAll(`.stem${i}${k} input`)].map(n => n.value).join('<>') + userAnswer = [...document.querySelectorAll(`.stem${i}${k} input`)].map(n => n.value).filter(n => n).join('<>') }else{ userAnswer = n.val } - n.fileUrl = JSON.stringify(n.fileUrl) - n.video = JSON.stringify(n.video) - if(n.fileUrl == '{}') n.fileUrl = '' - if(n.video == '{}') n.video = '' + let fileUrl = n.fileUrl + let videoAudio = n.video + fileUrl = JSON.stringify(fileUrl) + videoAudio = JSON.stringify(videoAudio) + if(fileUrl == '{}') fileUrl = '' + if(videoAudio == '{}') videoAudio = '' data1.push({ assessmentId: this.assessmentId, questionId: n.id, @@ -343,12 +379,11 @@ export default { testPaperId: this.testPaperId, userAnswer, userId: this.userId, - fileUrl: n.fileUrl, - videoAudio: n.video + fileUrl, + videoAudio }) }) }) - this.$post(`${this.api.coverGzAnswerDetails}?userId=${this.userId}&testPaperId=${this.testPaperId}&assessmentId=${this.assessmentId}`) .then(res => { this.$post(`${this.api.addGzAnswerDetails}`,data1) @@ -393,14 +428,16 @@ export default { if(i == 1){ userAnswer = n.val.join('') }else if(i == 3){ - userAnswer = [...document.querySelectorAll(`.stem${i}${k} input`)].map(n => n.value).join('<>') + userAnswer = [...document.querySelectorAll(`.stem${i}${k} input`)].map(n => n.value).filter(n => n).join('<>') }else{ userAnswer = n.val } - n.fileUrl = JSON.stringify(n.fileUrl) - n.video = JSON.stringify(n.video) - if(n.fileUrl == '{}') n.fileUrl = '' - if(n.video == '{}') n.video = '' + let fileUrl = n.fileUrl + let videoAudio = n.video + fileUrl = JSON.stringify(fileUrl) + videoAudio = JSON.stringify(videoAudio) + if(fileUrl == '{}') fileUrl = '' + if(videoAudio == '{}') videoAudio = '' data1.push({ testPaperId: this.testPaperId, assessmentId: this.assessmentId, @@ -409,19 +446,17 @@ export default { testPaperId: this.testPaperId, userAnswer: userAnswer, userId: this.userId, - fileUrl: n.fileUrl, - videoAudio: n.video + fileUrl, + videoAudio }) }) }) - this.$post(`${this.api.coverGzAnswerDetails}?userId=${this.userId}&testPaperId=${this.testPaperId}&assessmentId=${this.assessmentId}`) - .then(res => { + this.$post(`${this.api.coverGzAnswerDetails}?userId=${this.userId}&testPaperId=${this.testPaperId}&assessmentId=${this.assessmentId}`).then(res => { this.$post(`${this.api.addGzAnswerDetails}`,data1) .then(res => {}) .catch(err => {}) - }) - .catch(err => {}) + }).catch(err => {}) } }, }, diff --git a/src/pages/exam/list/index.vue b/src/pages/exam/list/index.vue index 46ee1e5..6f9361a 100644 --- a/src/pages/exam/list/index.vue +++ b/src/pages/exam/list/index.vue @@ -10,7 +10,7 @@
  • - + @@ -53,7 +53,7 @@ {{getAssessmentStateName(scope.row.assessmentState)}} - + - + + +