提交 645c19b7 authored 作者: lihuihui's avatar lihuihui

fix: 修改考试

上级 846af9ca
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-button icon="el-icon-arrow-left" circle @click="$router.back()"></el-button> <el-button icon="el-icon-arrow-left" circle @click="$router.back()"></el-button>
<div class="title">{{ title }}</div> <div class="title">{{ title }}</div>
<div class="right"> <div class="right">
<div class="count">{{ examTimeText }}</div> <div class="count" v-if="hasCountDown">{{ examTimeText }}</div>
</div> </div>
</div> </div>
<div class="exam-main"> <div class="exam-main">
...@@ -52,6 +52,7 @@ export default { ...@@ -52,6 +52,7 @@ export default {
hasMark: { type: Boolean, default: true }, hasMark: { type: Boolean, default: true },
hasCollect: { type: Boolean, default: true }, hasCollect: { type: Boolean, default: true },
hasSubmitBtn: { type: Boolean, default: true }, hasSubmitBtn: { type: Boolean, default: true },
hasCountDown: { type: Boolean, default: true },
data: { type: Object, default: () => {} } data: { type: Object, default: () => {} }
}, },
data() { data() {
...@@ -87,15 +88,10 @@ export default { ...@@ -87,15 +88,10 @@ export default {
beforeDestroy() { beforeDestroy() {
clearInterval(this.countDownTime) // 停止倒计时 clearInterval(this.countDownTime) // 停止倒计时
}, },
mounted() {
// 答题倒计时
this.countDown(this.data.remaining_times)
this.duration = this.data.duration || 0
console.log(this.questionList)
},
methods: { methods: {
// 倒计时 // 倒计时
countDown(time) { countDown(time) {
console.log(time, 'time')
let sec = parseInt(time) let sec = parseInt(time)
clearInterval(this.countDownTime) clearInterval(this.countDownTime)
this.countDownTime = setInterval(() => { this.countDownTime = setInterval(() => {
...@@ -183,6 +179,11 @@ export default { ...@@ -183,6 +179,11 @@ export default {
}) })
return result return result
}, []) }, [])
// 答题倒计时
if (this.hasCountDown) {
this.countDown(this.data.remaining_times)
this.duration = this.data.duration || 0
}
} }
} }
} }
......
<template> <template>
<exam-card @submitExam="submitExam" ref="exam" title="模拟考试" :data="data" v-if="Object.keys(data).length"></exam-card> <div>
<exam-card :hasSubmitBtn="!!(!$route.query.id)" :hasCountDown="!!(!$route.query.id)" v-if="Object.keys(data).length > 1" @submitExam="submitExam" ref="exam" title="模拟考试" :data="data"></exam-card>
</div>
</template> </template>
<script> <script>
import * as api from '@/api/exam.js' import * as api from '@/api/exam.js'
...@@ -20,9 +22,11 @@ export default { ...@@ -20,9 +22,11 @@ export default {
}, },
created() { created() {
// 缓存答题 // 缓存答题
this.cacheAnswerTime = setInterval(() => { if (this.$route.query.exam_id) {
this.submitExam(0) this.cacheAnswerTime = setInterval(() => {
}, 3000) this.submitExam(0)
}, 3000)
}
// 获取考卷 // 获取考卷
this.getTopic() this.getTopic()
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论