国赛理论测试显示结果调整

This commit is contained in:
fan 2021-02-02 17:03:39 +08:00
parent e7b47de9f6
commit c7e0bdc1e7

View File

@ -295,33 +295,39 @@ export default {
this.loading = false;
this.isResult = true;
this.$message.success('提交成功');
const writeList = res.data.filter(wrong=>{
return wrong.answerContents && wrong.answerContents.length > 0;
});
this.theoryExamWrongList = writeList.filter(wrong=>{
return wrong.correct == false;
});
if (writeList.length > 0) {
if (writeList.length >= 2) {
this.resultScore = writeList.reduce((prev, cur, index, arr)=>{
return prev.score == undefined ? prev + cur.score : prev.score + cur.score;
});
} else {
this.resultScore = writeList[0].score;
res.data.forEach(item => {
this.resultScore += (item.score || 0);
if (item.answerOptionId && item.answerOptionId.length && !item.score) {
this.theoryExamWrongList.push(item);
}
} else {
this.resultScore = 0;
}
if (this.theoryExamWrongList.length > 0) {
this.getWrongDataOption();
}
});
// const writeList = res.data.filter(wrong=>{
// return wrong.answerContents && wrong.answerContents.length > 0;
// });
// this.theoryExamWrongList = writeList.filter(wrong=>{
// return wrong.correct == false;
// });
// if (writeList.length > 0) {
// if (writeList.length >= 2) {
// this.resultScore = writeList.reduce((prev, cur, index, arr)=>{
// return prev.score == undefined ? prev + cur.score : prev.score + cur.score;
// });
// } else {
// this.resultScore = writeList[0].score;
// }
// } else {
// this.resultScore = 0;
// }
// if (this.theoryExamWrongList.length > 0) {
// this.getWrongDataOption();
// }
}).catch(()=>{
this.$message.error('提交失败,请稍后再试');
});
},
getWrongDataOption() {
const wrongList = this.theoryExamWrongList[this.wrongQuestionNum].answerContents;
const wrongList = this.theoryExamWrongList[this.wrongQuestionNum].answerOptionId;
if (wrongList.length > 1) {
this.currentSelectAnswer = wrongList;
} else {