From 106f50701e68030a36222f913192a3175fb6d3f0 Mon Sep 17 00:00:00 2001 From: daihh Date: Thu, 27 Oct 2022 17:44:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=80=83=E8=AF=95=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/exam.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/Course/exam.vue b/src/components/Course/exam.vue index e380f203..0319c471 100644 --- a/src/components/Course/exam.vue +++ b/src/components/Course/exam.vue @@ -179,9 +179,14 @@ export default { this.loadExamInfo(); } }, + destroyed() { + if(this.timer){ + window.clearInterval(this.timer); + } + }, methods: { changeTimer(){ - if(this.timerValue==0){ + if(this.timerValue<=0){ window.clearInterval(this.timer); //系统自动提交 this.confirmStop(); @@ -332,7 +337,7 @@ export default { }).then(() => { this.submitTest() }).catch(()=>{ - + }) }else{ this.submitTest() @@ -342,7 +347,8 @@ export default { //console.log(this.paper.items); let totalScore=0; this.paper.items.forEach(item => { - totalScore+=item.score;//加到总分中 + item.score=parseInt(item.score); + totalScore+=item.score;//加到总分中 if(item.type != 102){ item.userAnswer=''; item.options.forEach(opt => { @@ -397,6 +403,10 @@ export default { return this.lastScore; }, submitTest(){ //提交处理 + //清空提示 + if(this.timer){ + window.clearInterval(this.timer); + } let now=new Date(); let testScore=this.countTest(); let postData={