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={