< video id = "{{videoData[(((aindex+1)/3)-1)]._id}}" src = "{{srcs[videoData[(((aindex+1)/3)-1)]._id]}}" class = "wxParse-video-video" poster = "{{videoData[(((aindex+1)/3)-1)].image_url}}" bindplay = "bindplay_video" data-id = "{{videoData[(((aindex+1)/3)-1)]._id}}" custom-cache = "{{false}}" > < cover-view class = "controls" bindtap = "bindplay" hidden = "{{srcs[videoData[(((aindex+1)/3)-1)]._id]}}" data-id = "{{videoData[(((aindex+1)/3)-1)]._id}}" data-src = "{{videoData[(((aindex+1)/3)-1)].videoUrl}}" > < cover-image src = "../../images/video/play.png" bindtap = "bindplay" class = "playbtn" ></ cover-image > </ cover-view > </ video > |
如题 大家忽略我里面写的 就是预览时 视频那个区域滑动不了 求解
data: {
//课程数据
articleData: null,
videoData: null,
//默认true显示推荐 点击之后变成false表示收藏 用来切换分类和推荐
RorT: true,
//下拉刷新
loading: false,
//页数
page: 1,
//防止请求发送多次 true 可以请求 false 没得数据
flag: true
},
//主题封面点击-播放视频
bindplay(e) {
video.bindplay(this, e)
},
//监听视频播放
bindplay_video(e) {
video.bindplay_video(this, e)
},
//分类推荐切换
switchType(e) {
this.setData({
RorT: e.detail.RorT
});
},
/**
* 生命周期函数–监听页面加载
*/
onLoad: function (options) {
this.requestData();
this.data.page++;
},
requestData() {
wx.showLoading({
title:“正在加载首页”,
mask:true
});
const article = courseModel.getArtCourse(this.data.page);
const video = courseModel.getVideoCourse(this.data.page);
Promise.all([article,video])
.then((res) => {
this.setData({
articleData:res[0],
videoData: res[1]
})
})
wx.hideLoading();
},
/**
* 生命周期函数–监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数–监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数–监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数–监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数–监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
page:1
})
this._lock()
this.requestData();
this._unlock();
wx.stopPullDownRefresh();
console.log(this.data.articleData);
console.log(this.data.videoData);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if(this.data.flag){
this._showLoading();
}
setTimeout(() => {
if (this.data.flag) {
this._lock();
const article = courseModel.getArtCourse(this.data.page);
const video = courseModel.getVideoCourse(this.data.page);
Promise.all([article,video])
.then((res) => {
if(res[0].length < 6 || res[1].length < 2){
console.log(‘没有更多数据’);
wx.showToast({
title: ‘没有更多数据’,
icon: ‘none’,
duration: 1500,
mask: true,
});
return;
}else{
this.setData({
articleData:this.data.articleData.concat(res[0]),
videoData:this.data.videoData.concat(res[1]),
})
this.data.page++;
this._unlock();
console.log(this.data.articleData);
console.log(this.data.videoData);
}
})
}
this._hideLoading();
}, 1500);//1.5秒之后开始加载 加载完成之后隐藏loading
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
_showLoading() {
//显示加载动画
this.setData({
loading: true
});
},
_hideLoading() {
//隐藏加载动画
this.setData({
loading: false
});
},
//防止被多次请求
_lock() {
this.setData({
flag: false
});
},
_unlock() {
this.setData({
flag: true
})
}
})