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