This commit is contained in:
binbin_pan 2024-11-26 18:20:39 +08:00
parent 66f1e37ab4
commit 21a6266149
1 changed files with 58 additions and 6 deletions

View File

@ -108,10 +108,18 @@ export default {
}, },
// //
videoTimeUpdate(e) { videoTimeUpdate(e) {
this.currentTime = Math.ceil(e.detail.currentTime) let newTime = Math.ceil(e.detail.currentTime)
console.log('🚀 ~ 视频播放时间: ~ this.currentTime:', this.currentTime) if (this.currentTime != newTime) {
console.log('🚀 ~ 视频总时长: ~ this.allStudyDuration:', this.allStudyDuration) this.currentTime = newTime
console.log('🚀 ~ videoTimeUpdate ~ random1-2:', this.random1, this.random2) console.log('🚀 ~ 视频播放时间: ~ this.currentTime:', this.currentTime)
// 10
if (this.currentTime % 10 == 0) {
console.log('学习时长:', this.currentTime)
this.updStudyDuration()
}
}
// console.log('🚀 ~ ~ this.allStudyDuration:', this.allStudyDuration)
// console.log('🚀 ~ videoTimeUpdate ~ random1-2:', this.random1, this.random2)
if (this.currentTime != this.oldTime) { if (this.currentTime != this.oldTime) {
if (this.currentTime == this.random2 || this.currentTime == this.random1) { if (this.currentTime == this.random2 || this.currentTime == this.random1) {
@ -193,9 +201,52 @@ export default {
} }
}) })
}, },
//
updStudyDuration() {
// -
console.log('当前播放时间:', this.currentTime, this.allStudyDuration)
this.studyDuration = this.currentTime
//
this.studyPercentage =
Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2) > 100
? 100
: Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2)
console.log('🚀 ~ handleEnd ~ this.studyPercentage:', this.studyPercentage)
const params = {
userId: uni.getStorageSync('userId'),
studyId: this.studyId,
stageId: this.stageId,
stageContentId: this.stageContentId,
stageType: this.stageType,
studyCourseId: this.studyCourseId,
sourceId: this.sourceId,
studyDuration: this.studyDuration,
studyPercentage: this.studyPercentage
}
console.log('🚀 ~ handleEnd ~ params:', params)
this.$verificationToken()
uni.request({
url: config.baseUrl + '/exam-student/student/updStudyDuration',
method: 'post',
data: params,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: uni.getStorageSync('access_token')
},
success: res => {
console.log('🚀 ~ handleEnd ~ res:', res)
},
fail: err => {
console.log('🚀 ~ handleEnd ~ err:', err)
}
})
},
// //
openPhotograph() { openPhotograph() {
this.isHide = true this.isHide = true
const that = this
setTimeout(() => { setTimeout(() => {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
@ -217,7 +268,7 @@ export default {
icon: '' icon: ''
}) })
setTimeout(() => { setTimeout(() => {
this.handleEnd() that.handleEnd()
}, 1000) }, 1000)
} }
}) })
@ -238,6 +289,7 @@ export default {
// //
getFaceRecognition(params) { getFaceRecognition(params) {
console.log('🚀 ~ getFaceRecognition ~ params:', params) console.log('🚀 ~ getFaceRecognition ~ params:', params)
const that = this
this.$verificationToken() this.$verificationToken()
uni.request({ uni.request({
url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition', url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition',
@ -291,7 +343,7 @@ export default {
icon: '' icon: ''
}) })
setTimeout(() => { setTimeout(() => {
this.handleEnd() that.handleEnd()
}, 1000) }, 1000)
} }
}) })