|
@@ -4,7 +4,7 @@
|
|
<RemainTime></RemainTime>
|
|
<RemainTime></RemainTime>
|
|
<OverallProgress :exam-question-list="validQuestions"></OverallProgress>
|
|
<OverallProgress :exam-question-list="validQuestions"></OverallProgress>
|
|
<QuestionFilters :exam-question-list="validQuestions"></QuestionFilters>
|
|
<QuestionFilters :exam-question-list="validQuestions"></QuestionFilters>
|
|
- <Button class="qm-primary-button">交卷</Button>
|
|
|
|
|
|
+ <Button class="qm-primary-button" @click="submitPaper">交卷</Button>
|
|
</div>
|
|
</div>
|
|
<div class="main">
|
|
<div class="main">
|
|
<QuestionView :exam-question="examQuestion"></QuestionView>
|
|
<QuestionView :exam-question="examQuestion"></QuestionView>
|
|
@@ -43,6 +43,31 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
|
|
+ if (!this.$route.query.examQuestionId) {
|
|
|
|
+ const exam = await this.$http.get(
|
|
|
|
+ "/api/ecs_exam_work/exam/" + this.$route.params.examId
|
|
|
|
+ );
|
|
|
|
+ this.exam = exam.data;
|
|
|
|
+
|
|
|
|
+ const paperStruct = await this.$http.get(
|
|
|
|
+ "/api/exam_question/paper_struct/?exam_record_id=" +
|
|
|
|
+ this.$route.query.examRecordId
|
|
|
|
+ );
|
|
|
|
+ this.paperStruct = paperStruct.data;
|
|
|
|
+
|
|
|
|
+ // FIXME: global API processing. mock or not
|
|
|
|
+ const examQuestionList = await this.$http.get(
|
|
|
|
+ "/api/exam_question/?exam_record_id=" + this.$route.query.examRecordId
|
|
|
|
+ );
|
|
|
|
+ this.examQuestionList = examQuestionList.data;
|
|
|
|
+ this.validQuestions = this.examQuestionList.filter(
|
|
|
|
+ q => q.nestedQuestion === false
|
|
|
|
+ );
|
|
|
|
+ this.$router.push(
|
|
|
|
+ this.$route.fullPath + "&examQuestionId=" + this.examQuestionList[0].id
|
|
|
|
+ );
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
this.init();
|
|
this.init();
|
|
},
|
|
},
|
|
beforeRouteUpdate(to, from, next) {
|
|
beforeRouteUpdate(to, from, next) {
|
|
@@ -63,8 +88,7 @@ export default {
|
|
|
|
|
|
// FIXME: global API processing. mock or not
|
|
// FIXME: global API processing. mock or not
|
|
const examQuestionList = await this.$http.get(
|
|
const examQuestionList = await this.$http.get(
|
|
- "/api/mock/exam_question/?exam_record_id=" +
|
|
|
|
- this.$route.query.examRecordId
|
|
|
|
|
|
+ "/api/exam_question/?exam_record_id=" + this.$route.query.examRecordId
|
|
);
|
|
);
|
|
this.examQuestionList = examQuestionList.data;
|
|
this.examQuestionList = examQuestionList.data;
|
|
this.validQuestions = this.examQuestionList.filter(
|
|
this.validQuestions = this.examQuestionList.filter(
|
|
@@ -81,20 +105,16 @@ export default {
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
|
|
- if (!this.$route.query.examQuestionId) {
|
|
|
|
- this.$router.push(
|
|
|
|
- this.$route.fullPath +
|
|
|
|
- "&examQuestionId=" +
|
|
|
|
- this.examQuestionList[0].id
|
|
|
|
- );
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
next && next();
|
|
next && next();
|
|
this.examQuestion = this.examQuestionList.find(
|
|
this.examQuestion = this.examQuestionList.find(
|
|
eq => eq.id == this.$route.query.examQuestionId // number == string
|
|
eq => eq.id == this.$route.query.examQuestionId // number == string
|
|
);
|
|
);
|
|
this.preExamQuestion = this.validQuestions[this.examQuestion.orders - 2];
|
|
this.preExamQuestion = this.validQuestions[this.examQuestion.orders - 2];
|
|
this.nextExamQuestion = this.validQuestions[this.examQuestion.orders];
|
|
this.nextExamQuestion = this.validQuestions[this.examQuestion.orders];
|
|
|
|
+ },
|
|
|
|
+ async submitPaper() {
|
|
|
|
+ const res = await this.$http.get("/api/exam_control/submit");
|
|
|
|
+ this.$router.push("/");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|