This commit is contained in:
parent
f25bda06a4
commit
10dc5bb077
|
|
@ -126,7 +126,7 @@
|
|||
|
||||
<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 {
|
||||
getExamQuestionList,
|
||||
insertQuestionAnswerById,
|
||||
|
|
@ -186,6 +186,7 @@ export default {
|
|||
this.studyId = opt.studyId || ''
|
||||
this.score = opt.score
|
||||
this.passScore = opt.passScore
|
||||
this.getList()
|
||||
},
|
||||
onShow() {
|
||||
this.isHide = false
|
||||
|
|
@ -209,7 +210,7 @@ export default {
|
|||
}, 500)
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
// this.getList()
|
||||
},
|
||||
// onUnload() {
|
||||
// console.log('🚀 ~ onUnload ~ 页面关闭')
|
||||
|
|
@ -222,7 +223,9 @@ export default {
|
|||
const params = {
|
||||
examId: this.examId
|
||||
}
|
||||
console.log('🚀 ~ 考试 ~ params:', params)
|
||||
this.$verificationToken()
|
||||
console.log('🚀 ~ 考试 ~ config:', config)
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/studentExam/getExamQuestionList',
|
||||
method: 'post',
|
||||
|
|
@ -241,9 +244,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 / 1.5) * 60 + Math.ceil(Math.random() * 30) + 30
|
||||
console.log('🚀 ~ getList ~ this.random1:', this.random1, this.random2)
|
||||
// this.random1 = (data.answerTime / 3) * 60 + Math.ceil(Math.random() * 20) + 20
|
||||
// this.random2 = (data.answerTime / 1.5) * 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)
|
||||
|
|
@ -275,15 +278,13 @@ export default {
|
|||
this.answerTime =
|
||||
this.time - (time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds) * 1000
|
||||
// console.log('🚀 ~ changeCountDown ~ this.answerTime:', this.answerTime)
|
||||
console.log(
|
||||
'🚀 ~ changeCountDown ~ this.answerTime:',
|
||||
this.time,
|
||||
this.answerTime / 1000,
|
||||
this.random1,
|
||||
this.random2
|
||||
)
|
||||
console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random1)
|
||||
console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random2)
|
||||
// console.log(
|
||||
// '🚀 ~ changeCountDown ~ this.answerTime:',
|
||||
// this.time,
|
||||
// this.answerTime / 1000,
|
||||
// )
|
||||
// console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random1)
|
||||
// console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random2)
|
||||
// if (this.answerTime / 1000 == this.random1) {
|
||||
// console.log('🚀 ~ changeCountDown ~ 人脸识别')
|
||||
// // this.openFaceScan() // Android 人脸识别
|
||||
|
|
@ -468,97 +469,97 @@ export default {
|
|||
// })
|
||||
// },
|
||||
// 拍照录入
|
||||
openPhotograph() {
|
||||
this.isHide = true
|
||||
setTimeout(() => {
|
||||
this.$refs.countDown.pause()
|
||||
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({ userId: uni.getStorageSync('userId'), img: url })
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
this.isHide = false
|
||||
console.log('🚀 ~ err:', err)
|
||||
}
|
||||
})
|
||||
}, 10)
|
||||
},
|
||||
imgToBase64(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
pathToBase64(data)
|
||||
.then(base64 => {
|
||||
resolve(base64)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// openPhotograph() {
|
||||
// this.isHide = true
|
||||
// setTimeout(() => {
|
||||
// this.$refs.countDown.pause()
|
||||
// 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({ userId: uni.getStorageSync('userId'), img: url })
|
||||
// })
|
||||
// },
|
||||
// fail: err => {
|
||||
// this.isHide = false
|
||||
// console.log('🚀 ~ err:', err)
|
||||
// }
|
||||
// })
|
||||
// }, 10)
|
||||
// },
|
||||
// imgToBase64(data) {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// pathToBase64(data)
|
||||
// .then(base64 => {
|
||||
// resolve(base64)
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.error(error)
|
||||
// reject(error)
|
||||
// })
|
||||
// })
|
||||
// },
|
||||
// 发送请求
|
||||
getFaceRecognition(params) {
|
||||
console.log('🚀 ~ getFaceRecognition ~ params:', params)
|
||||
this.$verificationToken()
|
||||
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 => {
|
||||
console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res)
|
||||
res = res.data
|
||||
console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res.code)
|
||||
if (res.code == 200) {
|
||||
this.$refs.uToast.show({
|
||||
message: '人脸识别成功',
|
||||
duration: 1000
|
||||
})
|
||||
this.failCount = 3
|
||||
// 继续计时
|
||||
this.$refs.countDown.start()
|
||||
} else {
|
||||
this.failCount--
|
||||
if (this.failCount == 0) {
|
||||
this.$refs.uToast.show({
|
||||
message: '人脸识别失败, 即将结束考试',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.handleConfirmSubmit()
|
||||
}, 1000)
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
message: '人脸识别失败, 请重新录入, 剩余次数: ' + this.failCount + '次',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.openPhotograph()
|
||||
}, 1700)
|
||||
}
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
|
||||
this.$refs.uToast.show({
|
||||
message: err.errMsg,
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// getFaceRecognition(params) {
|
||||
// console.log('🚀 ~ getFaceRecognition ~ params:', params)
|
||||
// this.$verificationToken()
|
||||
// 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 => {
|
||||
// console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res)
|
||||
// res = res.data
|
||||
// console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res.code)
|
||||
// if (res.code == 200) {
|
||||
// this.$refs.uToast.show({
|
||||
// message: '人脸识别成功',
|
||||
// duration: 1000
|
||||
// })
|
||||
// this.failCount = 3
|
||||
// // 继续计时
|
||||
// this.$refs.countDown.start()
|
||||
// } else {
|
||||
// this.failCount--
|
||||
// if (this.failCount == 0) {
|
||||
// this.$refs.uToast.show({
|
||||
// message: '人脸识别失败, 即将结束考试',
|
||||
// duration: 1500
|
||||
// })
|
||||
// setTimeout(() => {
|
||||
// this.handleConfirmSubmit()
|
||||
// }, 1000)
|
||||
// } else {
|
||||
// this.$refs.uToast.show({
|
||||
// message: '人脸识别失败, 请重新录入, 剩余次数: ' + this.failCount + '次',
|
||||
// duration: 1500
|
||||
// })
|
||||
// setTimeout(() => {
|
||||
// this.openPhotograph()
|
||||
// }, 1700)
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// fail(err) {
|
||||
// console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
|
||||
// this.$refs.uToast.show({
|
||||
// message: err.errMsg,
|
||||
// duration: 1000
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
clickImg(url) {
|
||||
this.isHide = true
|
||||
uni.previewImage({
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
</view>
|
||||
</view> -->
|
||||
<uni-easyinput
|
||||
prefixIcon="search"
|
||||
suffixIcon="search"
|
||||
v-model="totalStatus.keyword"
|
||||
placeholder="请输入项目名称"
|
||||
@iconClick="toggleSearch"
|
||||
|
|
@ -354,7 +354,7 @@ export default {
|
|||
|
||||
.single-proj {
|
||||
width: 49%;
|
||||
height: 30vh;
|
||||
height: 22vh;
|
||||
margin-bottom: 1vh;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
|
|
@ -379,13 +379,18 @@ export default {
|
|||
|
||||
.detail-upper {
|
||||
width: 100%;
|
||||
height: 65%;
|
||||
height: 50%;
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
box-sizing: border-box;
|
||||
padding: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
h5 {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.icons {
|
||||
font-size: 12px;
|
||||
|
|
@ -406,7 +411,7 @@ export default {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.avatar {
|
||||
/* .avatar {
|
||||
width: 5vh;
|
||||
height: 5vh;
|
||||
border-radius: 50%;
|
||||
|
|
@ -417,7 +422,7 @@ export default {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
.progress {
|
||||
flex: 1;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
<view class="user-info">
|
||||
<div style="font-size: 18px">{{ createUserName }}</div>
|
||||
<div class="training-content">
|
||||
<div style="width: 80px">培训内容:</div>
|
||||
<span class="content">{{ listStageContentNum }}</span>
|
||||
<div>培训内容:{{ listStageContentNum || '暂无' }}</div>
|
||||
</div>
|
||||
<!-- <view class="info-lef">
|
||||
<view class="avatar">
|
||||
|
|
@ -39,12 +38,15 @@
|
|||
</view> -->
|
||||
</view>
|
||||
<!-- <view class="tip">已开启进度同步,其他途径的学习进度已自动同步</view> -->
|
||||
<u-collapse>
|
||||
<div v-for="(stageItem, stageIndex) in listStage" :key="stageIndex" :title="stageItem.stageName">
|
||||
{{ stageItem.stageName }}
|
||||
<div v-for="(stageItem, stageIndex) in listStage" :key="stageIndex" :title="stageItem.stageName">
|
||||
<div class="item-stage" @click="handleShow(stageItem)">
|
||||
<span>{{ stageItem.stageName }}</span>
|
||||
<u-icon :name="stageItem.isShow ? 'arrow-down' : 'arrow-up'" size="17" />
|
||||
</div>
|
||||
<div v-if="stageItem.isShow">
|
||||
<div v-for="(content, conIndex) in stageItem.listStageContent" :key="conIndex">
|
||||
<u-collapse-item title="素材" v-if="content.stageType == 1">
|
||||
<uni-list>
|
||||
<u-collapse :border="false">
|
||||
<u-collapse-item title="素材" v-if="content.stageType == 1" :border="false">
|
||||
<div
|
||||
class="list-wrapper"
|
||||
v-for="(item, index) in content.studyList"
|
||||
|
|
@ -71,10 +73,8 @@
|
|||
<div>{{ item.studyPercentage || 0 }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
</uni-list>
|
||||
</u-collapse-item>
|
||||
<u-collapse-item title="课程" v-if="content.stageType == 2">
|
||||
<uni-list>
|
||||
</u-collapse-item>
|
||||
<u-collapse-item title="课程" v-if="content.stageType == 2" :border="false">
|
||||
<div
|
||||
class="list-wrapper"
|
||||
v-for="(item, index) in content.studyList"
|
||||
|
|
@ -101,11 +101,9 @@
|
|||
<div>{{ item.studyPercentage || 0 }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
</uni-list>
|
||||
</u-collapse-item>
|
||||
</u-collapse-item>
|
||||
|
||||
<u-collapse-item title="练习" v-if="content.stageType == 3">
|
||||
<uni-list>
|
||||
<u-collapse-item title="练习" v-if="content.stageType == 3" :border="false">
|
||||
<div class="list-wrapper" @click="toggleTheoryPrac(content)">
|
||||
<div class="left-content">
|
||||
<div class="title">
|
||||
|
|
@ -125,11 +123,9 @@
|
|||
{{ content.practiceMsg && content.practiceMsg.allQuestionNum == 0 ? '未开始' : '已练习' }}
|
||||
</div>
|
||||
</div>
|
||||
</uni-list>
|
||||
</u-collapse-item>
|
||||
</u-collapse-item>
|
||||
|
||||
<u-collapse-item title="考试" v-if="content.stageType == 4">
|
||||
<uni-list>
|
||||
<u-collapse-item title="考试" v-if="content.stageType == 4" :border="false">
|
||||
<div class="list-wrapper" @click="toggleTheoryExam(content)">
|
||||
<div class="left-content">
|
||||
<div class="title">
|
||||
|
|
@ -155,11 +151,11 @@
|
|||
{{ !content.examMsg || content.examMsg.examNum == 0 ? '开始考试' : '重考' }}
|
||||
</div>
|
||||
</div>
|
||||
</uni-list>
|
||||
</u-collapse-item>
|
||||
</u-collapse-item>
|
||||
</u-collapse>
|
||||
</div>
|
||||
</div>
|
||||
</u-collapse>
|
||||
</div>
|
||||
</view>
|
||||
<!-- <view class="comment-area">
|
||||
<h2 style="margin-bottom: 15rpx">最新评论 ({{ commentList.length }})</h2>
|
||||
|
|
@ -255,6 +251,10 @@ export default {
|
|||
this.getStudyWorkAll()
|
||||
},
|
||||
methods: {
|
||||
handleShow(item) {
|
||||
console.log('🚀 ~ handleShow ~ item:', item.isShow)
|
||||
item.isShow = this.$set(item, 'isShow', !item.isShow)
|
||||
},
|
||||
// 获取学习项目详情
|
||||
async getStudyWorkAll() {
|
||||
let params = { userId: uni.getStorageSync('userId'), id: this.projId, type: '1' }
|
||||
|
|
@ -276,6 +276,11 @@ export default {
|
|||
this.listStageContentNum = res.data.listStageContentNum
|
||||
this.eligibility = res.data.eligibility
|
||||
this.listStage = res.data.listStage
|
||||
if (this.listStage.length > 0) {
|
||||
this.listStage.forEach((item, index) => {
|
||||
this.$set(item, 'isShow', true)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
@ -406,13 +411,29 @@ export default {
|
|||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
::v-deep .u-cell__body {
|
||||
padding: 5px !important;
|
||||
}
|
||||
::v-deep .u-collapse-item__content__text{
|
||||
padding: 0 5px !important;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #f8f8f8;
|
||||
box-sizing: border-box;
|
||||
padding: 5vw;
|
||||
padding: 5vw 5px;
|
||||
position: relative;
|
||||
|
||||
.item-stage {
|
||||
margin: 8px 0;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.proj-cont {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
|
@ -432,8 +453,11 @@ export default {
|
|||
margin-bottom: 2vh;
|
||||
|
||||
.training-content {
|
||||
word-wrap: break-word; // 允许长单词换行
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
white-space: normal;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.info-lef {
|
||||
|
|
@ -498,19 +522,22 @@ export default {
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 10px;
|
||||
/* padding: 20px 0; */
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
font-size: 12px;
|
||||
color: #b0b0b0;
|
||||
/* height: 400px; */
|
||||
overflow: auto;
|
||||
.left-content {
|
||||
width: 60vw;
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.note {
|
||||
width: 130px;
|
||||
/* width: 130px; */
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
|
|
@ -518,6 +545,7 @@ export default {
|
|||
}
|
||||
}
|
||||
.right-content {
|
||||
width: 35vw;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.progress {
|
||||
|
|
|
|||
|
|
@ -851,7 +851,8 @@ export default {
|
|||
<style lang="scss" scoped>
|
||||
.wrapper {
|
||||
height: 100vh;
|
||||
background: url('/static/images/question-bg.png') no-repeat;
|
||||
/* background: url('/static/images/question-bg.png') no-repeat; */
|
||||
background: #fff;
|
||||
background-size: 100% 100%;
|
||||
|
||||
.slot-content {
|
||||
|
|
@ -998,7 +999,8 @@ export default {
|
|||
.top-time {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #fff;
|
||||
/* color: #fff; */
|
||||
color: #333;
|
||||
padding-top: 60px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<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'
|
||||
|
||||
export default {
|
||||
|
|
@ -69,103 +69,103 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
// 人脸识别
|
||||
openFaceScan() {
|
||||
this.url = ''
|
||||
face.open(['a'], e => {
|
||||
console.log('🚀 ~ e-人脸识别:', e)
|
||||
this.url = e
|
||||
this.isShow = false
|
||||
face.close()
|
||||
})
|
||||
if (!this.url) this.isShow = true
|
||||
},
|
||||
// openFaceScan() {
|
||||
// this.url = ''
|
||||
// face.open(['a'], e => {
|
||||
// console.log('🚀 ~ e-人脸识别:', e)
|
||||
// this.url = e
|
||||
// this.isShow = false
|
||||
// face.close()
|
||||
// })
|
||||
// if (!this.url) this.isShow = true
|
||||
// },
|
||||
// 确定录入
|
||||
handleSubmit() {
|
||||
console.log('🚀 ~ handleSubmit ~ this.url:', this.url)
|
||||
// 上传文件
|
||||
uni.uploadFile({
|
||||
url: config.uploadUrl,
|
||||
filePath: this.url,
|
||||
name: 'data',
|
||||
formData: {
|
||||
photoType: 'face',
|
||||
file: this.url
|
||||
},
|
||||
header: {
|
||||
Authorization: this.token
|
||||
},
|
||||
success: res => {
|
||||
console.log('🚀 ~ res:', res)
|
||||
res = JSON.parse(res.data)
|
||||
this.facePath = res.data.url
|
||||
console.log('🚀 ~ handleSubmit ~ this.facePath:', this.facePath, this.optMode)
|
||||
let params = {
|
||||
userId: this.userId,
|
||||
facePath: this.facePath,
|
||||
optMode: this.optMode,
|
||||
img: this.url
|
||||
}
|
||||
params = JSON.stringify(params)
|
||||
this.$verificationToken()
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/personalCenter/uploadFaceRecognition',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
header: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: this.token
|
||||
},
|
||||
success: res => {
|
||||
res = res.data
|
||||
console.log('🚀 ~ this.uploadFaceRecognition ~ res上传成功:', res, res.code)
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '人脸信息录入成功',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.removeStorageSync('facePath')
|
||||
uni.setStorageSync('facePath', this.facePath)
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/YNEduApp/user/user'
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
console.log('🚀 ~ this.uploadFaceRecognition ~ err:', err)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
console.log('🚀 ~ err:', err)
|
||||
}
|
||||
})
|
||||
},
|
||||
// handleSubmit() {
|
||||
// console.log('🚀 ~ handleSubmit ~ this.url:', this.url)
|
||||
// // 上传文件
|
||||
// uni.uploadFile({
|
||||
// url: config.uploadUrl,
|
||||
// filePath: this.url,
|
||||
// name: 'data',
|
||||
// formData: {
|
||||
// photoType: 'face',
|
||||
// file: this.url
|
||||
// },
|
||||
// header: {
|
||||
// Authorization: this.token
|
||||
// },
|
||||
// success: res => {
|
||||
// console.log('🚀 ~ res:', res)
|
||||
// res = JSON.parse(res.data)
|
||||
// this.facePath = res.data.url
|
||||
// console.log('🚀 ~ handleSubmit ~ this.facePath:', this.facePath, this.optMode)
|
||||
// let params = {
|
||||
// userId: this.userId,
|
||||
// facePath: this.facePath,
|
||||
// optMode: this.optMode,
|
||||
// img: this.url
|
||||
// }
|
||||
// params = JSON.stringify(params)
|
||||
// this.$verificationToken()
|
||||
// uni.request({
|
||||
// url: config.baseUrl + '/exam-student/personalCenter/uploadFaceRecognition',
|
||||
// method: 'POST',
|
||||
// data: params,
|
||||
// header: {
|
||||
// 'content-type': 'application/json',
|
||||
// Authorization: this.token
|
||||
// },
|
||||
// success: res => {
|
||||
// res = res.data
|
||||
// console.log('🚀 ~ this.uploadFaceRecognition ~ res上传成功:', res, res.code)
|
||||
// if (res.code == 200) {
|
||||
// uni.showToast({
|
||||
// title: '人脸信息录入成功',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// uni.removeStorageSync('facePath')
|
||||
// uni.setStorageSync('facePath', this.facePath)
|
||||
// setTimeout(() => {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/YNEduApp/user/user'
|
||||
// })
|
||||
// }, 1000)
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: res.msg,
|
||||
// icon: 'none'
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
// fail: err => {
|
||||
// console.log('🚀 ~ this.uploadFaceRecognition ~ err:', err)
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// fail: 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)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue