This commit is contained in:
parent
66f1e37ab4
commit
21a6266149
|
|
@ -108,10 +108,18 @@ export default {
|
|||
},
|
||||
// 视频播放时间更新
|
||||
videoTimeUpdate(e) {
|
||||
this.currentTime = Math.ceil(e.detail.currentTime)
|
||||
let newTime = Math.ceil(e.detail.currentTime)
|
||||
if (this.currentTime != newTime) {
|
||||
this.currentTime = newTime
|
||||
console.log('🚀 ~ 视频播放时间: ~ this.currentTime:', this.currentTime)
|
||||
console.log('🚀 ~ 视频总时长: ~ this.allStudyDuration:', this.allStudyDuration)
|
||||
console.log('🚀 ~ videoTimeUpdate ~ random1-2:', this.random1, this.random2)
|
||||
// 每隔 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.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() {
|
||||
this.isHide = true
|
||||
const that = this
|
||||
setTimeout(() => {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
|
|
@ -217,7 +268,7 @@ export default {
|
|||
icon: ''
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.handleEnd()
|
||||
that.handleEnd()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
|
|
@ -238,6 +289,7 @@ export default {
|
|||
// 发送请求
|
||||
getFaceRecognition(params) {
|
||||
console.log('🚀 ~ getFaceRecognition ~ params:', params)
|
||||
const that = this
|
||||
this.$verificationToken()
|
||||
uni.request({
|
||||
url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition',
|
||||
|
|
@ -291,7 +343,7 @@ export default {
|
|||
icon: ''
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.handleEnd()
|
||||
that.handleEnd()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue