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

fix: 修改倒计时

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