|
@@ -1,17 +1,20 @@
|
|
<template>
|
|
<template>
|
|
- <div>
|
|
|
|
|
|
+ <div class="arrow-container">
|
|
<div class="prev">
|
|
<div class="prev">
|
|
<template v-if="previousExamQuestion">
|
|
<template v-if="previousExamQuestion">
|
|
- <router-link :to="{ path: '/online-exam/exam/' + this.$route.params.examId, query: { 'examRecordId': this.$route.query.examRecordId, 'examQuestionId': previousExamQuestion.id }}">上一题</router-link>
|
|
|
|
|
|
+ <router-link class="qm-primary-button" :to="{ path: '/online-exam/exam/' + this.$route.params.examId, query: { 'examRecordId': this.$route.query.examRecordId, 'examQuestionId': previousExamQuestion.id }}">上一题</router-link>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
<template v-else>
|
|
<div>上一题</div>
|
|
<div>上一题</div>
|
|
</template>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="tips">
|
|
|
|
+ 方向键 → 下一题。方向键 ← 上一题。<br>A、B、C、D来勾选选项。Y、N来勾选判断题。
|
|
|
|
+ </div>
|
|
<div class="next">
|
|
<div class="next">
|
|
<template v-if="nextExamQuestion">
|
|
<template v-if="nextExamQuestion">
|
|
- <router-link :to="{ path: '/online-exam/exam/' + this.$route.params.examId, query: { 'examRecordId': this.$route.query.examRecordId, 'examQuestionId': nextExamQuestion.id }}">下一题</router-link>
|
|
|
|
|
|
+ <router-link class="qm-primary-button" :to="{ path: '/online-exam/exam/' + this.$route.params.examId, query: { 'examRecordId': this.$route.query.examRecordId, 'examQuestionId': nextExamQuestion.id }}">下一题</router-link>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
<template v-else>
|
|
@@ -31,6 +34,49 @@ export default {
|
|
props: {
|
|
props: {
|
|
previousExamQuestion: Object,
|
|
previousExamQuestion: Object,
|
|
nextExamQuestion: Object
|
|
nextExamQuestion: Object
|
|
|
|
+ },
|
|
|
|
+ created: function() {
|
|
|
|
+ window.addEventListener("keyup", this.keyup);
|
|
|
|
+ },
|
|
|
|
+ destroyed() {
|
|
|
|
+ window.removeEventListener("keyup", this.keyup);
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ keyup(e) {
|
|
|
|
+ // console.log(e);
|
|
|
|
+ if (e.code === "ArrowRight" && this.nextExamQuestion) {
|
|
|
|
+ this.goToNextQuestion();
|
|
|
|
+ }
|
|
|
|
+ if (e.code === "ArrowLeft" && this.previousExamQuestion) {
|
|
|
|
+ this.goToPreviousQuestion();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ goToNextQuestion() {
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: "/online-exam/exam/" + this.$route.params.examId,
|
|
|
|
+ query: {
|
|
|
|
+ examRecordId: this.$route.query.examRecordId,
|
|
|
|
+ examQuestionId: this.nextExamQuestion.id
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ goToPreviousQuestion() {
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: "/online-exam/exam/" + this.$route.params.examId,
|
|
|
|
+ query: {
|
|
|
|
+ examRecordId: this.$route.query.examRecordId,
|
|
|
|
+ examQuestionId: this.previousExamQuestion.id
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.arrow-container {
|
|
|
|
+ display: grid;
|
|
|
|
+ grid-template-columns: 120px 1fr 120px;
|
|
|
|
+ place-items: center;
|
|
|
|
+}
|
|
|
|
+</style>
|