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