提交 0a8638a3 authored 作者: lihuihui's avatar lihuihui

修改bug

上级 3ca69622
......@@ -68,6 +68,7 @@ export default {
},
data() {
return {
isExamEnd: false,
isExamTimeDate: true,
itemSign: false,
examTime: '00:00:00 倒计时',
......@@ -93,9 +94,15 @@ export default {
mounted() {
this.setTick()
this.getTopic()
this.contentHeight = parseInt(document.body.clientHeight - (this.getDom('head-h').offsetHeight + this.getDom('foot-h').offsetHeight))
this.countHeight()
window.onresize = () => {
this.countHeight()
}
},
methods: {
countHeight() {
this.contentHeight = parseInt(document.body.clientHeight - (this.getDom('head-h').offsetHeight + this.getDom('foot-h').offsetHeight))
},
// 标记
signHandle() {
this.$refs.signHandle.onSignHandle()
......@@ -110,13 +117,25 @@ export default {
this.$alert('考试时间到', {
confirmButtonText: '确定',
callback: action => {
this.endExamRequest()
this.$router.replace({
path: '/examEnd'
})
}
})
if (!this.isExamEnd) {
this.endExamRequest(1)
}
} else {
const count = parseInt(this.questionParams.question.total_question_count) - parseInt(this.countAnswer())
if (count === 0) {
this.$confirm('确定后要结束本次考试?还有作答时间,结束考试后,将不能返回本次考试!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '关闭',
type: 'warning'
}).then(() => {
this.endExamRequest()
}).catch(() => {
})
} else {
this.$confirm(`确定要结束本次考试?还有${count}题未答,结束考试后,将不能返回本次考试`, '提示', {
confirmButtonText: '确定',
......@@ -142,19 +161,22 @@ export default {
}
return countNum
},
endExamRequest() {
endExamRequest(n) {
const param = {
answer: JSON.stringify(this.questionParams.answerRecord)
}
action.Exam.endExam(this.$route.params.examId, param).then(res => {
clearInterval(this.clearTime)
if (!n) {
this.$router.replace({
path: '/examEnd'
})
}
window.localStorage.setItem('showflag', 'true')
}).catch(err => {
if (err.message.indexOf('error') !== -1) {
this.$confirm('网络异常,请保持网络通畅', '提示', {
distinguishCancelAndClose: true,
confirmButtonText: '退出考试',
cancelButtonText: '重新提交',
type: 'warning'
......@@ -162,8 +184,8 @@ export default {
this.$router.replace({
path: `/login/${JSON.parse(window.localStorage.getItem('examInfo')).exam_id}`
})
}).catch(() => {
this.endExamRequest()
}).catch(action => {
action === 'cancel' && (this.endExamRequest())
})
} else {
this.$alert(err.message, {
......@@ -215,9 +237,21 @@ export default {
this.questionParams.question = res
this.getCache()
}).catch(err => {
this.$alert(err.message, {
callback: action => {}
})
this.isExamEnd = true
console.log(err)
// if (err.message === '考试已结束') {
// this.$alert(err.message, {
// callback: action => {
// this.$router.replace({
// path: '/examEnd'
// })
// }
// })
// } else {
// this.$alert(err.message, {
// callback: action => {}
// })
// }
})
},
getCache() {
......@@ -228,9 +262,10 @@ export default {
this.getSignStu()
}
}).catch(err => {
this.$alert(err.message, {
callback: action => {}
})
console.log(err)
// this.$alert(err.message, {
// callback: action => {}
// })
})
},
getSignStu() {
......
<template>
<div class="end-box">
<div class="title">{{ examInfo.name }}</div>
<div class="text">感谢您完成</div>
<div class="text">感谢您完成</div>
<img src="../../assets/images/end-bg.png" alt="">
<div class="pop-progress" v-if="ispop">
<div class="pop-con">
......@@ -29,13 +29,11 @@ export default {
methods: {
getsess() {
this.ispop = Boolean(window.localStorage.getItem('showflag'))
console.log(111 + this.ispop)
}
},
mounted() {
setTimeout(() => {
this.width = '100%'
// this.ispop = 'true'
}, 1000)
setTimeout(() => {
// this.ispop = false
......@@ -44,7 +42,7 @@ export default {
this.$router.replace({
path: '/'
})
}, 2000)
}, 5000)
}, 4000)
}
}
......
......@@ -48,13 +48,11 @@ export default {
num3: '0',
num4: '0'
}
// this.$router.push({
// path: `/examAnswer/${JSON.parse(window.localStorage.getItem('examInfo')).exam_id}`,
// replace: true
// })
setTimeout(() => {
this.$router.replace({
path: `/examAnswer/${JSON.parse(window.localStorage.getItem('examInfo')).exam_id}`
})
}, 2000)
}
const td = `${this.addZero(parseInt(lefttime / 60 % 60))}${this.addZero(parseInt(lefttime % 60))}`
const arr = td.split('')
......
......@@ -48,8 +48,8 @@
<div class="head">{{ examInfo.name }}</div>
<div class="exp-text">
<div class="t">
<div class="fl">为保证本考试的公平性和严肃性,本次考试将会:</div>
<div class="fl" v-html="examInfo.config.promise_message">为保证本考试的公平性和严肃性,本次考试将会:</div>
<!-- <div class="fl">为保证本考试的公平性和严肃性,本次考试将会:</div> -->
<div class="fl" v-html="examInfo.config.promise_message"></div>
</div>
<!-- <p v-html="examInfo.config.promise_message"></p> -->
</div>
......@@ -110,7 +110,7 @@ export default {
computed: {
typeInput() {
return (k) => {
const type = k === 'age' || k === 'mobile' || k === 'id_number' ? 'number' : 'text'
const type = k === 'age' || k === 'mobile' ? 'number' : 'text'
return type
}
}
......@@ -191,6 +191,7 @@ export default {
action.Login.confirmInfo(this.examInfo.exam_id, this.form).then(res => {
if (!res.code) {
this.isTreaty = true
window.localStorage.setItem('studentInfo', JSON.stringify(res))
}
}).catch(err => {
this.$alert(err.message, {
......@@ -227,6 +228,21 @@ export default {
}
}
}
} else {
if (this.form[this.allForm[i].key] !== '') {
if (this.allForm[i].key === 'mobile') {
if (!(/^1[3456789]\d{9}$/.test(this.form.mobile))) {
this.$alert('手机号不正确')
return false
}
}
if (this.allForm[i].key === 'email') {
if (!(/^([a-zA-Z\d])(\w)+@[a-zA-Z\d]+\.[a-zA-Z]{2,4}$/.test(this.form.email))) {
this.$alert('邮箱不正确')
return false
}
}
}
}
}
return true
......
......@@ -147,9 +147,15 @@ export default {
}
status === 1 && (this.$alert('已提交考卷'))
}).catch(err => {
if (err.message.indexOf('error') !== -1) {
this.$alert('网络异常,请保持网络通畅', {
callback: action => {}
})
} else {
this.$alert(err.message, {
callback: action => {}
})
}
})
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论