代码合并

This commit is contained in:
2024-12-06 11:30:48 +08:00
14 changed files with 159 additions and 234 deletions

View File

@@ -9,6 +9,8 @@
<video :show-fullscreen-btn="false" @controlstoggle="controlstoggles" object-fit="cover"
v-if="isShowVideo == item.courseDetailsId && item.videoUrl" :play-strategy="2"
:show-loading="true" codec="software" :muted="false" :show-center-play-btn="true" :loop="true"
@timeupdate="timeupdate"
@play="videoPlay('myVideo'+item.courseDetailsId, item.courseDetailsId)"
@ended="ended" :enable-progress-gesture="false" :poster="item.titleImg"
:ref="'myVideo'+item.courseDetailsId" :id="'myVideo'+item.courseDetailsId" :src="item.videoUrl"
:autoplay="item.autoPlay" class="swipers-items-video"></video>
@@ -381,6 +383,7 @@
},
isShowVideo: '',
noBuyVideoIndex:null
playFlag: false,
};
},
onUnload() {
@@ -515,6 +518,37 @@
onClick() {
// 奖品的索引
this.$refs.dialer.run(5)
//播放时的回掉
videoPlay(videoId,courseDetailsId) {
this.courseDetailsId = courseDetailsId
if ( !this.playFlag ) {
this.playFlag = true
httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId,
courseDetailsId: courseDetailsId,
type: 'start'
}).then(res => {
console.log('播放开始')
})
}
},
//播放进度变化回掉
timeupdate(e) {
if (e.detail.currentTime > e.detail.duration*0.9) {
if ( this.playFlag) {
this.playFlag = false
httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId,
courseDetailsId: this.courseDetailsId,
type: 'end'
}).then(res => {
console.log('播放结束')
})
}
}
},
appear(e, index) {
this.current = index
@@ -821,7 +855,7 @@
//显示/隐藏适配控制器的回调
controlstoggles(e) {
this.showControls = e.detail.show
console.log(e.detail.show, '显示/隐藏控制栏')
// console.log(e.detail.show, '显示/隐藏控制栏')
},
//打开倍速弹框
openBs() {

View File

@@ -426,6 +426,7 @@
zongPrice: 0, //整部价格
countPrice: 0, //单集价格
isWxIosPay: true,
playFlag: false,
};
},
onShareAppMessage(res) {
@@ -581,7 +582,6 @@
if (e.tt_episode_id) {
this.tt_episode_id = e.tt_episode_id
}
console.log(1)
// this.$u.get('/app/common/type/817').then(res => { //是否开启购买整部视频 817
// if (res.code == 0 && res.data) {
// this.zhengbu = res.data.value;
@@ -675,7 +675,6 @@
}
// #endif
this.isVips = uni.getStorageSync('isVips') ? uni.getStorageSync('isVips') : '否'
console.log(2)
if(this.courseId){
this.getDataList(this.courseId, this.courseDetailsId);
}
@@ -1016,6 +1015,21 @@
// #ifdef H5
uni.hideLoading()
// #endif
// console.log(e.detail.currentTime)
// console.log(e.detail.duration)
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) {
@@ -1657,8 +1671,8 @@
}
}
}
// this.courseId = this.videoList[current].courseId
// this.courseDetailsId = this.videoList[current].courseDetailsId
this.courseId = this.videoList[current].courseId
this.courseDetailsId = this.videoList[current].courseDetailsId
//获取当前播放的视频在菜单数组中的位置
let scrollIndex = this.meunList.findIndex(ite => ite.courseDetailsId == this.videoList[current]
.courseDetailsId)
@@ -1689,10 +1703,12 @@
})
},
startPlay(current) {
console.log(222222)
if (this.videoContext) { //判断之前是否有视频的上下文
this.videoContext.stop()
this.videoContext = null
}
console.log(this.videoList[current])
let numIdCurr = this.videoList[current].courseDetailsId
if (this.videoList[current].videoUrl) { //已经购买可直接播放
// 播放时记录当前播放的id
@@ -1717,7 +1733,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() {

View File

@@ -8,6 +8,8 @@
<video :show-fullscreen-btn="false" @controlstoggle="controlstoggles" object-fit="cover"
v-if="current === index && item.videoUrl" :play-strategy="2" :show-loading="true"
codec="software" :muted="false" :show-center-play-btn="true" :loop="true" @ended="ended"
@timeupdate="timeupdate"
@play="videoPlay('myVideo'+item.courseDetailsId, item.courseDetailsId)"
:enable-progress-gesture="false" :poster="item.titleImg" :ref="'myVideo'+item.courseDetailsId"
:id="'myVideo'+item.courseDetailsId" :src="item.videoUrl" :autoplay="item.autoPlay"
class="swipers-items-video"></video>
@@ -358,6 +360,8 @@
payPrice: 0, //解锁价格
iosPayId: '',
isCollect: false,
playFlag: false,
};
},
computed: {
@@ -491,6 +495,38 @@
}
},
methods: {
//播放时的回掉
videoPlay(videoId,courseDetailsId) {
this.courseDetailsId = courseDetailsId
if ( !this.playFlag ) {
this.playFlag = true
httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId,
courseDetailsId: courseDetailsId,
type: 'start'
}).then(res => {
console.log('播放开始')
})
}
},
//播放进度变化回掉
timeupdate(e) {
if (e.detail.currentTime > e.detail.duration*0.9) {
if ( this.playFlag) {
this.playFlag = false
httpsRequest.getT('app/course/viewCourse', {
courseId: this.courseId,
courseDetailsId: this.courseDetailsId,
type: 'end'
}).then(res => {
console.log('播放结束')
})
}
}
},
//选集弹窗的回调
changeXj(e) {
if (e.show == false) {