mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 03:46:44 +08:00
修改课程内考试分数错误的问题
This commit is contained in:
@@ -278,6 +278,7 @@ export default {
|
||||
this.total=paper.items.length;
|
||||
this.paper =paper;
|
||||
//console.log(this.paper);
|
||||
|
||||
this.curItem=paper.items[this.curIndex];
|
||||
this.startTime=new Date();//记录开始时间
|
||||
this.timerValue=this.info.testDuration;
|
||||
@@ -335,12 +336,12 @@ export default {
|
||||
showClose:false,
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.submitTest()
|
||||
this.submitTest(score);
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
}else{
|
||||
this.submitTest()
|
||||
this.submitTest(score);
|
||||
}
|
||||
},
|
||||
countTest(){ //计算考试的分数
|
||||
@@ -382,11 +383,20 @@ export default {
|
||||
noAnswers.push(idx+1);
|
||||
}
|
||||
let allRight = true;
|
||||
//console.log('用户的答案',item.userAnswer);
|
||||
item.options.forEach(it =>{
|
||||
if(it.answer && item.userAnswer.indexOf(it.id)==-1) {
|
||||
allRight=false;
|
||||
//console.log('选项',it.answer,it.id,item.userAnswer.indexOf(it.id));
|
||||
if(it.answer){ //正确答案
|
||||
if(item.userAnswer.indexOf(it.id)==-1){
|
||||
allRight=false;
|
||||
}
|
||||
}else{
|
||||
if(item.userAnswer.indexOf(it.id)>-1){
|
||||
allRight=false;
|
||||
}
|
||||
}
|
||||
});
|
||||
//console.log('是否回答正确',allRight)
|
||||
if(allRight){
|
||||
scoreNum+=item.score;
|
||||
}
|
||||
@@ -404,14 +414,15 @@ export default {
|
||||
//console.log('本次得分='+this.lastScore);
|
||||
return this.lastScore;
|
||||
},
|
||||
submitTest(){ //提交处理
|
||||
submitTest(testScore){ //提交处理
|
||||
//清空提示
|
||||
if(this.timer){
|
||||
window.clearInterval(this.timer);
|
||||
}
|
||||
let now=new Date();
|
||||
let testScore=this.countTest();
|
||||
|
||||
if(!testScore){
|
||||
testScore=this.countTest();
|
||||
}
|
||||
let postData={
|
||||
studyId:this.studyId,//
|
||||
studyItemId:this.studyItemId,//前面已经给了
|
||||
|
||||
Reference in New Issue
Block a user