|
@@ -5,9 +5,13 @@
|
|
|
<div v-for="(struct, index1) in paperStruct" :key="index1" class="section">
|
|
|
<div class="title">{{struct.title}} ({{struct.totalScore}}分)</div>
|
|
|
<div class="list">
|
|
|
- <div v-for="(_, index2) in new Array(struct.questionCount)" :key="index2" :class="itemClass(index1, index2)">
|
|
|
- <router-link :to="{ path: '/online-exam/exam/' + $route.params.examId, query: { 'examRecordId': $route.query.examRecordId, 'examQuestionId': getQuestionNum(index1, index2) }}">{{index2+1}}</router-link>
|
|
|
- </div>
|
|
|
+ <template v-for="(_, index2) in new Array(struct.questionCount)">
|
|
|
+ <template v-if="isSelectedQuestion(index1, index2)">
|
|
|
+ <div :key="index2" :class="itemClass(index1, index2)">
|
|
|
+ <router-link :to="{ path: '/online-exam/exam/' + $route.params.examId, query: { 'examRecordId': $route.query.examRecordId, 'examQuestionId': getQuestionNum(index1, index2).id }}">{{index2+1}}</router-link>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -17,6 +21,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { createNamespacedHelpers } from "vuex";
|
|
|
+const { mapState, mapMutations } = createNamespacedHelpers("examHomeModule");
|
|
|
+
|
|
|
export default {
|
|
|
name: "QuestionNavView",
|
|
|
data() {
|
|
@@ -40,18 +47,36 @@ export default {
|
|
|
total += this.paperStruct[i].questionCount;
|
|
|
}
|
|
|
// console.log(section, index, total + index);
|
|
|
- return this.validQuestions[total + index].id;
|
|
|
+ return this.validQuestions[total + index];
|
|
|
+ },
|
|
|
+ isSelectedQuestion(index1, index2) {
|
|
|
+ let q = this.getQuestionNum(index1, index2);
|
|
|
+
|
|
|
+ if (this.questionFilterType === "ALL") return true;
|
|
|
+ else if (this.questionFilterType === "ANSWERED" && q.stuAnswer) {
|
|
|
+ return true;
|
|
|
+ } else if (this.questionFilterType === "SIGNED" && q.isSign) {
|
|
|
+ return true;
|
|
|
+ } else if (this.questionFilterType === "UNANSWERED" && !q.stuAnswer) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
},
|
|
|
itemClass(index1, index2) {
|
|
|
+ const isCurrentQuestion =
|
|
|
+ this.$route.query.examQuestionId ==
|
|
|
+ this.getQuestionNum(index1, index2).id; // 故意用的 ==
|
|
|
return {
|
|
|
item: true,
|
|
|
- "current-question":
|
|
|
- this.$route.query.examQuestionId ==
|
|
|
- this.getQuestionNum(index1, index2) // 故意用的 ==
|
|
|
+ "current-question": isCurrentQuestion,
|
|
|
+ "star-question": this.getQuestionNum(index1, index2).isSign,
|
|
|
+ "is-answered": this.getQuestionNum(index1, index2).stuAnswer != null
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
- computed: {}
|
|
|
+ computed: {
|
|
|
+ ...mapState(["questionFilterType"])
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -82,7 +107,22 @@ export default {
|
|
|
margin-right: 5px;
|
|
|
margin-bottom: 5px;
|
|
|
}
|
|
|
+.is-answered {
|
|
|
+ background-color: #13bb8a;
|
|
|
+}
|
|
|
+.is-answered > a {
|
|
|
+ color: white;
|
|
|
+}
|
|
|
.current-question {
|
|
|
background-color: white;
|
|
|
}
|
|
|
+.current-question > a {
|
|
|
+ color: black;
|
|
|
+}
|
|
|
+.star-question {
|
|
|
+ background-color: #ffcc00;
|
|
|
+}
|
|
|
+.star-question > a {
|
|
|
+ color: white;
|
|
|
+}
|
|
|
</style>
|