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

修改bug

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