From 4720fe6753c2359b33a7a261fc350db5a62f45d4 Mon Sep 17 00:00:00 2001 From: daihh Date: Thu, 27 Oct 2022 17:02:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=BE=E7=A8=8B=E8=80=83?= =?UTF-8?q?=E8=AF=95=E4=B8=AD=E7=9A=84=E4=B8=80=E4=B8=AAbug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/exam.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Course/exam.vue b/src/components/Course/exam.vue index a235855e..b5edbe38 100644 --- a/src/components/Course/exam.vue +++ b/src/components/Course/exam.vue @@ -347,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 => { @@ -396,9 +397,11 @@ export default { if(scoreNum === null)scoreNum=0; this.lastScore=scoreNum; //转化成百分制显示 + //console.log(scoreNum,totalScore,'实际分和总分'); if(this.info.percentScore){ this.lastScore=parseInt(scoreNum*100/totalScore); } + //console.log('本次得分='+this.lastScore); return this.lastScore; }, submitTest(){ //提交处理 @@ -408,6 +411,7 @@ export default { } let now=new Date(); let testScore=this.countTest(); + let postData={ studyId:this.studyId,// studyItemId:this.studyItemId,//前面已经给了 @@ -428,7 +432,7 @@ export default { var dateDiff = now.getTime() - this.startTime.getTime();//时间差的毫秒数 var minutes=Math.floor(dateDiff/(1000))//计算相差秒数,分钟记录的太大,经常为0 postData.testDuration=minutes; - + apiStudy.saveExam(postData).then(res=>{ if(res.status == 200) { this.records.push(res.result);