理论考试缓存调整

This commit is contained in:
fan 2020-05-29 11:18:44 +08:00
parent f21751fcd3
commit 2abe815c87

View File

@ -52,7 +52,6 @@ export default {
passScore: 10 passScore: 10
}, },
examQuestions: [], examQuestions: [],
theoryAnswers: [],
theoryAnswersMap: {}, theoryAnswersMap: {},
countdownTime: '00:00:00', countdownTime: '00:00:00',
theoryExamTime: 0, theoryExamTime: 0,
@ -113,6 +112,7 @@ export default {
if (resp.data) { if (resp.data) {
this.examQuestions = resp.data.questions.map((el, i) => { this.examQuestions = resp.data.questions.map((el, i) => {
el.index = i; el.index = i;
el.answer = this.theoryAnswersMap[el.id];
return el; return el;
}); });
this.theoryExamTime = resp.data.theoryExamTime * 60; this.theoryExamTime = resp.data.theoryExamTime * 60;
@ -175,9 +175,13 @@ export default {
} }
}, },
doEnd() { doEnd() {
const theoryAnswers = [];
for (const key in this.theoryAnswersMap) {
theoryAnswers.push({questionId: key, answerOptionId: this.theoryAnswersMap[key]});
}
const params = { const params = {
competitionId: this.$route.query.raceId, competitionId: this.$route.query.raceId,
theoryAnswers: this.theoryAnswers theoryAnswers: theoryAnswers
}; };
postCompetitionTheory(params).then(()=>{ postCompetitionTheory(params).then(()=>{
this.$router.push({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } }); this.$router.push({ path: `/jsxt/result`, query: { type: 'theory', raceId:this.$route.query.raceId } });