|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <div v-if="exam" class="container">
|
|
|
|
|
|
+ <div v-if="exam && examQuestion" class="container">
|
|
<div class="header">
|
|
<div class="header">
|
|
<RemainTime></RemainTime>
|
|
<RemainTime></RemainTime>
|
|
<OverallProgress :exam-question-list="validQuestions"></OverallProgress>
|
|
<OverallProgress :exam-question-list="validQuestions"></OverallProgress>
|
|
@@ -30,17 +30,12 @@ import ArrowNavView from "./ArrowNavView.vue";
|
|
import QuestionNavView from "./QuestionNavView.vue";
|
|
import QuestionNavView from "./QuestionNavView.vue";
|
|
import FaceRecognition from "../../../components/FaceRecognition/FaceRecognition";
|
|
import FaceRecognition from "../../../components/FaceRecognition/FaceRecognition";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
-const { mapState, mapMutations } = createNamespacedHelpers("examingHomeModule");
|
|
|
|
|
|
+const { mapState, mapMutations, mapGetters } = createNamespacedHelpers(
|
|
|
|
+ "examingHomeModule"
|
|
|
|
+);
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "ExamingHome",
|
|
name: "ExamingHome",
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- preExamQuestion: null,
|
|
|
|
- nextExamQuestion: null,
|
|
|
|
- examQuestion: null
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
async created() {
|
|
async created() {
|
|
await this.initData();
|
|
await this.initData();
|
|
if (!this.$route.query.examQuestionId) {
|
|
if (!this.$route.query.examQuestionId) {
|
|
@@ -49,11 +44,10 @@ export default {
|
|
);
|
|
);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.updateQuestion();
|
|
|
|
- },
|
|
|
|
- beforeRouteUpdate(to, from, next) {
|
|
|
|
- this.updateQuestion(next);
|
|
|
|
},
|
|
},
|
|
|
|
+ // beforeRouteUpdate(to, from, next) {
|
|
|
|
+ // this.updateQuestion(next);
|
|
|
|
+ // },
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(["updateExamState"]),
|
|
...mapMutations(["updateExamState"]),
|
|
async initData() {
|
|
async initData() {
|
|
@@ -69,15 +63,11 @@ export default {
|
|
const examQuestionList = await this.$http.get(
|
|
const examQuestionList = await this.$http.get(
|
|
"/api/exam_question/?exam_record_id=" + this.$route.query.examRecordId
|
|
"/api/exam_question/?exam_record_id=" + this.$route.query.examRecordId
|
|
);
|
|
);
|
|
- const validQuestions = examQuestionList.data.filter(
|
|
|
|
- q => q.nestedQuestion === false
|
|
|
|
- );
|
|
|
|
|
|
|
|
this.updateExamState({
|
|
this.updateExamState({
|
|
exam: exam.data,
|
|
exam: exam.data,
|
|
paperStruct: paperStruct.data,
|
|
paperStruct: paperStruct.data,
|
|
- examQuestionList: examQuestionList.data,
|
|
|
|
- validQuestions
|
|
|
|
|
|
+ examQuestionList: examQuestionList.data
|
|
});
|
|
});
|
|
},
|
|
},
|
|
updateQuestion: async function(next) {
|
|
updateQuestion: async function(next) {
|
|
@@ -93,11 +83,11 @@ export default {
|
|
|
|
|
|
next && next();
|
|
next && next();
|
|
if (!this.exam) return;
|
|
if (!this.exam) return;
|
|
- this.examQuestion = this.examQuestionList.find(
|
|
|
|
- eq => eq.id == this.$route.query.examQuestionId // number == string
|
|
|
|
- );
|
|
|
|
- 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
|
|
|
|
+ // );
|
|
|
|
+ // this.preExamQuestion = this.validQuestions[this.examQuestion.orders - 2];
|
|
|
|
+ // this.nextExamQuestion = this.validQuestions[this.examQuestion.orders];
|
|
},
|
|
},
|
|
async submitPaper() {
|
|
async submitPaper() {
|
|
//FIXME: submit precondition
|
|
//FIXME: submit precondition
|
|
@@ -106,7 +96,17 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState(["exam", "paperStruct", "examQuestionList", "validQuestions"])
|
|
|
|
|
|
+ ...mapState(["exam", "paperStruct", "examQuestionList"]),
|
|
|
|
+ ...mapGetters(["validQuestions"]),
|
|
|
|
+ examQuestion: vm =>
|
|
|
|
+ vm.examQuestionList &&
|
|
|
|
+ vm.examQuestionList.find(
|
|
|
|
+ eq => eq.id == vm.$route.query.examQuestionId // number == string
|
|
|
|
+ ),
|
|
|
|
+ preExamQuestion: vm =>
|
|
|
|
+ vm.examQuestion && vm.validQuestions[vm.examQuestion.orders - 2],
|
|
|
|
+ nextExamQuestion: vm =>
|
|
|
|
+ vm.examQuestion && vm.validQuestions[vm.examQuestion.orders]
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
RemainTime,
|
|
RemainTime,
|