推荐视频增加节流
This commit is contained in:
@@ -166,7 +166,9 @@
|
||||
'width': '750rpx',
|
||||
},
|
||||
isShowVideo: '',
|
||||
playFlag: false
|
||||
playFlag: false,
|
||||
// 延时器对象
|
||||
scrollTimer : null,
|
||||
|
||||
};
|
||||
},
|
||||
@@ -185,7 +187,13 @@
|
||||
})
|
||||
this.page = 1
|
||||
this.randomNum = Math.floor(Math.random() * 33);
|
||||
this.getDataList()
|
||||
console.log("getDataList1")
|
||||
if(this.scrollTimer != null){
|
||||
clearTimeout(this.scrollTimer);
|
||||
}
|
||||
this.scrollTimer = setTimeout(()=>{
|
||||
this.getDataList()
|
||||
}, 1000)
|
||||
},
|
||||
onHide() {
|
||||
try {
|
||||
@@ -208,6 +216,7 @@
|
||||
this.$forceUpdate()
|
||||
},
|
||||
methods: {
|
||||
|
||||
//播放时的回掉
|
||||
videoPlay(videoId,courseDetailsId) {
|
||||
this.courseDetailsId = courseDetailsId
|
||||
@@ -395,6 +404,7 @@
|
||||
token: uni.getStorageSync('token') ? uni.getStorageSync('token') : '',
|
||||
randomNum: this.randomNum
|
||||
};
|
||||
console.log("getDataList")
|
||||
httpsRequest.getT('/app/course/selectCourseDetailsList', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.pages = res.data.totalPage
|
||||
@@ -413,8 +423,11 @@
|
||||
if (this.page == 1) {
|
||||
let numIdCurr = this.videoList[0].courseDetailsId;
|
||||
this.videoContextId = 'myVideo' + numIdCurr;
|
||||
console.log(this.videoList)
|
||||
console.log(this.videoContextId)
|
||||
this.$nextTick(() => {
|
||||
this.videoContext = uni.createVideoContext(this.videoContextId, this);
|
||||
console.log("videoContext",this.videoContext)
|
||||
this.videoContext.play();
|
||||
})
|
||||
if (uni.getStorageSync('token')) { //如果有token则插入
|
||||
|
||||
Reference in New Issue
Block a user