Commit c92090d3 authored by 林文清's avatar 林文清

fix:视频进度fix

parent 9c495f30
......@@ -409,7 +409,6 @@ export default {
isReflesh: true,
triggered: false,
_freshing: false,
isOnLoad: 0
};
},
onLoad(param) {
......@@ -427,14 +426,13 @@ export default {
},
},
onShow: function (param) {
this.isOnLoad = 1;
try {
if (param.tabs) {
this.current = param.tabs;
this.swiperCurrent = param.tabs;
}
} catch (e) {}
if (this.current == 1 ||this.current == 2 || this.current == 3) {
if (this.current == 2 || this.current == 3) {
this.tabsChange(this.current);
}
},
......
......@@ -6,7 +6,7 @@
<view class="uni-padding-wrap uni-common-mt">
<view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc"
:options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback"
@ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" autoplay="true"
@ready="playerReadied" @timeupdate="onPlayerTimeupdate($event)" @ended="setLearned()" autoplay="true"
controls></video></view>
<view class="title-content">
<view class="item-content">
......@@ -149,6 +149,16 @@
this.scrollValue = 0
}
},
setLearned() {
let param = {
section_id: this.section_id,
video_time: this.videoTotalTime,
status: 1
};
this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => {
console.log(err)
});
},
onPlayerTimeupdate(player) {
let intCurrentTime = parseInt(player.detail.currentTime);
this.updateLearnedStatus(intCurrentTime)
......@@ -247,20 +257,17 @@
video_time: nowTime,
status: this.status
};
nowTime = parseInt(nowTime);
if(nowTime == this.nowTime){
return
}
this.nowTime = nowTime;
if(this.status == 1 || nowTime < 5){
if(nowTime % this.howTimeToUpdateLearnedStatus != 0){
//固定时间更新一次
return
}
if(nowTime == this.videoTotalTime){
param.status = this.status = 1
}else if(nowTime % this.howTimeToUpdateLearnedStatus != 0){
return
}else{
param.status = 0;
if(this.status == 1){
//已学再学时间设置为结束时间
param.video_time = this.videoTotalTime
}
this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => {
console.log(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment