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

fix:视频进度fix

parent 9c495f30
...@@ -409,7 +409,6 @@ export default { ...@@ -409,7 +409,6 @@ export default {
isReflesh: true, isReflesh: true,
triggered: false, triggered: false,
_freshing: false, _freshing: false,
isOnLoad: 0
}; };
}, },
onLoad(param) { onLoad(param) {
...@@ -427,14 +426,13 @@ export default { ...@@ -427,14 +426,13 @@ export default {
}, },
}, },
onShow: function (param) { onShow: function (param) {
this.isOnLoad = 1;
try { try {
if (param.tabs) { if (param.tabs) {
this.current = param.tabs; this.current = param.tabs;
this.swiperCurrent = param.tabs; this.swiperCurrent = param.tabs;
} }
} catch (e) {} } catch (e) {}
if (this.current == 1 ||this.current == 2 || this.current == 3) { if (this.current == 2 || this.current == 3) {
this.tabsChange(this.current); this.tabsChange(this.current);
} }
}, },
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view class="uni-padding-wrap uni-common-mt"> <view class="uni-padding-wrap uni-common-mt">
<view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc" <view><video object-fit="cover" class="course-video" id="courseVideo" :src="courseSrc"
:options="playerOptions" :playsinline="true" @play="playCourse" @error="videoErrorCallback" :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> controls></video></view>
<view class="title-content"> <view class="title-content">
<view class="item-content"> <view class="item-content">
...@@ -149,6 +149,16 @@ ...@@ -149,6 +149,16 @@
this.scrollValue = 0 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) { onPlayerTimeupdate(player) {
let intCurrentTime = parseInt(player.detail.currentTime); let intCurrentTime = parseInt(player.detail.currentTime);
this.updateLearnedStatus(intCurrentTime) this.updateLearnedStatus(intCurrentTime)
...@@ -247,20 +257,17 @@ ...@@ -247,20 +257,17 @@
video_time: nowTime, video_time: nowTime,
status: this.status status: this.status
}; };
nowTime = parseInt(nowTime);
if(nowTime == this.nowTime){ if(nowTime == this.nowTime){
return return
} }
this.nowTime = nowTime; this.nowTime = nowTime;
if(this.status == 1 || nowTime < 5){ if(nowTime % this.howTimeToUpdateLearnedStatus != 0){
//固定时间更新一次
return return
} }
if(nowTime == this.videoTotalTime){ if(this.status == 1){
param.status = this.status = 1 //已学再学时间设置为结束时间
}else if(nowTime % this.howTimeToUpdateLearnedStatus != 0){ param.video_time = this.videoTotalTime
return
}else{
param.status = 0;
} }
this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => { this.$u.api.updateLearnCourses(param).then((res) => {}).catch((err) => {
console.log(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