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

fix: 修改考试

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