推荐视频播放统计

This commit is contained in:
GaoHao
2024-12-06 14:23:53 +08:00
parent d85b101e30
commit f77d4b60f9
7 changed files with 115 additions and 14 deletions

View File

@@ -202,6 +202,8 @@
showControls: true, //是否显示控制中心
timerCon: null,
randomNum: 0,
playFlag: false,
};
},
computed: {
@@ -323,6 +325,7 @@
if (e.id) {
this.courseId = e.id
}
console.log(e)
if (e.courseDetailsId) {
this.courseDetailsId = e.courseDetailsId
}
@@ -485,6 +488,18 @@
// #ifdef H5
uni.hideLoading()
// #endif
if (e.detail.currentTime > e.detail.duration*0.9) {
if ( this.playFlag) {
this.playFlag = false
this.$Request.getT('app/course/viewCourse', {
courseId: this.courseId,
courseDetailsId: this.courseDetailsId,
type: 'end'
}).then(res => {
console.log('播放结束')
})
}
}
},
//缓冲中
waiting(e) {
@@ -681,6 +696,8 @@
}
if (this.page == 1) {
let numIdCurr = this.videoList[0].courseDetailsId;
this.courseId = this.videoList[0].courseId
this.courseDetailsId = this.videoList[0].courseDetailsId;
this.videoContextId = 'myVideo' + numIdCurr;
this.$nextTick(() => {
@@ -816,6 +833,8 @@
}
}
}
this.courseId = this.videoList[current].courseId
this.courseDetailsId = this.videoList[current].courseDetailsId
//获取当前播放的视频在菜单数组中的位置
let scrollIndex = this.meunList.findIndex(ite => ite.courseDetailsId == this.videoList[current]
.courseDetailsId);
@@ -860,7 +879,14 @@
},
//在播放时候的回调
videoPlay(videoId) {
this.$Request.getT('app/course/viewCourse', {
courseId: this.courseId,
courseDetailsId: this.courseDetailsId,
type: 'start'
}).then(res => {
this.playFlag = true
console.log('播放开始')
})
},
//监听视频播放完成
ended() {