mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-08 10:26:43 +08:00
考试bug
This commit is contained in:
@@ -331,12 +331,16 @@ export default {
|
||||
getAnswerDetail(id) { //获取答卷的详细信息
|
||||
apiTestPaper.getAnswerDetail(id).then(res=>{
|
||||
if(res.status === 200) {
|
||||
let answerJson = JSON.parse(res.result.answerJson);
|
||||
let paperJson = JSON.parse(res.result.paperJson);
|
||||
let answerJson = [];
|
||||
answerJson=JSON.parse(res.result.answerJson);
|
||||
let paperJson = [];
|
||||
paperJson=JSON.parse(res.result.paperJson);
|
||||
let answer = [];
|
||||
let data = [];
|
||||
for(let key in answerJson){
|
||||
answer.push(key);
|
||||
paperJson.forEach((item,index) => {
|
||||
item.result=true;
|
||||
if(item.id == key) {
|
||||
if(item.type==1){
|
||||
item.userAnswer='';
|
||||
@@ -345,9 +349,8 @@ export default {
|
||||
}else{
|
||||
item.userAnswer=''
|
||||
}
|
||||
item.correctOptIdxs=[];
|
||||
item.userOptIdxs=[];
|
||||
|
||||
item.correctOptIdxs=[];
|
||||
item.userOptIdxs=[];
|
||||
if(item.type==1){
|
||||
item.userAnswer=answerJson[key];
|
||||
}else if(item.type==2){
|
||||
@@ -355,12 +358,12 @@ export default {
|
||||
}else{
|
||||
item.userAnswer=answerJson[key]
|
||||
}
|
||||
data.push(item);
|
||||
// item.userAnswer.push(answerJson[key]);
|
||||
}
|
||||
item.result=true;
|
||||
});
|
||||
}
|
||||
this.paperDetailData = paperJson;
|
||||
this.paperDetailData = data;
|
||||
this.paperDetailData.forEach((item,index)=>{
|
||||
if(item.type ==3) {
|
||||
item.correctOptIdxs.push(item.answer);
|
||||
@@ -521,7 +524,6 @@ export default {
|
||||
total+=item.defaultScore;
|
||||
}
|
||||
}
|
||||
//console.log(item,"judge item");
|
||||
});
|
||||
}
|
||||
if(this.single.length > 0){
|
||||
@@ -531,7 +533,6 @@ export default {
|
||||
total+=item.defaultScore;
|
||||
}
|
||||
})
|
||||
//console.log(item,"single item");
|
||||
});
|
||||
}
|
||||
if(this.multiple.length > 0){
|
||||
@@ -552,7 +553,6 @@ export default {
|
||||
}
|
||||
let str1=item.userAnswer.join();
|
||||
let str2=tempAnswer.join();
|
||||
//console.log(str1,str2,'aaa');
|
||||
if(str1==str2){
|
||||
total+=item.defaultScore;
|
||||
}
|
||||
@@ -570,11 +570,9 @@ export default {
|
||||
//设置已答题内容
|
||||
this.paperQuestion.forEach((qitem,index) => {
|
||||
let avalue=answerJson[qitem.id];
|
||||
//console.log(avalue,'avalue')
|
||||
if(avalue){
|
||||
if(qitem.type==1){ //单选
|
||||
qitem.userAnswer=avalue;
|
||||
//console.log(qitem,avalue,'单选qitem')
|
||||
}else if(qitem.type==2){ //多选
|
||||
qitem.userAnswer=avalue.split(',');
|
||||
}else if(qitem.type==3){ //判断
|
||||
@@ -582,7 +580,6 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
//console.log(this.paperQuestion,'this.paperQuestion')
|
||||
this.arrangeQuestion();
|
||||
this.splitQuestionType();
|
||||
//进入考试阶段
|
||||
@@ -684,7 +681,6 @@ export default {
|
||||
if(this.updateAnswerTimeer!=null){
|
||||
window.clearInterval(this.updateAnswerTimeer)
|
||||
}
|
||||
//console.log("启动自动保存");
|
||||
let that = this;
|
||||
this.updateAnswerTimeer =window.setInterval(function(){
|
||||
that.updateAnswer();
|
||||
@@ -704,7 +700,6 @@ export default {
|
||||
judgeUserAnswer = item.userAnswer + "";
|
||||
}
|
||||
answer[item.id] = judgeUserAnswer;
|
||||
// console.log(answer[item.id],'1111')
|
||||
});
|
||||
}
|
||||
if(this.single.length > 0){
|
||||
@@ -729,7 +724,6 @@ export default {
|
||||
},
|
||||
//自动保存提交答案
|
||||
updateAnswer:function(){
|
||||
//console.log("自动保存答案");
|
||||
if(!this.aloneExamAnswerId){
|
||||
this.saveUserTest();
|
||||
return;
|
||||
@@ -750,7 +744,6 @@ export default {
|
||||
// 人工提交
|
||||
manualSubmit(){
|
||||
// let tempScore=this.countScore();
|
||||
// console.log(tempScore,"最后得分");
|
||||
let that = this;
|
||||
this.$confirm('您确定要提交试卷吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
||||
Reference in New Issue
Block a user