培训 bug 修复

This commit is contained in:
binbin_pan 2024-09-05 18:17:59 +08:00
parent c73e25f07d
commit a03f5c08b4
5 changed files with 118 additions and 73 deletions

View File

@ -208,10 +208,6 @@ export default {
}, },
mounted() { mounted() {
this.getList() 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() { // onUnload() {
// console.log('🚀 ~ onUnload ~ ') // console.log('🚀 ~ onUnload ~ ')
@ -224,14 +220,7 @@ export default {
const params = { const params = {
examId: this.examId 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)
uni.request({ uni.request({
url: config.baseUrl + '/exam-student/studentExam/getExamQuestionList', url: config.baseUrl + '/exam-student/studentExam/getExamQuestionList',
method: 'post', method: 'post',
@ -250,6 +239,9 @@ export default {
this.time = Number(data.answerTime) * 60 * 1000 this.time = Number(data.answerTime) * 60 * 1000
console.log('🚀 ~ getList ~ this.time:', this.time) console.log('🚀 ~ getList ~ this.time:', this.time)
console.log('🚀 ~ getList ~ this.questionList:', this.questionList) 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) { if (this.questionList.length > 0) {
this.questionList.forEach((item, index) => { this.questionList.forEach((item, index) => {
this.$set(item, 'isShow', index < 7) this.$set(item, 'isShow', index < 7)
@ -282,12 +274,12 @@ export default {
this.time - (time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds) * 1000 this.time - (time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds) * 1000
// console.log('🚀 ~ changeCountDown ~ this.answerTime:', this.answerTime) // console.log('🚀 ~ changeCountDown ~ this.answerTime:', this.answerTime)
if (this.answerTime > this.random1 && this.answerTime < this.random2 && !this.hasScanned) { if (this.answerTime > this.random1 && this.answerTime < this.random2 && !this.hasScanned) {
this.openFaceScan() // Android // this.openFaceScan() // Android
// this.openPhotograph() // IOS this.openPhotograph() // IOS
this.hasScanned = true this.hasScanned = true
} else if (this.answerTime > this.random2 && this.hasScanned) { } else if (this.answerTime > this.random2 && this.hasScanned) {
this.openFaceScan() // this.openFaceScan()
// this.openPhotograph() this.openPhotograph()
this.hasScanned = false this.hasScanned = false
} }
if (this.answerTime == this.time) { if (this.answerTime == this.time) {
@ -452,18 +444,18 @@ export default {
// }) // })
}, },
// //
async openFaceScan() { // async openFaceScan() {
face.open(['a'], e => { // face.open(['a'], e => {
console.log('🚀 ~ e-人脸识别:', e) // console.log('🚀 ~ e-:', e)
face.close() // face.close()
let params = { // let params = {
userId: uni.getStorageSync('userId'), // userId: uni.getStorageSync('userId'),
img: e // img: e
} // }
params = JSON.stringify(params) // params = JSON.stringify(params)
this.getFaceRecognition(params) // this.getFaceRecognition(params)
}) // })
}, // },
// //
openPhotograph() { openPhotograph() {
this.isHide = true this.isHide = true
@ -478,7 +470,7 @@ export default {
this.imgToBase64(res.tempFilePaths[0]).then(base64 => { this.imgToBase64(res.tempFilePaths[0]).then(base64 => {
url = base64 url = base64
console.log('🚀 ~ this.imgToBase64 ~ base64:', url) console.log('🚀 ~ this.imgToBase64 ~ base64:', url)
this.getFaceRecognition(url) this.getFaceRecognition({ userId: uni.getStorageSync('userId'), img: url })
}) })
}, },
fail: err => { fail: err => {
@ -501,6 +493,7 @@ export default {
}, },
// //
getFaceRecognition(params) { getFaceRecognition(params) {
console.log('🚀 ~ getFaceRecognition ~ params:', params)
uni.request({ uni.request({
url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition', url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition',
method: 'POST', method: 'POST',
@ -510,8 +503,9 @@ export default {
}, },
data: params, data: params,
success: res => { success: res => {
console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res)
res = res.data res = res.data
console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res, res.code) console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res.code)
if (res.code == 200) { if (res.code == 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
message: '人脸识别成功', message: '人脸识别成功',
@ -529,6 +523,10 @@ export default {
}, },
fail(err) { fail(err) {
console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err) console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
this.$refs.uToast.show({
message: err.errMsg,
duration: 1000
})
} }
}) })
}, },

View File

@ -29,7 +29,7 @@ export default {
console.log('🚀 ~ onLoad ~ this.params:', this.path) console.log('🚀 ~ onLoad ~ this.params:', this.path)
console.log('🚀 ~ onLoad ~ this.params:', Number(opt.studyDuration), Number(opt.allStudyDuration)) console.log('🚀 ~ onLoad ~ this.params:', Number(opt.studyDuration), Number(opt.allStudyDuration))
if (Number(opt.studyDuration) <= Number(opt.allStudyDuration)) { if (Number(opt.studyDuration) < Number(opt.allStudyDuration)) {
this.isEnd = false this.isEnd = false
setTimeout(() => { setTimeout(() => {
this.countDown() this.countDown()
@ -77,11 +77,10 @@ export default {
// let studyDuration = Number(this.params.studyDuration) // let studyDuration = Number(this.params.studyDuration)
this.timer = setInterval(() => { this.timer = setInterval(() => {
allStudyDuration-- allStudyDuration--
// studyDuration++
this.params.studyDuration++ this.params.studyDuration++
// this.$set(this.params, 'studyDuration', studyDuration)
console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration) console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration)
if (allStudyDuration <= 0) { if (allStudyDuration <= 0) {
this.params.studyDuration = this.params.allStudyDuration
this.isEnd = true this.isEnd = true
clearInterval(this.timer) clearInterval(this.timer)
// - // -

View File

@ -34,7 +34,7 @@ export default {
} }
console.log('🚀 ~ onLoad ~ this.params:', this.path) console.log('🚀 ~ onLoad ~ this.params:', this.path)
console.log('🚀 ~ onLoad ~ this.params:', Number(opt.studyDuration), Number(opt.allStudyDuration)) console.log('🚀 ~ onLoad ~ this.params:', Number(opt.studyDuration), Number(opt.allStudyDuration))
if (Number(opt.studyDuration) <= Number(opt.allStudyDuration)) { if (Number(opt.studyDuration) < Number(opt.allStudyDuration)) {
setTimeout(() => { setTimeout(() => {
this.countDown() this.countDown()
}, 1000) }, 1000)
@ -62,14 +62,12 @@ export default {
// allStudyDuration // allStudyDuration
countDown() { countDown() {
let allStudyDuration = Number(this.params.allStudyDuration) - Number(this.params.studyDuration) let allStudyDuration = Number(this.params.allStudyDuration) - Number(this.params.studyDuration)
// let studyDuration = Number(this.params.studyDuration)
this.timer = setInterval(() => { this.timer = setInterval(() => {
allStudyDuration-- allStudyDuration--
// studyDuration++
this.params.studyDuration++ this.params.studyDuration++
// this.$set(this.params, 'studyDuration', studyDuration)
console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration) console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration)
if (allStudyDuration <= 0) { if (allStudyDuration <= 0) {
this.params.studyDuration = this.params.allStudyDuration
clearInterval(this.timer) clearInterval(this.timer)
setTimeout(() => { setTimeout(() => {
this.updStudyDuration() this.updStudyDuration()

View File

@ -17,7 +17,7 @@
</div> </div>
<div class="question-wrapper" v-for="(item, index) in questionList" :key="index"> <div class="question-wrapper" v-for="(item, index) in questionList" :key="index">
<div v-if="item.examType !== 2"> <div v-if="item.examType != 2">
<div class="title">{{ nowNum }}.{{ item.paperTopic }}{{ item.examType == 1 ? '(单选题)' : '(判断题)' }}</div> <div class="title">{{ nowNum }}.{{ item.paperTopic }}{{ item.examType == 1 ? '(单选题)' : '(判断题)' }}</div>
<u--image <u--image
v-if="item.paperTopicUrl" v-if="item.paperTopicUrl"
@ -36,7 +36,21 @@
@click="handleOption(option, index)" @click="handleOption(option, index)"
:class="{ active: option.isCorrect || option.isError }" :class="{ active: option.isCorrect || option.isError }"
> >
<div class="label">{{ option.optionIdent }}.{{ option.optionContent }}</div> <div class="label-wrapper">
<div class="label">
<div style="width: 18px">{{ option.optionIdent }}.</div>
<div class="label-cont">{{ option.optionContent }}</div>
</div>
<u--image
v-if="option.optionUrl"
:showLoading="true"
:src="fileUrl + option.optionUrl"
width="60px"
height="60px"
style="margin: 10px 0"
@click="clickImg(fileUrl + option.optionUrl)"
/>
</div>
<u-icon v-if="option.isCorrect" name="/static/images/right.png" size="25" /> <u-icon v-if="option.isCorrect" name="/static/images/right.png" size="25" />
<u-icon v-if="option.isError" name="/static/images/err.png" size="25" /> <u-icon v-if="option.isError" name="/static/images/err.png" size="25" />
</div> </div>
@ -46,15 +60,15 @@
<div>正确答案{{ item.correctGrade }}</div> <div>正确答案{{ item.correctGrade }}</div>
<div>你的答案{{ item.select }}</div> <div>你的答案{{ item.select }}</div>
<div v-if="item.analysis"> <div>
<div class="analysis">答案解析</div> <div class="analysis">答案解析</div>
<div class="analysis-container">{{ item.answerAnaly }}</div> <div class="analysis-container">{{ item.answerAnaly }}</div>
</div> </div>
</div> </div>
</div> </div>
<!-- 多选 --> <!-- 多选 -->
<div v-else-if="item.examType === 2"> <div v-else-if="item.examType == 2">
<div class="title">{{ index + 1 }}. {{ item.paperTopic }}多选题</div> <div class="title">{{ nowNum }}. {{ item.paperTopic }}多选题</div>
<u--image <u--image
v-if="item.paperTopicUrl" v-if="item.paperTopicUrl"
:showLoading="true" :showLoading="true"
@ -72,7 +86,7 @@
@click="handleCheckbox(option, index, item)" @click="handleCheckbox(option, index, item)"
:class="{ active: option.isCheck || option.isCorrect || option.isError }" :class="{ active: option.isCheck || option.isCorrect || option.isError }"
> >
<div> <div class="label-wrapper">
<div class="label"> <div class="label">
<div style="width: 18px">{{ option.optionIdent }}.</div> <div style="width: 18px">{{ option.optionIdent }}.</div>
<div class="label-cont">{{ option.optionContent }}</div> <div class="label-cont">{{ option.optionContent }}</div>
@ -80,11 +94,11 @@
<u--image <u--image
v-if="option.optionUrl" v-if="option.optionUrl"
:showLoading="true" :showLoading="true"
:src="fileUrl + option.optionUrl || ''" :src="fileUrl + option.optionUrl"
width="60px" width="60px"
height="60px" height="60px"
style="margin-bottom: 10px" style="margin: 10px 0"
@click="clickImg(fileUrl + option.optionUrl || '')" @click="clickImg(fileUrl + option.optionUrl)"
/> />
</div> </div>
<u-icon v-if="option.isCorrect" name="/static/images/right.png" size="25" /> <u-icon v-if="option.isCorrect" name="/static/images/right.png" size="25" />
@ -224,7 +238,7 @@ export default {
isNew: 1, // isNew: 1, //
isOutOfOrder: 1, // isOutOfOrder: 1, //
isError: false, // isError: false, //
nowNum: 0, // nowNum: '', //
showModal: false, showModal: false,
showModalSelect: false, showModalSelect: false,
// //
@ -273,19 +287,13 @@ export default {
}, },
methods: { methods: {
// - // -
async getPracticeItData() { getPracticeItData() {
const params = { const params = {
practiceId: this.practiceId, practiceId: this.practiceId,
recordId: this.recordId, recordId: this.recordId,
isNew: this.isNew || '', isNew: this.isNew || '',
isMiss: this.isError ? '1' : '' isMiss: this.isError ? '1' : ''
} }
// const res = await getPracticeItData(params)
// this.trueNum = res.data.trueNum
// this.falseNum = res.data.falseNum
// this.allNum = res.data.allNum
// this.nowNum = res.data.nowNum
// console.log('🚀 ~ getPracticeItData ~ res:', res)
uni.request({ uni.request({
url: config.baseUrl + '/exam-student/studentPractice/getPracticeItData', url: config.baseUrl + '/exam-student/studentPractice/getPracticeItData',
method: 'post', method: 'post',
@ -308,7 +316,7 @@ export default {
}) })
}, },
// //
async getPracticeQuestion() { getPracticeQuestion() {
this.questionList = [] this.questionList = []
const params = { const params = {
practiceId: this.practiceId, practiceId: this.practiceId,
@ -333,8 +341,43 @@ export default {
success: res => { success: res => {
console.log('🚀 ~ getPracticeQuestion ~ res:', res) console.log('🚀 ~ getPracticeQuestion ~ res:', res)
res = res.data res = res.data
this.recordId = res.data.recordId ? res.data.recordId : this.recordId
this.questionList.push(res.data) this.questionList.push(res.data)
console.log('🚀 ~ getPracticeQuestion ~ :', this.questionList[0])
this.recordId = res.data.recordId ? res.data.recordId : this.recordId
if (res.data.selectAnswer) {
console.log('执行了--')
if (this.questionList[0].examType == 2) {
this.questionList[0].select = res.data.selectAnswer.split('')
this.questionList[0].isSelect = true
// selectAnswer,
this.questionList[0].listOption.forEach(item => {
if (res.data.selectAnswer.includes(item.optionIdent)) {
item.isSelect = true
}
if (res.data.correctGrade.includes(item.optionIdent)) {
item.isCorrect = true
}
if (item.isSelect && !this.questionList[0].correctGrade.includes(item.optionIdent)) {
item.isError = true
}
})
} else {
this.questionList[0].select = res.data.selectAnswer
this.questionList[0].isSelect = true
// selectAnswer,
this.questionList[0].listOption.forEach(item => {
if (res.data.selectAnswer === item.optionIdent) {
item.isSelect = true
}
if (item.optionIdent === this.questionList[0].correctGrade) {
item.isCorrect = true
}
if (item.isSelect && item.optionIdent !== this.questionList[0].correctGrade) {
item.isError = true
}
})
}
}
}, },
fail: err => { fail: err => {
console.log(err) console.log(err)
@ -342,15 +385,16 @@ export default {
}) })
}, },
// //
async handleJump(item, index) { handleJump(item, index) {
console.log('🚀 ~ handleJump ~ item:', item, this.recordId) console.log('🚀 ~ handleJump ~ item:', item, this.recordId)
if (item === 'prev') { if (item === 'prev') {
this.nowNum -= 1 this.nowNum--
} else if (item === 'next') { } else if (item === 'next') {
this.nowNum += 1 this.nowNum++
} else if (item === 'jump') { } else if (item === 'jump') {
this.nowNum = index this.nowNum = index
} }
console.log('🚀 ~ handleJump ~ this.nowNum:', this.nowNum)
this.currentIndex = index this.currentIndex = index
this.questionList = [] this.questionList = []
@ -378,7 +422,7 @@ export default {
res = res.data res = res.data
this.questionList.push(res.data) this.questionList.push(res.data)
if (res.data.selectAnswer) { if (res.data.selectAnswer) {
if (this.questionList[0].examType === 2) { if (this.questionList[0].examType == 2) {
this.questionList[0].select = res.data.selectAnswer.split('') this.questionList[0].select = res.data.selectAnswer.split('')
this.questionList[0].isSelect = true this.questionList[0].isSelect = true
// selectAnswer, // selectAnswer,
@ -386,7 +430,7 @@ export default {
if (res.data.selectAnswer.includes(item.optionIdent)) { if (res.data.selectAnswer.includes(item.optionIdent)) {
item.isSelect = true item.isSelect = true
} }
if (item.optionIdent === this.questionList[0].correctGrade) { if (res.data.correctGrade.includes(item.optionIdent)) {
item.isCorrect = true item.isCorrect = true
} }
if (item.isSelect && !this.questionList[0].correctGrade.includes(item.optionIdent)) { if (item.isSelect && !this.questionList[0].correctGrade.includes(item.optionIdent)) {
@ -417,7 +461,7 @@ export default {
}) })
}, },
// - // -
async getPracticeQuestionList() { getPracticeQuestionList() {
const params = { const params = {
recordId: this.recordId, recordId: this.recordId,
practiceId: this.practiceId, practiceId: this.practiceId,
@ -627,7 +671,7 @@ export default {
} }
}, },
// //
async handleSubmit() { handleSubmit() {
// //
clearInterval(this.intervalId) clearInterval(this.intervalId)
console.log('提交') console.log('提交')
@ -750,7 +794,7 @@ export default {
}, 500) }, 500)
}, },
// //
async openSelect() { openSelect() {
this.showModalSelect = true this.showModalSelect = true
// const res = await this.getPracticeQuestionList() // const res = await this.getPracticeQuestionList()
// console.log('🚀 ~ openSelect ~ res:', res) // console.log('🚀 ~ openSelect ~ res:', res)
@ -882,6 +926,8 @@ export default {
} }
.question-wrapper { .question-wrapper {
max-height: 500px;
overflow: auto;
padding: 30px; padding: 30px;
color: #08428d; color: #08428d;
@ -901,6 +947,9 @@ export default {
background: #ffffff; background: #ffffff;
border-radius: 8px; border-radius: 8px;
overflow: auto; overflow: auto;
.label-wrapper {
max-height: 100px;
overflow: auto;
.label { .label {
display: flex; display: flex;
align-items: center; align-items: center;
@ -908,6 +957,7 @@ export default {
text-align: left; text-align: left;
} }
} }
}
.active { .active {
border: 1px solid #1f92df; border: 1px solid #1f92df;
} }

View File

@ -22,8 +22,8 @@
</div> </div>
</div> </div>
<div class="btn"> <div class="btn">
<u-button type="primary" shape="circle" text="开始录入" @click="openFaceScan" style="margin-bottom: 10px" /> <!-- <u-button type="primary" shape="circle" text="开始录入" @click="openFaceScan" style="margin-bottom: 10px" /> -->
<!-- <u-button type="primary" shape="circle" text="拍照录入" @click="openPhotograph" /> --> <u-button type="primary" shape="circle" text="拍照录入" @click="openPhotograph" />
</div> </div>
</div> </div>
@ -36,8 +36,8 @@
<div class="img-tip-content">收集您的信息以实现在考试中检测是否是您本人操作请务必录入您本人的面部信息</div> <div class="img-tip-content">收集您的信息以实现在考试中检测是否是您本人操作请务必录入您本人的面部信息</div>
<div class="btn"> <div class="btn">
<u-button type="primary" shape="circle" text="确定录入" @click="handleSubmit" /> <u-button type="primary" shape="circle" text="确定录入" @click="handleSubmit" />
<u-button type="primary" plain shape="circle" text="重新录入" @click="openFaceScan" style="margin: 10px 0" /> <!-- <u-button type="primary" plain shape="circle" text="重新录入" @click="openFaceScan" style="margin: 10px 0" /> -->
<!-- <u-button type="primary" plain shape="circle" text="重新拍照" @click="openPhotograph" /> --> <u-button type="primary" plain shape="circle" text="重新拍照" style="margin: 10px 0" @click="openPhotograph" />
</div> </div>
</div> </div>
</view> </view>