调试与bug修改
This commit is contained in:
parent
27697255e9
commit
cb94f77715
|
|
@ -9,6 +9,7 @@
|
|||
"version": "3.4.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"image-tools": "^1.4.0",
|
||||
"luch-request": "^3.1.1"
|
||||
}
|
||||
},
|
||||
|
|
@ -17,6 +18,11 @@
|
|||
"resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz",
|
||||
"integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ=="
|
||||
},
|
||||
"node_modules/image-tools": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/image-tools/-/image-tools-1.4.0.tgz",
|
||||
"integrity": "sha512-TKtvJ6iUwM0mfaD4keMnk1ENHFC470QEjBfA3IlvKdEOufzvWbjbaoNcoyYq6HlViF8+d5tOS1ooE6j7CHf1lQ=="
|
||||
},
|
||||
"node_modules/luch-request": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/luch-request/-/luch-request-3.1.1.tgz",
|
||||
|
|
@ -32,6 +38,11 @@
|
|||
"resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz",
|
||||
"integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ=="
|
||||
},
|
||||
"image-tools": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/image-tools/-/image-tools-1.4.0.tgz",
|
||||
"integrity": "sha512-TKtvJ6iUwM0mfaD4keMnk1ENHFC470QEjBfA3IlvKdEOufzvWbjbaoNcoyYq6HlViF8+d5tOS1ooE6j7CHf1lQ=="
|
||||
},
|
||||
"luch-request": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/luch-request/-/luch-request-3.1.1.tgz",
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/dcloudio/hello-uniapp#readme",
|
||||
"dependencies": {
|
||||
"image-tools": "^1.4.0",
|
||||
"luch-request": "^3.1.1"
|
||||
},
|
||||
"dcloudext": {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
"pages": [
|
||||
// pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
// {
|
||||
// "path": "pages/YNEduApp/index/index",
|
||||
// "path": "pages/YNEduApp/index/index",
|
||||
// "style": {
|
||||
// "navigationStyle" : "custom"
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { pathToBase64, base64ToPath } from 'image-tools'
|
||||
import face from '@/uni_modules/mcc-face/index.js'
|
||||
import {
|
||||
getExamQuestionList,
|
||||
|
|
@ -160,7 +161,8 @@ export default {
|
|||
questionList: [],
|
||||
fileUrl: config.fileUrl,
|
||||
score: 0,
|
||||
passScore: 0
|
||||
passScore: 0,
|
||||
isHide: false
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
|
|
@ -175,27 +177,30 @@ export default {
|
|||
this.score = opt.score
|
||||
this.passScore = opt.passScore
|
||||
},
|
||||
// onShow() {
|
||||
// setTimeout(() => {
|
||||
// if (this.screenCount > this.switchCount) {
|
||||
// this.$refs.uToast.show({
|
||||
// message: '切屏次数已达上限, 系统将自动提交',
|
||||
// duration: 1000
|
||||
// })
|
||||
// this.handleConfirmSubmit()
|
||||
// }
|
||||
// }, 1000)
|
||||
// },
|
||||
onShow() {
|
||||
this.isHide = false
|
||||
// setTimeout(() => {
|
||||
// if (this.screenCount > this.switchCount) {
|
||||
// this.$refs.uToast.show({
|
||||
// message: '切屏次数已达上限, 系统将自动提交',
|
||||
// duration: 1000
|
||||
// })
|
||||
// this.handleConfirmSubmit()
|
||||
// }
|
||||
// }, 1000)
|
||||
},
|
||||
onHide() {
|
||||
// this.screenCount++
|
||||
// console.log('🚀 ~ onHide ~ this.screenCount:', this.screenCount)
|
||||
this.handleConfirmSubmit()
|
||||
if (!this.isHide) {
|
||||
this.handleConfirmSubmit()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
this.random1 = Math.floor(Math.random() * 100000) + 420000 // random1 在 7-13分钟之间
|
||||
this.random1 = Math.ceil(Math.random() * 100000) + 420000 // random1 在 7-13分钟之间
|
||||
// this.random1 = 10000
|
||||
this.random2 = Math.floor(Math.random() * 100000) + 900000 // random2 在 15-19分钟之间
|
||||
this.random2 = Math.ceil(Math.random() * 100000) + 900000 // random2 在 15-19分钟之间
|
||||
console.log('🚀 ~ mounted ~ this.random1:', this.random1, this.random2)
|
||||
},
|
||||
// onUnload() {
|
||||
|
|
@ -267,10 +272,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()
|
||||
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) {
|
||||
|
|
@ -426,44 +433,83 @@ export default {
|
|||
img: e
|
||||
}
|
||||
params = JSON.stringify(params)
|
||||
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition',
|
||||
method: 'POST',
|
||||
header: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: uni.getStorageSync('access_token')
|
||||
},
|
||||
data: params,
|
||||
success: res => {
|
||||
res = res.data
|
||||
console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res, res.code)
|
||||
if (res.code == 200) {
|
||||
this.$refs.uToast.show({
|
||||
message: '人脸识别成功',
|
||||
duration: 1000
|
||||
})
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
message: '人脸识别失败, 即将结束考试',
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.handleConfirmSubmit()
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
|
||||
this.getFaceRecognition(params)
|
||||
})
|
||||
},
|
||||
// 拍照录入
|
||||
openPhotograph() {
|
||||
this.isHide = true
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['camera'],
|
||||
success: res => {
|
||||
this.isHide = false
|
||||
let url = ''
|
||||
console.log('🚀 ~ res-拍照:', res)
|
||||
this.imgToBase64(res.tempFilePaths[0]).then(base64 => {
|
||||
url = base64
|
||||
console.log('🚀 ~ this.imgToBase64 ~ base64:', url)
|
||||
this.getFaceRecognition(url)
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
this.isHide = false
|
||||
console.log('🚀 ~ err:', err)
|
||||
}
|
||||
})
|
||||
},
|
||||
imgToBase64(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
pathToBase64(data)
|
||||
.then(base64 => {
|
||||
resolve(base64)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 发送请求
|
||||
getFaceRecognition(params) {
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition',
|
||||
method: 'POST',
|
||||
header: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: uni.getStorageSync('access_token')
|
||||
},
|
||||
data: params,
|
||||
success: res => {
|
||||
res = res.data
|
||||
console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res, res.code)
|
||||
if (res.code == 200) {
|
||||
this.$refs.uToast.show({
|
||||
message: '人脸识别成功',
|
||||
duration: 1000
|
||||
})
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
message: '人脸识别失败, 即将结束考试',
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.handleConfirmSubmit()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail(err) {
|
||||
console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
|
||||
}
|
||||
})
|
||||
},
|
||||
clickImg(url) {
|
||||
this.isHide = true
|
||||
uni.previewImage({
|
||||
urls: [url]
|
||||
})
|
||||
this.screenCount--
|
||||
// this.screenCount--
|
||||
},
|
||||
updStudyDurationExamPractice(params) {
|
||||
uni.request({
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ export default {
|
|||
this.sourceId = opt.sourceId
|
||||
this.path = config.fileUrl + opt.path
|
||||
console.log('🚀 ~ onLoad ~ this.path:', this.path)
|
||||
this.studyDuration = opt.studyDuration
|
||||
this.allStudyDuration = opt.allStudyDuration
|
||||
this.studyDuration = this.currentTime = Number(opt.studyDuration)
|
||||
this.allStudyDuration = Number(opt.allStudyDuration)
|
||||
},
|
||||
onUnload() {
|
||||
console.log('🚀 ~ onUnload ~ 页面关闭')
|
||||
|
|
@ -82,7 +82,7 @@ export default {
|
|||
// 视频播放时间更新
|
||||
videoTimeUpdate(e) {
|
||||
console.log('视频播放时间:', e.detail.currentTime)
|
||||
this.currentTime = Math.floor(e.detail.currentTime)
|
||||
this.currentTime = Math.ceil(e.detail.currentTime)
|
||||
},
|
||||
openModal() {
|
||||
this.showModal = true
|
||||
|
|
@ -93,10 +93,10 @@ export default {
|
|||
const video = uni.createVideoContext('myVideo')
|
||||
video.pause()
|
||||
// 获取当前播放时间 - 用于记录学习时长
|
||||
console.log('当前播放时间:', this.currentTime)
|
||||
console.log('当前播放时间:', this.currentTime, this.allStudyDuration)
|
||||
this.studyDuration = this.currentTime
|
||||
// 计算学习进度
|
||||
this.studyPercentage = Math.floor((this.studyDuration / this.allStudyDuration) * 100).toFixed(2)
|
||||
this.studyPercentage = Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2)
|
||||
console.log('🚀 ~ handleEnd ~ this.studyPercentage:', this.studyPercentage)
|
||||
|
||||
const params = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<pdf-view>
|
||||
<web-view :src="url"></web-view>
|
||||
<web-view :src="allUrl"></web-view>
|
||||
</pdf-view>
|
||||
</template>
|
||||
|
||||
|
|
@ -14,13 +14,15 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
url: ''
|
||||
allUrl: '',
|
||||
// viewerUrl: '/static/pdfjs/web/viewer.html'
|
||||
viewerUrl: '/static/PDF.html'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.url = '/static/jsFile/readPdf.html?pdfUrl=' + this.path
|
||||
console.log('🚀 ~ mounted ~ this.url:', this.url)
|
||||
},
|
||||
this.allUrl = this.viewerUrl + '?file=' + '/static/image/textpdf.pdf'
|
||||
console.log('🚀 ~ mounted ~ this.allUrl:', this.allUrl)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<u-navbar title="学习项目" @leftClick="leftClick" placeholder />
|
||||
<view class="proj-cont">
|
||||
<h2 style="margin-bottom: 15rpx">{{ name }}</h2>
|
||||
<span style="font-size: 12px; color: #b0b0b0">合格标准:{{ eligibility }}</span>
|
||||
<span style="font-size: 12px; color: #b0b0b0">合格标准:学习进度达到{{ eligibility }}%</span>
|
||||
<view class="user-info">
|
||||
<div style="font-size: 18px">{{ createUserName }}</div>
|
||||
<div class="training-content">
|
||||
|
|
@ -133,7 +133,7 @@
|
|||
<div class="note">{{ content.name }}</div>
|
||||
</div>
|
||||
<div class="right-content">
|
||||
{{ content.examMsg && content.examMsg.examNum != null ? '重考' : '未开始' }}
|
||||
{{ !content.examMsg || content.examMsg.examNum == 0 ? '开始考试' : '重考' }}
|
||||
</div>
|
||||
</div>
|
||||
</uni-list>
|
||||
|
|
@ -457,9 +457,11 @@ export default {
|
|||
align-items: center;
|
||||
}
|
||||
.note {
|
||||
width: 100px;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
.right-content {
|
||||
|
|
|
|||
|
|
@ -26,29 +26,30 @@ export default {
|
|||
this.params = JSON.parse(JSON.stringify(opt))
|
||||
this.params.studyDuration = Number(opt.studyDuration)
|
||||
this.params.allStudyDuration = Number(opt.allStudyDuration)
|
||||
this.path =
|
||||
config.fileUrl + opt.path + `&studyDuration=${opt.studyDuration}&allStudyDuration=${opt.allStudyDuration}`
|
||||
// this.path =
|
||||
// config.fileUrl + opt.path + `&studyDuration=${opt.studyDuration}&allStudyDuration=${opt.allStudyDuration}`
|
||||
this.path = config.fileUrl + opt.path
|
||||
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)) {
|
||||
setTimeout(() => {
|
||||
this.countDown()
|
||||
}, 1000)
|
||||
} else {
|
||||
// 提示-学习时长已满
|
||||
uni.showToast({
|
||||
title: '学习时长已满, 随时可以结束学习',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
// if (Number(opt.studyDuration) <= Number(opt.allStudyDuration)) {
|
||||
// setTimeout(() => {
|
||||
// this.countDown()
|
||||
// }, 1000)
|
||||
// } else {
|
||||
// // 提示-学习时长已满
|
||||
// uni.showToast({
|
||||
// title: '学习时长已满, 随时可以结束学习',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// }
|
||||
},
|
||||
// 卸载
|
||||
onUnload() {
|
||||
console.log('🚀 ~ onUnload ~ 页面关闭')
|
||||
clearInterval(this.timer)
|
||||
// 关闭页面时,修改项目进度
|
||||
this.updStudyDuration()
|
||||
// this.updStudyDuration()
|
||||
},
|
||||
methods: {
|
||||
// 根据allStudyDuration 倒计时
|
||||
|
|
@ -87,7 +88,7 @@ export default {
|
|||
studyCourseId: this.params.studyCourseId,
|
||||
sourceId: this.params.sourceId,
|
||||
studyDuration: this.params.studyDuration,
|
||||
studyPercentage: Math.round(
|
||||
studyPercentage: Math.ceil(
|
||||
(Number(this.params.studyDuration) / Number(this.params.allStudyDuration)) * 100
|
||||
).toFixed(2)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,24 @@
|
|||
class="option"
|
||||
v-for="(option, index) in item.listOption"
|
||||
:key="index"
|
||||
@click="handleCheckbox(option, index)"
|
||||
:class="{ active: option.isCheck }"
|
||||
@click="handleCheckbox(option, index, item)"
|
||||
:class="{ active: option.isCheck || option.isCorrect || option.isError }"
|
||||
>
|
||||
<div class="label">{{ option.optionIdent }}.{{ option.optionContent }}</div>
|
||||
<div>
|
||||
<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-bottom: 10px"
|
||||
@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>
|
||||
|
|
@ -80,7 +94,7 @@
|
|||
|
||||
<div class="btn">
|
||||
<u-button
|
||||
v-show="item.listOption.some(option => option.isCheck)"
|
||||
v-show="item.listOption.some(option => option.isCheck) && !item.isSelect"
|
||||
text="选好了"
|
||||
shape="circle"
|
||||
size="small"
|
||||
|
|
@ -146,7 +160,7 @@
|
|||
confirmText="继续答题"
|
||||
>
|
||||
<view class="slot-content">
|
||||
<div class="correctRate">{{ correctRate }}</div>
|
||||
<div class="correctRate">{{ correctRate }}%</div>
|
||||
<div class="modal-container">
|
||||
<div class="item">
|
||||
<div class="num">{{ answerNum }}</div>
|
||||
|
|
@ -210,7 +224,7 @@ export default {
|
|||
showModal: false,
|
||||
showModalSelect: false,
|
||||
// 正确率
|
||||
correctRate: '80%',
|
||||
correctRate: '0',
|
||||
// 已用时间 - 计时器 - 用于显示已用时间 格式 00:00:00
|
||||
usedTime: '00:00:00',
|
||||
// 正确题数
|
||||
|
|
@ -463,7 +477,7 @@ export default {
|
|||
// 提交答案
|
||||
// insertPracticeAnswerById(params)
|
||||
uni.request({
|
||||
url: config.baseUrl + 'exam-student/studentPractice/insertPracticeAnswerById',
|
||||
url: config.baseUrl + '/exam-student/studentPractice/insertPracticeAnswerById',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
|
|
@ -477,8 +491,11 @@ export default {
|
|||
}
|
||||
},
|
||||
// 处理多选题选项点击事件
|
||||
handleCheckbox(option, index) {
|
||||
handleCheckbox(option, index, item) {
|
||||
console.log('🚀 ~ handleCheckbox ~ option, index:', option, index)
|
||||
if (item.isSelect) {
|
||||
return
|
||||
}
|
||||
// 给当前点击的增加边框 再次点击取消
|
||||
if (!option.isCheck) {
|
||||
this.questionList[0].listOption[index].isCheck = !option.isCheck
|
||||
|
|
@ -513,7 +530,7 @@ export default {
|
|||
})
|
||||
// 给正确选项添加标记
|
||||
this.questionList[0].listOption.forEach(item => {
|
||||
if (correctGrade.includes(item.value)) {
|
||||
if (correctGrade.includes(item.optionIdent)) {
|
||||
item.isCorrect = true
|
||||
}
|
||||
})
|
||||
|
|
@ -524,9 +541,10 @@ export default {
|
|||
this.questionList[0].isError = true
|
||||
// 给错误选项添加标记
|
||||
this.questionList[0].listOption.forEach(item => {
|
||||
if (correctGrade.includes(item.value)) {
|
||||
if (correctGrade.includes(item.optionIdent)) {
|
||||
item.isCorrect = true
|
||||
} else if (item.isCheck) {
|
||||
}
|
||||
if (!correctGrade.includes(item.optionIdent) && item.isCheck) {
|
||||
item.isError = true
|
||||
}
|
||||
})
|
||||
|
|
@ -541,7 +559,7 @@ export default {
|
|||
console.log('🚀 ~ handleOk ~ params-多选:', params)
|
||||
// insertPracticeAnswerById(params)
|
||||
uni.request({
|
||||
url: config.baseUrl + 'exam-student/studentPractice/insertPracticeAnswerById',
|
||||
url: config.baseUrl + '/exam-student/studentPractice/insertPracticeAnswerById',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
|
|
@ -557,37 +575,30 @@ export default {
|
|||
// 提交
|
||||
async handleSubmit() {
|
||||
console.log('提交')
|
||||
this.answerNum = this.trueNum + this.falseNum
|
||||
let rate = ((Number(this.trueNum) / Number(this.answerNum)) * 100).toFixed(2)
|
||||
// 计算正确率 = 正确题数 / 已答题数
|
||||
this.correctRate = rate == 'NaN' ? '0' : rate
|
||||
this.showModal = true
|
||||
const params = {
|
||||
id: this.practiceId
|
||||
}
|
||||
// const res = await getPracticeQuestionRate(params)
|
||||
// // trueRate 正确率
|
||||
// this.correctRate = res.data.trueRate
|
||||
// // allQuestionNum 答题数
|
||||
// this.answerNum = res.data.allQuestionNum
|
||||
// // trueQuestionNum 正确数
|
||||
// this.trueNum = res.data.trueQuestionNum
|
||||
// console.log('🚀 ~ handleSubmit ~ res:', res)
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestionRate',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
Authorization: uni.getStorageSync('access_token')
|
||||
},
|
||||
success: res => {
|
||||
console.log('🚀 ~ handleSubmit ~ res:', res)
|
||||
res = res.data
|
||||
this.correctRate = res.data.trueRate
|
||||
this.answerNum = res.data.allQuestionNum
|
||||
this.trueNum = res.data.trueQuestionNum
|
||||
},
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
// const params = {
|
||||
// id: this.practiceId
|
||||
// }
|
||||
// uni.request({
|
||||
// url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestionRate',
|
||||
// method: 'post',
|
||||
// data: params,
|
||||
// header: {
|
||||
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||
// Authorization: uni.getStorageSync('access_token')
|
||||
// },
|
||||
// success: res => {
|
||||
// console.log('🚀 ~ handleSubmit ~ res:', res)
|
||||
// res = res.data
|
||||
// },
|
||||
// fail: err => {
|
||||
// console.log(err)
|
||||
// }
|
||||
// })
|
||||
},
|
||||
handleConfirm() {
|
||||
console.log('确认')
|
||||
|
|
@ -658,13 +669,13 @@ export default {
|
|||
console.log(err)
|
||||
}
|
||||
})
|
||||
uni.redirectTo({
|
||||
uni.reLaunch({
|
||||
url: '/pages/YNEduApp/learnProj/learnProjDetail?studyId=' + this.studyId
|
||||
})
|
||||
}
|
||||
this.showModal = false
|
||||
// uni.navigateBack()
|
||||
uni.redirectTo({
|
||||
uni.reLaunch({
|
||||
url: '/pages/YNEduApp/prac/prac'
|
||||
})
|
||||
},
|
||||
|
|
@ -674,6 +685,11 @@ export default {
|
|||
// const res = await this.getPracticeQuestionList()
|
||||
// console.log('🚀 ~ openSelect ~ res:', res)
|
||||
// this.questionListSelect = res.data
|
||||
const params = {
|
||||
recordId: this.recordId,
|
||||
practiceId: this.practiceId,
|
||||
isMiss: this.isError ? 1 : ''
|
||||
}
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestionList',
|
||||
method: 'post',
|
||||
|
|
@ -807,12 +823,20 @@ export default {
|
|||
.option {
|
||||
margin-bottom: 5px;
|
||||
padding: 0 15px;
|
||||
height: 40px;
|
||||
min-height: 45px;
|
||||
max-height: 100px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background: #ffffff;
|
||||
border-radius: 8px;
|
||||
overflow: auto;
|
||||
.label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
.active {
|
||||
border: 1px solid #1f92df;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
</div>
|
||||
<div class="time">练习时长 {{ item.practiceDuration }}</div>
|
||||
<div class="count-total">
|
||||
<div class="count">共{{ item.allQuestionNum || 0 }}题, 已练习{{ item.alreadyNum || 0 }}题</div>
|
||||
<div class="count">共{{ item.totalNum || 0 }}题, 已练习{{ item.alreadyNum || 0 }}题</div>
|
||||
</div>
|
||||
<div class="bt-wrapper">
|
||||
<div class="score">完成率:{{ item.completionRate }}</div>
|
||||
|
|
@ -108,14 +108,14 @@ export default {
|
|||
title: item.name || '',
|
||||
isNew: item.alreadyNum == 0 ? true : false
|
||||
}
|
||||
uni.navigateTo({
|
||||
uni.reLaunch({
|
||||
url: '/pages/YNEduApp/prac/pracDetail?params=' + JSON.stringify(params)
|
||||
})
|
||||
uni.removeStorageSync('from')
|
||||
uni.setStorageSync('from', '/pages/YNEduApp/prac/prac')
|
||||
},
|
||||
leftClick() {
|
||||
uni.navigateTo({
|
||||
uni.reLaunch({
|
||||
url: '/pages/YNEduApp/index/index'
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<view class="wrapper">
|
||||
<u-navbar title="学习项目" @leftClick="leftClick" placeholder />
|
||||
<div class="top-container">
|
||||
<!-- <div class="top-container">
|
||||
<u-avatar :src="avatar" size="60" />
|
||||
<div class="name">{{ userName }}</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="title">{{ title }}</div>
|
||||
<div class="center-container">
|
||||
<div class="left">
|
||||
|
|
@ -128,14 +128,6 @@ export default {
|
|||
const params = {
|
||||
id: this.practiceId
|
||||
}
|
||||
// const res = await getPracticeQuestionRate(params)
|
||||
// this.title = res.data.name
|
||||
// this.userName = res.data.userName
|
||||
// this.correctRate = res.data.trueRate
|
||||
// this.totalAnswer = res.data.allQuestionNum
|
||||
// this.totalCorrect = res.data.trueQuestionNum
|
||||
// this.recordId = res.data.recordId
|
||||
// console.log('🚀 ~ getData ~ res:', res)
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestionRate',
|
||||
method: 'post',
|
||||
|
|
@ -147,12 +139,12 @@ export default {
|
|||
success: res => {
|
||||
res = res.data
|
||||
console.log('🚀 ~ handleSubmit ~ res:', res)
|
||||
// this.title = res.data.name
|
||||
// this.userName = res.data.userName
|
||||
// this.correctRate = res.data.trueRate
|
||||
// this.totalAnswer = res.data.allQuestionNum
|
||||
// this.totalCorrect = res.data.trueQuestionNum
|
||||
// this.recordId = res.data.recordId
|
||||
this.title = res.data.name
|
||||
this.userName = res.data.userName
|
||||
this.correctRate = res.data.trueRate || '0%'
|
||||
this.totalAnswer = res.data.allQuestionNum || 0
|
||||
this.totalCorrect = res.data.trueQuestionNum || 0
|
||||
this.recordId = res.data.recordId
|
||||
},
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
|
|
@ -181,7 +173,7 @@ export default {
|
|||
params.isNew = '1'
|
||||
}
|
||||
console.log('params', params)
|
||||
uni.navigateTo({
|
||||
uni.reLaunch({
|
||||
url: `/pages/YNEduApp/prac/exercises?params=${JSON.stringify(params)}`
|
||||
})
|
||||
},
|
||||
|
|
@ -190,7 +182,7 @@ export default {
|
|||
if (this.studyId) {
|
||||
from = from + '?id=' + this.studyId
|
||||
}
|
||||
uni.navigateTo({
|
||||
uni.reLaunch({
|
||||
url: from
|
||||
})
|
||||
}
|
||||
|
|
@ -219,7 +211,7 @@ export default {
|
|||
}
|
||||
.title {
|
||||
margin-top: 50px;
|
||||
margin-bottom: 30px;
|
||||
margin-bottom: 80px;
|
||||
font-weight: 800;
|
||||
font-size: 26px;
|
||||
color: #fff;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@
|
|||
<div>正对手机</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn"><u-button type="primary" shape="circle" text="开始录入" @click="openFaceScan" /></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" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
|
|
@ -33,13 +36,15 @@
|
|||
<div class="img-tip-content">收集您的信息,以实现在考试中检测是否是您本人操作,请务必录入您本人的面部信息</div>
|
||||
<div class="btn">
|
||||
<u-button type="primary" shape="circle" text="确定录入" @click="handleSubmit" />
|
||||
<u-button type="" shape="circle" text="重新录入" @click="openFaceScan" style="margin: 20px 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" />
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { pathToBase64, base64ToPath } from 'image-tools'
|
||||
import face from '@/uni_modules/mcc-face/index.js'
|
||||
import config from 'config.js'
|
||||
|
||||
|
|
@ -76,6 +81,7 @@ export default {
|
|||
},
|
||||
// 确定录入
|
||||
handleSubmit() {
|
||||
console.log('🚀 ~ handleSubmit ~ this.url:', this.url)
|
||||
// 上传文件
|
||||
uni.uploadFile({
|
||||
url: config.uploadUrl,
|
||||
|
|
@ -139,6 +145,37 @@ export default {
|
|||
console.log('🚀 ~ err:', err)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 拍照录入
|
||||
openPhotograph() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['camera'],
|
||||
success: res => {
|
||||
console.log('🚀 ~ res-拍照:', res)
|
||||
this.imgToBase64(res.tempFilePaths[0]).then(base64 => {
|
||||
console.log('🚀 ~ this.imgToBase64 ~ base64:', base64)
|
||||
this.url = base64
|
||||
})
|
||||
this.isShow = false
|
||||
},
|
||||
fail: err => {
|
||||
console.log('🚀 ~ err:', err)
|
||||
}
|
||||
})
|
||||
},
|
||||
imgToBase64(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
pathToBase64(data)
|
||||
.then(base64 => {
|
||||
resolve(base64)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -206,7 +243,7 @@ export default {
|
|||
line-height: 18px;
|
||||
}
|
||||
.img-tip-content {
|
||||
padding: 0 40px 50px;
|
||||
padding: 0 40px 20px;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: #6b6b6b;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ export default {
|
|||
onLoad() {
|
||||
// this.token = uni.getStorageSync('App-Token')
|
||||
console.log('🚀 ~ onLoad ~ this.token:', this.token)
|
||||
console.log('🚀 ~ onLoad ~ this.facePath:', this.facePath)
|
||||
this.getLearnStats()
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue