培训 bug 修复
This commit is contained in:
parent
c73e25f07d
commit
a03f5c08b4
|
|
@ -208,10 +208,6 @@ export default {
|
|||
},
|
||||
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 ~ 页面关闭')
|
||||
|
|
@ -224,14 +220,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)
|
||||
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/studentExam/getExamQuestionList',
|
||||
method: 'post',
|
||||
|
|
@ -250,6 +239,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)
|
||||
|
|
@ -282,12 +274,12 @@ export default {
|
|||
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.openFaceScan() // Android 人脸识别
|
||||
this.openPhotograph() // IOS 拍照识别
|
||||
this.hasScanned = true
|
||||
} else if (this.answerTime > this.random2 && this.hasScanned) {
|
||||
this.openFaceScan()
|
||||
// this.openPhotograph()
|
||||
// this.openFaceScan()
|
||||
this.openPhotograph()
|
||||
this.hasScanned = false
|
||||
}
|
||||
if (this.answerTime == this.time) {
|
||||
|
|
@ -452,18 +444,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
|
||||
|
|
@ -478,7 +470,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 => {
|
||||
|
|
@ -501,6 +493,7 @@ export default {
|
|||
},
|
||||
// 发送请求
|
||||
getFaceRecognition(params) {
|
||||
console.log('🚀 ~ getFaceRecognition ~ params:', params)
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition',
|
||||
method: 'POST',
|
||||
|
|
@ -510,8 +503,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: '人脸识别成功',
|
||||
|
|
@ -529,6 +523,10 @@ export default {
|
|||
},
|
||||
fail(err) {
|
||||
console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
|
||||
this.$refs.uToast.show({
|
||||
message: err.errMsg,
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default {
|
|||
console.log('🚀 ~ onLoad ~ this.params:', this.path)
|
||||
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
|
||||
setTimeout(() => {
|
||||
this.countDown()
|
||||
|
|
@ -77,11 +77,10 @@ export default {
|
|||
// let studyDuration = Number(this.params.studyDuration)
|
||||
this.timer = setInterval(() => {
|
||||
allStudyDuration--
|
||||
// studyDuration++
|
||||
this.params.studyDuration++
|
||||
// this.$set(this.params, 'studyDuration', studyDuration)
|
||||
console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration)
|
||||
if (allStudyDuration <= 0) {
|
||||
this.params.studyDuration = this.params.allStudyDuration
|
||||
this.isEnd = true
|
||||
clearInterval(this.timer)
|
||||
// 提示-学习时长已满
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export default {
|
|||
}
|
||||
console.log('🚀 ~ onLoad ~ this.params:', this.path)
|
||||
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(() => {
|
||||
this.countDown()
|
||||
}, 1000)
|
||||
|
|
@ -62,14 +62,12 @@ export default {
|
|||
// 根据allStudyDuration 倒计时
|
||||
countDown() {
|
||||
let allStudyDuration = Number(this.params.allStudyDuration) - Number(this.params.studyDuration)
|
||||
// let studyDuration = Number(this.params.studyDuration)
|
||||
this.timer = setInterval(() => {
|
||||
allStudyDuration--
|
||||
// studyDuration++
|
||||
this.params.studyDuration++
|
||||
// this.$set(this.params, 'studyDuration', studyDuration)
|
||||
console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration)
|
||||
if (allStudyDuration <= 0) {
|
||||
this.params.studyDuration = this.params.allStudyDuration
|
||||
clearInterval(this.timer)
|
||||
setTimeout(() => {
|
||||
this.updStudyDuration()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
</div>
|
||||
|
||||
<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>
|
||||
<u--image
|
||||
v-if="item.paperTopicUrl"
|
||||
|
|
@ -36,7 +36,21 @@
|
|||
@click="handleOption(option, index)"
|
||||
: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.isError" name="/static/images/err.png" size="25" />
|
||||
</div>
|
||||
|
|
@ -46,15 +60,15 @@
|
|||
<div>正确答案:{{ item.correctGrade }}</div>
|
||||
<div>你的答案:{{ item.select }}</div>
|
||||
|
||||
<div v-if="item.analysis">
|
||||
<div>
|
||||
<div class="analysis">答案解析:</div>
|
||||
<div class="analysis-container">{{ item.answerAnaly }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 多选 -->
|
||||
<div v-else-if="item.examType === 2">
|
||||
<div class="title">{{ index + 1 }}. {{ item.paperTopic }}(多选题)</div>
|
||||
<div v-else-if="item.examType == 2">
|
||||
<div class="title">{{ nowNum }}. {{ item.paperTopic }}(多选题)</div>
|
||||
<u--image
|
||||
v-if="item.paperTopicUrl"
|
||||
:showLoading="true"
|
||||
|
|
@ -72,7 +86,7 @@
|
|||
@click="handleCheckbox(option, index, item)"
|
||||
:class="{ active: option.isCheck || option.isCorrect || option.isError }"
|
||||
>
|
||||
<div>
|
||||
<div class="label-wrapper">
|
||||
<div class="label">
|
||||
<div style="width: 18px">{{ option.optionIdent }}.</div>
|
||||
<div class="label-cont">{{ option.optionContent }}</div>
|
||||
|
|
@ -80,11 +94,11 @@
|
|||
<u--image
|
||||
v-if="option.optionUrl"
|
||||
:showLoading="true"
|
||||
:src="fileUrl + option.optionUrl || ''"
|
||||
:src="fileUrl + option.optionUrl"
|
||||
width="60px"
|
||||
height="60px"
|
||||
style="margin-bottom: 10px"
|
||||
@click="clickImg(fileUrl + option.optionUrl || '')"
|
||||
style="margin: 10px 0"
|
||||
@click="clickImg(fileUrl + option.optionUrl)"
|
||||
/>
|
||||
</div>
|
||||
<u-icon v-if="option.isCorrect" name="/static/images/right.png" size="25" />
|
||||
|
|
@ -224,7 +238,7 @@ export default {
|
|||
isNew: 1, // 是否新练习
|
||||
isOutOfOrder: 1, // 是否乱序
|
||||
isError: false, // 是否错题消除
|
||||
nowNum: 0, // 当前题目索引
|
||||
nowNum: '', // 当前题目索引
|
||||
showModal: false,
|
||||
showModalSelect: false,
|
||||
// 正确率
|
||||
|
|
@ -273,19 +287,13 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
// 获取题目-上方数量
|
||||
async getPracticeItData() {
|
||||
getPracticeItData() {
|
||||
const params = {
|
||||
practiceId: this.practiceId,
|
||||
recordId: this.recordId,
|
||||
isNew: this.isNew || '',
|
||||
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({
|
||||
url: config.baseUrl + '/exam-student/studentPractice/getPracticeItData',
|
||||
method: 'post',
|
||||
|
|
@ -308,7 +316,7 @@ export default {
|
|||
})
|
||||
},
|
||||
// 获取题目
|
||||
async getPracticeQuestion() {
|
||||
getPracticeQuestion() {
|
||||
this.questionList = []
|
||||
const params = {
|
||||
practiceId: this.practiceId,
|
||||
|
|
@ -333,8 +341,43 @@ export default {
|
|||
success: res => {
|
||||
console.log('🚀 ~ getPracticeQuestion ~ res:', res)
|
||||
res = res.data
|
||||
this.recordId = res.data.recordId ? res.data.recordId : this.recordId
|
||||
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 => {
|
||||
console.log(err)
|
||||
|
|
@ -342,15 +385,16 @@ export default {
|
|||
})
|
||||
},
|
||||
// 跳题
|
||||
async handleJump(item, index) {
|
||||
handleJump(item, index) {
|
||||
console.log('🚀 ~ handleJump ~ item:', item, this.recordId)
|
||||
if (item === 'prev') {
|
||||
this.nowNum -= 1
|
||||
this.nowNum--
|
||||
} else if (item === 'next') {
|
||||
this.nowNum += 1
|
||||
this.nowNum++
|
||||
} else if (item === 'jump') {
|
||||
this.nowNum = index
|
||||
}
|
||||
console.log('🚀 ~ handleJump ~ this.nowNum:', this.nowNum)
|
||||
|
||||
this.currentIndex = index
|
||||
this.questionList = []
|
||||
|
|
@ -378,7 +422,7 @@ export default {
|
|||
res = res.data
|
||||
this.questionList.push(res.data)
|
||||
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].isSelect = true
|
||||
// 给selectAnswer选项如果正确添加正确标记, 错误添加错误标记并给正确选项添加标记
|
||||
|
|
@ -386,7 +430,7 @@ export default {
|
|||
if (res.data.selectAnswer.includes(item.optionIdent)) {
|
||||
item.isSelect = true
|
||||
}
|
||||
if (item.optionIdent === this.questionList[0].correctGrade) {
|
||||
if (res.data.correctGrade.includes(item.optionIdent)) {
|
||||
item.isCorrect = true
|
||||
}
|
||||
if (item.isSelect && !this.questionList[0].correctGrade.includes(item.optionIdent)) {
|
||||
|
|
@ -417,7 +461,7 @@ export default {
|
|||
})
|
||||
},
|
||||
// 获取题目列表-弹框
|
||||
async getPracticeQuestionList() {
|
||||
getPracticeQuestionList() {
|
||||
const params = {
|
||||
recordId: this.recordId,
|
||||
practiceId: this.practiceId,
|
||||
|
|
@ -627,7 +671,7 @@ export default {
|
|||
}
|
||||
},
|
||||
// 提交
|
||||
async handleSubmit() {
|
||||
handleSubmit() {
|
||||
// 暂停时间
|
||||
clearInterval(this.intervalId)
|
||||
console.log('提交')
|
||||
|
|
@ -750,7 +794,7 @@ export default {
|
|||
}, 500)
|
||||
},
|
||||
// 打开题目选择弹框
|
||||
async openSelect() {
|
||||
openSelect() {
|
||||
this.showModalSelect = true
|
||||
// const res = await this.getPracticeQuestionList()
|
||||
// console.log('🚀 ~ openSelect ~ res:', res)
|
||||
|
|
@ -882,6 +926,8 @@ export default {
|
|||
}
|
||||
|
||||
.question-wrapper {
|
||||
max-height: 500px;
|
||||
overflow: auto;
|
||||
padding: 30px;
|
||||
color: #08428d;
|
||||
|
||||
|
|
@ -901,11 +947,15 @@ export default {
|
|||
background: #ffffff;
|
||||
border-radius: 8px;
|
||||
overflow: auto;
|
||||
.label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
text-align: left;
|
||||
.label-wrapper {
|
||||
max-height: 100px;
|
||||
overflow: auto;
|
||||
.label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
.active {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<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="openFaceScan" style="margin-bottom: 10px" /> -->
|
||||
<u-button type="primary" shape="circle" text="拍照录入" @click="openPhotograph" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -36,8 +36,8 @@
|
|||
<div class="img-tip-content">收集您的信息,以实现在考试中检测是否是您本人操作,请务必录入您本人的面部信息</div>
|
||||
<div class="btn">
|
||||
<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="openPhotograph" /> -->
|
||||
<!-- <u-button type="primary" plain shape="circle" text="重新录入" @click="openFaceScan" style="margin: 10px 0" /> -->
|
||||
<u-button type="primary" plain shape="circle" text="重新拍照" style="margin: 10px 0" @click="openPhotograph" />
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
|
|
|
|||
Loading…
Reference in New Issue