提交 5c5754ea authored 作者: lihuihui's avatar lihuihui

fix: 修改倒计时

上级 d3dd8fc4
...@@ -93,7 +93,8 @@ export default { ...@@ -93,7 +93,8 @@ export default {
countdownText: '', // 倒计时显示时间 countdownText: '', // 倒计时显示时间
questionGroups: this.groups, // 所有试题分组,一组一页 questionGroups: this.groups, // 所有试题分组,一组一页
currentGroupPage: this.groupPage, // 大题页码 currentGroupPage: this.groupPage, // 大题页码
currentGroupCount: this.groupPageCount // 大题总页数 currentGroupCount: this.groupPageCount, // 大题总页数
isCountDownEnd: false
} }
}, },
computed: { computed: {
...@@ -161,13 +162,13 @@ export default { ...@@ -161,13 +162,13 @@ export default {
methods: { methods: {
// 倒计时 // 倒计时
countDown(time) { countDown(time) {
console.log(time, 'time') let sec = parseInt(10)
let sec = parseInt(time)
clearInterval(this.countdownTimer) clearInterval(this.countdownTimer)
this.countdownTimer = setInterval(() => { this.countdownTimer = setInterval(() => {
sec-- sec--
if (sec === 0) { if (sec === 0) {
clearInterval(this.time.clearTime) clearInterval(this.countdownTimer)
this.isCountDownEnd = true
this.$alert('考试时间结束,自动提交试卷', '', { this.$alert('考试时间结束,自动提交试卷', '', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { callback: action => {
......
...@@ -154,10 +154,10 @@ export default { ...@@ -154,10 +154,10 @@ export default {
} }
} }
.order-num { .order-num {
height: 420px; // height: 420px;
overflow-y: scroll; // overflow-y: scroll;
padding-left: 30px; padding-left: 30px;
scrollbar-width: none; // scrollbar-width: none;
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;
} }
......
...@@ -95,10 +95,14 @@ export default { ...@@ -95,10 +95,14 @@ export default {
return a.concat(b) return a.concat(b)
}, []) }, [])
list.question_list.forEach(item => { list.question_list.forEach(item => {
const currentItem = data.sheet.score_items[list.question_item_id][item.id]
if (currentItem.checked_flag) {
totalNum++
if (currentItem.is_right) rightNum++
} else {
if (item.question_options) { if (item.question_options) {
totalNum++ totalNum++
if (data.sheet.score_items[list.question_item_id][item.id].is_right) { if (currentItem.is_right) rightNum++
rightNum++
} }
} }
}) })
...@@ -119,6 +123,7 @@ export default { ...@@ -119,6 +123,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.result-box { .result-box {
width: 100%; width: 100%;
// height: 100%;
display: flex; display: flex;
.card-left { .card-left {
box-sizing: border-box; box-sizing: border-box;
...@@ -126,7 +131,7 @@ export default { ...@@ -126,7 +131,7 @@ export default {
flex: 1; flex: 1;
background: #fff; background: #fff;
margin-right: 10px; margin-right: 10px;
height: 560px; // height: 560px;
border-radius: 8px; border-radius: 8px;
.title { .title {
font-size: 18px; font-size: 18px;
...@@ -205,7 +210,7 @@ export default { ...@@ -205,7 +210,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
flex: 1; flex: 1;
background: #fff; background: #fff;
height: 560px; // height: 560px;
border-radius: 8px; border-radius: 8px;
margin-left: 10px; margin-left: 10px;
padding: 10px 30px 0; padding: 10px 30px 0;
......
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
}) })
}) })
if (isCache) { if (isCache) {
if (answerNum !== 0) { if (answerNum !== 0 && !this.$refs.exam.isCountDownEnd) {
this.$confirm(`您还有${answerNum}道题没有作答`, '请确认', { this.$confirm(`您还有${answerNum}道题没有作答`, '请确认', {
confirmButtonText: '确认提交', confirmButtonText: '确认提交',
cancelButtonText: '继续作答', cancelButtonText: '继续作答',
...@@ -104,7 +104,6 @@ export default { ...@@ -104,7 +104,6 @@ export default {
} else { } else {
this.submitApi(id, isCache, answer, refData.duration) this.submitApi(id, isCache, answer, refData.duration)
} }
console.log(answerNum, 'num')
}, },
submitApi(id, isCache, answer, duration) { submitApi(id, isCache, answer, duration) {
const param = { const param = {
......
...@@ -86,17 +86,19 @@ export default { ...@@ -86,17 +86,19 @@ export default {
const data = JSON.parse(response.data) const data = JSON.parse(response.data)
let rightNum = 0 let rightNum = 0
let totalNum = 0 let totalNum = 0
const arr = []
data.sheet.questions.question_items.forEach(list => { data.sheet.questions.question_items.forEach(list => {
list.question_list = list.question_list.reduce((a, b) => { list.question_list = list.question_list.reduce((a, b) => {
return a.concat(b) return a.concat(b)
}, []) }, [])
list.question_list.forEach(item => { list.question_list.forEach(item => {
const currentItem = data.sheet.score_items[list.question_item_id][item.id]
if (currentItem.checked_flag) {
totalNum++
if (currentItem.is_right) rightNum++
} else {
if (item.question_options) { if (item.question_options) {
arr.push(item)
totalNum++ totalNum++
if (data.sheet.score_items[list.question_item_id][item.id].is_right) { if (currentItem.is_right) rightNum++
rightNum++
} }
} }
}) })
...@@ -117,6 +119,7 @@ export default { ...@@ -117,6 +119,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.result-box { .result-box {
width: 100%; width: 100%;
// height: 100%;
display: flex; display: flex;
.card-left { .card-left {
box-sizing: border-box; box-sizing: border-box;
...@@ -124,7 +127,7 @@ export default { ...@@ -124,7 +127,7 @@ export default {
flex: 1; flex: 1;
background: #fff; background: #fff;
margin-right: 10px; margin-right: 10px;
height: 560px; // height: 560px;
border-radius: 8px; border-radius: 8px;
.title { .title {
font-size: 18px; font-size: 18px;
...@@ -203,7 +206,7 @@ export default { ...@@ -203,7 +206,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
flex: 1; flex: 1;
background: #fff; background: #fff;
height: 560px; // height: 560px;
border-radius: 8px; border-radius: 8px;
margin-left: 10px; margin-left: 10px;
padding: 10px 30px 0; padding: 10px 30px 0;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论