|
@@ -2,12 +2,13 @@
|
|
|
<div class="container">
|
|
|
<div class="header">
|
|
|
<RemainTime></RemainTime>
|
|
|
- <OverallProgress :exam-question-list="examQuestionList"></OverallProgress>
|
|
|
- <QuestionFilters :exam-question-list="examQuestionList"></QuestionFilters>
|
|
|
+ <OverallProgress :exam-question-list="validQuestions"></OverallProgress>
|
|
|
+ <QuestionFilters :exam-question-list="validQuestions"></QuestionFilters>
|
|
|
<Button class="qm-primary-button">交卷</Button>
|
|
|
</div>
|
|
|
<div class="main">
|
|
|
<QuestionView :exam-question="examQuestion"></QuestionView>
|
|
|
+ <ArrowNavView :previous-exam-question="preExamQuestion" :next-exam-question="nextExamQuestion"></ArrowNavView>
|
|
|
</div>
|
|
|
<div class="side">
|
|
|
<div class="question-nav">
|
|
@@ -25,60 +26,82 @@ import RemainTime from "./RemainTime.vue";
|
|
|
import OverallProgress from "./OverallProgress.vue";
|
|
|
import QuestionFilters from "./QuestionFilters.vue";
|
|
|
import QuestionView from "./QuestionView.vue";
|
|
|
+import ArrowNavView from "./ArrowNavView.vue";
|
|
|
|
|
|
export default {
|
|
|
+ name: "ExamingHome",
|
|
|
data() {
|
|
|
return {
|
|
|
exam: null,
|
|
|
paperStruct: null,
|
|
|
+ validQuestions: [],
|
|
|
examQuestionList: [],
|
|
|
+ preExamQuestion: null,
|
|
|
+ nextExamQuestion: null,
|
|
|
examQuestion: null
|
|
|
};
|
|
|
},
|
|
|
async mounted() {
|
|
|
- const exam = await this.$http.get(
|
|
|
- "/api/ecs_exam_work/exam/" + this.$route.params.examId
|
|
|
- );
|
|
|
- this.exam = exam.data;
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ beforeRouteUpdate(to, from, next) {
|
|
|
+ this.init();
|
|
|
+ next();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init: async function() {
|
|
|
+ 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;
|
|
|
+ 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/mock/exam_question/?exam_record_id=" +
|
|
|
- this.$route.query.examRecordId
|
|
|
- );
|
|
|
- this.examQuestionList = examQuestionList.data;
|
|
|
+ // FIXME: global API processing. mock or not
|
|
|
+ const examQuestionList = await this.$http.get(
|
|
|
+ "/api/mock/exam_question/?exam_record_id=" +
|
|
|
+ this.$route.query.examRecordId
|
|
|
+ );
|
|
|
+ this.examQuestionList = examQuestionList.data;
|
|
|
+ this.validQuestions = this.examQuestionList.filter(
|
|
|
+ q => q.nestedQuestion === false
|
|
|
+ );
|
|
|
|
|
|
- // 初始化套题的答案,为回填部分选项做准备
|
|
|
- // for (let q of this.examQuestionList) {
|
|
|
- // if (q.subQuestionList.length > 0) {
|
|
|
- // q.stuAnswer = [];
|
|
|
- // for (let sq of q.subQuestionList) {
|
|
|
- // q.stuAnswer.push(sq.stuAnswer);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
+ // 初始化套题的答案,为回填部分选项做准备
|
|
|
+ // for (let q of this.examQuestionList) {
|
|
|
+ // if (q.subQuestionList.length > 0) {
|
|
|
+ // q.stuAnswer = [];
|
|
|
+ // for (let sq of q.subQuestionList) {
|
|
|
+ // q.stuAnswer.push(sq.stuAnswer);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- if (!this.$route.query.examQuestionId) {
|
|
|
- this.$router.push(
|
|
|
- this.$route.fullPath + "&examQuestionId=" + this.examQuestionList[0].id
|
|
|
+ if (!this.$route.query.examQuestionId) {
|
|
|
+ this.$router.push(
|
|
|
+ this.$route.fullPath +
|
|
|
+ "&examQuestionId=" +
|
|
|
+ this.examQuestionList[0].id
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.examQuestion = this.examQuestionList.find(
|
|
|
+ eq => eq.id == this.$route.query.examQuestionId // number == string
|
|
|
);
|
|
|
- return;
|
|
|
+ this.preExamQuestion = this.validQuestions[this.examQuestion.orders - 2];
|
|
|
+ this.nextExamQuestion = this.validQuestions[this.examQuestion.orders];
|
|
|
}
|
|
|
- this.examQuestion = this.examQuestionList.find(
|
|
|
- eq => eq.id == this.$route.query.examQuestionId // number == string
|
|
|
- );
|
|
|
},
|
|
|
components: {
|
|
|
RemainTime,
|
|
|
OverallProgress,
|
|
|
QuestionFilters,
|
|
|
- QuestionView
|
|
|
+ QuestionView,
|
|
|
+ ArrowNavView
|
|
|
}
|
|
|
};
|
|
|
</script>
|