diff --git a/src/views/newMap/displayNew/dispatherContest/theoryExam.vue b/src/views/newMap/displayNew/dispatherContest/theoryExam.vue index a3c7366ed..ea5626bc5 100644 --- a/src/views/newMap/displayNew/dispatherContest/theoryExam.vue +++ b/src/views/newMap/displayNew/dispatherContest/theoryExam.vue @@ -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 {