@@ -62,7 +62,7 @@ export default {
content: '是否确认进入考试?',
examId: '',
examNum: 0, // 考试次数
- examCount: 1, // 1: 不限次 2: 及格终止 3: 自定义
+ examCount: '', // 1: 不限次 2: 及格终止 3: 自定义
examCustom: 0, // 自定义次数
score: 0,
passScore: 0
@@ -75,6 +75,10 @@ export default {
this.title = opt.name
this.subtitle = opt.validityDate
this.duration = opt.responseTime
+ this.examNum = opt.examNum
+ this.count = opt.examCount === 1 ? '不限次' : opt.examCount === 2 ? '及格终止' : opt.examCustom
+ this.examCount = opt.examCount
+ this.examCustom = opt.examCustom
this.switchCount = opt.cutNum.includes('null') || opt.cutNum.includes('undefined') ? '不限次' : opt.cutNum
this.studyId = opt.studyId
this.score = opt.score
diff --git a/pages/YNEduApp/exam/exam.vue b/pages/YNEduApp/exam/exam.vue
index 1e1a987..29496f6 100644
--- a/pages/YNEduApp/exam/exam.vue
+++ b/pages/YNEduApp/exam/exam.vue
@@ -85,6 +85,7 @@ export default {
// this.allList = this.list = res.data
// this.waitList = res.data.filter(item => item.status === 1)
// this.alreadyList = res.data.filter(item => item.status === 2)
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/personalCenter/getStudentExamList',
method: 'post',
@@ -95,11 +96,13 @@ export default {
},
success: res => {
console.log('🚀 ~ getList ~ res:', res)
+ this.activeIndex = 0
res = res.data
this.list = this.allList
this.allList = this.list = res.data
this.waitList = res.data.filter(item => item.status === 1)
this.alreadyList = res.data.filter(item => item.status === 2)
+ this.absentList = res.data.filter(item => item.status === 3 && item.examNum === 0)
},
fail: err => {
console.log(err)
@@ -121,6 +124,19 @@ export default {
// 开始考试
handleExamination(item) {
console.log('🚀 ~ handleExamination ~ item:', item)
+ // 获取当前考试限制时间 item.validityDate 2021-09-01~2021-09-30 如果今天不在这个范围内, 不能考试
+ const date = new Date()
+ const year = date.getFullYear()
+ const month = date.getMonth() + 1
+ const day = date.getDate()
+ const today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
+ if (today < item.validityDate.split('~')[0] || today > item.validityDate.split('~')[1]) {
+ uni.showToast({
+ title: '当前时间不在考试时间范围内',
+ icon: 'none'
+ })
+ return
+ }
if (item.examEquipment == 2) {
uni.showToast({
title: '请在电脑端进行考试',
@@ -151,7 +167,7 @@ export default {
examNum: item.examNum, // 考试次数
examCount: item.examCount, // 考试次数类型
examCustom: item.examCustom, // 自定义考试次数
- score: item.score, // 总分
+ score: item.score, // 总
passScore: item.passScore // 及格分数
}
uni.navigateTo({
diff --git a/pages/YNEduApp/exam/examination.vue b/pages/YNEduApp/exam/examination.vue
index c3f03c4..cd4d528 100644
--- a/pages/YNEduApp/exam/examination.vue
+++ b/pages/YNEduApp/exam/examination.vue
@@ -66,15 +66,24 @@
@click="clickImg(fileUrl + item.examTopicUrl)"
/>
-
-
{{ option.optionIdent }}.
-
{{ option.optionContent }}
+
+
+
{{ option.optionIdent }}.
+
{{ option.optionContent }}
+
+
@@ -130,6 +139,7 @@ import config from '@/config'
export default {
data() {
return {
+ isLoading: false,
// 考试id
examId: '',
// 考试记录id
@@ -144,7 +154,6 @@ export default {
examTime: 0,
random1: 0,
random2: 0,
- hasScanned: false,
// 答题时间
answerTime: 0,
currentIndex: 0,
@@ -192,16 +201,14 @@ export default {
onHide() {
// this.screenCount++
// console.log('🚀 ~ onHide ~ this.screenCount:', this.screenCount)
- if (!this.isHide) {
- this.handleConfirmSubmit()
- }
+ setTimeout(() => {
+ if (!this.isHide) {
+ this.handleConfirmSubmit()
+ }
+ }, 500)
},
mounted() {
this.getList()
- this.random1 = Math.ceil(Math.random() * 100000) + 420000 // random1 在 7-13分钟之间
- // this.random1 = 10000
- this.random2 = Math.ceil(Math.random() * 100000) + 900000 // random2 在 15-19分钟之间
- console.log('🚀 ~ mounted ~ this.random1:', this.random1, this.random2)
},
// onUnload() {
// console.log('🚀 ~ onUnload ~ 页面关闭')
@@ -214,14 +221,7 @@ export default {
const params = {
examId: this.examId
}
- // const res = await getExamQuestionList(params)
- // const data = res.data
- // this.questionList = data.examPaperData
- // this.recordId = data.recordId
- // this.examTime = data.answerTime
- // this.time = Number(data.answerTime) * 60 * 1000
- // console.log('🚀 ~ getList ~ this.time:', this.time)
- // console.log('🚀 ~ getList ~ res考试题:', res)
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/studentExam/getExamQuestionList',
method: 'post',
@@ -240,6 +240,9 @@ export default {
this.time = Number(data.answerTime) * 60 * 1000
console.log('🚀 ~ getList ~ this.time:', this.time)
console.log('🚀 ~ getList ~ this.questionList:', this.questionList)
+ this.random1 = (data.answerTime / 3) * 60 + Math.ceil(Math.random() * 20) + 20
+ this.random2 = (data.answerTime / 2) * 60 + Math.ceil(Math.random() * 30) + 30
+ console.log('🚀 ~ getList ~ this.random1:', this.random1, this.random2)
if (this.questionList.length > 0) {
this.questionList.forEach((item, index) => {
this.$set(item, 'isShow', index < 7)
@@ -267,20 +270,27 @@ export default {
changeCountDown(time) {
// console.log('🚀 ~ changeCountDown ~ time:', time)
// 等时间赋值后再开始计时
- if (this.time == 0) return
+ if (this.time == 0 && !this.isLoading) return
this.answerTime =
this.time - (time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds) * 1000
// console.log('🚀 ~ changeCountDown ~ this.answerTime:', this.answerTime)
- if (this.answerTime > this.random1 && this.answerTime < this.random2 && !this.hasScanned) {
- this.openFaceScan() // Android 人脸识别
- // this.openPhotograph() // IOS 拍照识别
- this.hasScanned = true
- } else if (this.answerTime > this.random2 && this.hasScanned) {
- this.openFaceScan()
- // this.openPhotograph()
- this.hasScanned = false
- }
- if (this.answerTime == this.time) {
+ console.log(
+ '🚀 ~ changeCountDown ~ this.answerTime:',
+ this.time,
+ this.answerTime / 1000,
+ this.random1,
+ this.random2
+ )
+ console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random1)
+ console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random2)
+ if (this.answerTime / 1000 == this.random1) {
+ console.log('🚀 ~ changeCountDown ~ 人脸识别')
+ // this.openFaceScan() // Android 人脸识别
+ this.openPhotograph() // IOS 拍照识别
+ } else if (this.answerTime / 1000 == this.random2) {
+ // this.openFaceScan()
+ this.openPhotograph()
+ } else if (this.answerTime == this.time) {
// 提示: 时间结束, 自动提交
this.$refs.uToast.show({
message: '考试时间结束, 系统将自动提交',
@@ -336,8 +346,12 @@ export default {
questionId: item.id,
selectAnswer
}
+ if (item.examType == 3) {
+ params.selectAnswer = selectAnswer == 'A' ? '对' : '错'
+ }
console.log('🚀 ~ handleSelectOption ~ params:', params)
// insertQuestionAnswerById(params)
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/studentExam/insertQuestionAnswerById',
method: 'post',
@@ -345,6 +359,9 @@ export default {
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: uni.getStorageSync('access_token')
+ },
+ success: res => {
+ console.log('🚀 ~ handleSelectOption ~ res:', res)
}
})
},
@@ -354,6 +371,15 @@ export default {
},
// 确认提交
handleConfirmSubmit() {
+ console.log('🚀 ~ 提交-->', this.isLoading)
+ if (this.isLoading) {
+ uni.showToast({
+ title: '正在提交中, 请稍后',
+ icon: 'none'
+ })
+ return
+ }
+ this.isLoading = true
// 停止计时
this.$refs.countDown.pause()
const params = {
@@ -364,6 +390,7 @@ export default {
answerTime: Math.ceil(this.answerTime / 60000)
}
// const res = await commitExamByRecordId(params)
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/studentExam/commitExamByRecordId',
method: 'post',
@@ -375,7 +402,6 @@ export default {
success: res => {
console.log('🚀 ~ handleConfirmSubmit ~ res:', res)
res = res.data
- this.showConfirmModal = false
const params2 = {
examId: this.examId,
examGrade: res.examGrade,
@@ -385,7 +411,7 @@ export default {
examTime: this.examTime,
questionCount: this.questionList.length,
switchCount: this.switchCount,
- examNum: this.examNum,
+ examNum: this.examNum + 1,
examCount: this.examCount,
examCustom: this.examCustom,
results: res.examResult,
@@ -396,6 +422,9 @@ export default {
uni.navigateTo({
url: `/pages/YNEduApp/exam/examinationDetails?params=${JSON.stringify(params2)}`
})
+ setTimeout(() => {
+ this.showConfirmModal = false
+ }, 1000)
}
})
if (this.studyId) {
@@ -424,18 +453,18 @@ export default {
// })
},
// 人脸识别
- async openFaceScan() {
- face.open(['a'], e => {
- console.log('🚀 ~ e-人脸识别:', e)
- face.close()
- let params = {
- userId: uni.getStorageSync('userId'),
- img: e
- }
- params = JSON.stringify(params)
- this.getFaceRecognition(params)
- })
- },
+ // async openFaceScan() {
+ // face.open(['a'], e => {
+ // console.log('🚀 ~ e-人脸识别:', e)
+ // face.close()
+ // let params = {
+ // userId: uni.getStorageSync('userId'),
+ // img: e
+ // }
+ // params = JSON.stringify(params)
+ // this.getFaceRecognition(params)
+ // })
+ // },
// 拍照录入
openPhotograph() {
this.isHide = true
@@ -450,7 +479,7 @@ export default {
this.imgToBase64(res.tempFilePaths[0]).then(base64 => {
url = base64
console.log('🚀 ~ this.imgToBase64 ~ base64:', url)
- this.getFaceRecognition(url)
+ this.getFaceRecognition({ userId: uni.getStorageSync('userId'), img: url })
})
},
fail: err => {
@@ -473,6 +502,8 @@ export default {
},
// 发送请求
getFaceRecognition(params) {
+ console.log('🚀 ~ getFaceRecognition ~ params:', params)
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition',
method: 'POST',
@@ -482,8 +513,9 @@ export default {
},
data: params,
success: res => {
+ console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res)
res = res.data
- console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res, res.code)
+ console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res.code)
if (res.code == 200) {
this.$refs.uToast.show({
message: '人脸识别成功',
@@ -501,6 +533,10 @@ export default {
},
fail(err) {
console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
+ this.$refs.uToast.show({
+ message: err.errMsg,
+ duration: 1000
+ })
}
})
},
@@ -512,6 +548,7 @@ export default {
// this.screenCount--
},
updStudyDurationExamPractice(params) {
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/student/updStudyDurationExamPractice',
method: 'post',
@@ -620,27 +657,32 @@ export default {
}
.options {
margin-top: 10px;
- .option {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- margin-top: 10px;
- background: #f4f9fe;
- border-radius: 5px;
- &.isActive {
- background: #8cbff1;
- color: #fff;
- }
- .option-item {
- width: 33px;
- height: 33px;
- line-height: 33px;
- text-align: center;
- color: #333;
- }
- .option-content {
- margin-left: 10px;
- color: #333;
+ margin-bottom: 30px;
+ .option-wrapper {
+ max-height: 500px;
+ overflow: auto;
+ .option {
+ display: flex;
+ justify-content: flex-start;
+ align-items: center;
+ margin-top: 10px;
+ background: #f4f9fe;
+ border-radius: 5px;
+ &.isActive {
+ background: #8cbff1;
+ color: #fff;
+ }
+ .option-item {
+ width: 33px;
+ height: 33px;
+ line-height: 33px;
+ text-align: center;
+ color: #333;
+ }
+ .option-content {
+ margin-left: 10px;
+ color: #333;
+ }
}
}
}
diff --git a/pages/YNEduApp/exam/examinationDetails.vue b/pages/YNEduApp/exam/examinationDetails.vue
index 84dba6b..ae62313 100644
--- a/pages/YNEduApp/exam/examinationDetails.vue
+++ b/pages/YNEduApp/exam/examinationDetails.vue
@@ -94,7 +94,7 @@ export default {
questionCount: 0,
// 考试次数
examNum: 0,
- examCount: 1, // 考试次数 1: 不限次 2: 及格终止 3: 自定义
+ examCount: '', // 考试次数 1: 不限次 2: 及格终止 3: 自定义
examCustom: 0, // 自定义次数
results: 0, // 考试结果
studyId: '',
@@ -138,7 +138,7 @@ export default {
} else {
from = '/pages/YNEduApp/exam/exam'
}
-
+
// examCount 1: 不限次 2: 及格终止 3: 自定义
if (this.examCount == 2 && this.results == 1) {
uni.showToast({
@@ -146,7 +146,7 @@ export default {
icon: 'none'
})
setTimeout(() => {
- uni.navigateTo({
+ uni.reLaunch({
url: from
})
}, 1000)
@@ -156,23 +156,24 @@ export default {
icon: 'none'
})
setTimeout(() => {
- uni.navigateTo({
+ uni.reLaunch({
url: from
})
}, 1000)
+ } else {
+ const params = {
+ examId: this.examId,
+ examNum: this.examNum,
+ examCount: this.examCount,
+ examCustom: this.examCustom,
+ switchCount: this.switchCount,
+ studyId: this.studyId
+ }
+ console.log('🚀 ~ handleResetExamination ~ params:', params)
+ uni.navigateTo({
+ url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}`
+ })
}
- const params = {
- examId: this.examId,
- examNum: this.examNum,
- examCount: this.examCount,
- examCustom: this.examCustom,
- switchCount: this.switchCount,
- studyId: this.studyId
- }
- console.log('🚀 ~ handleResetExamination ~ params:', params)
- uni.navigateTo({
- url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}`
- })
},
handleArrow() {
let from = ''
@@ -193,6 +194,7 @@ export default {
}
// const res = await getExamRankById(params)
// this.rankList = res.data
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/studentExam/getExamRankById',
method: 'post',
diff --git a/pages/YNEduApp/exam/examinationList.vue b/pages/YNEduApp/exam/examinationList.vue
index f256bec..002a4a3 100644
--- a/pages/YNEduApp/exam/examinationList.vue
+++ b/pages/YNEduApp/exam/examinationList.vue
@@ -18,7 +18,7 @@
得分率:
@@ -66,6 +66,7 @@ export default {
// const res = await getExamRecordById(params)
// console.log('🚀 ~ getList ~ res:', res)
// this.list = res.data
+ this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/studentExam/getExamRecordById',
method: 'get',
diff --git a/pages/YNEduApp/exam/examinationResultDetails.vue b/pages/YNEduApp/exam/examinationResultDetails.vue
index 41b1a4a..96e806b 100644
--- a/pages/YNEduApp/exam/examinationResultDetails.vue
+++ b/pages/YNEduApp/exam/examinationResultDetails.vue
@@ -95,9 +95,9 @@