xz_angren/pages/broadcastList/broadcastList.js
2020-06-30 11:24:06 +08:00

182 lines
3.5 KiB
JavaScript

// pages/broadcastList/broadcastList.js
<<<<<<< HEAD
var app = getApp();
=======
>>>>>>> master
Page({
/**
* 页面的初始数据
*/
data: {
<<<<<<< HEAD
liveUrl: app.liveUrl,
liveRecordUrl: app.liveRecordUrl,
liveRecordSrc: null,
livePlanId: '',
liveRecoreList: [],
videoContext: null,
currentPage: 1,
rows: 20,
isPlay: false
},
getLivePlanRecordList: function(page) {
var self = this;
app.dialog.loading('正在加载');
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liverecord/listpageliverecordrelease/{planId}', [self.data.liveUrl, self.data.livePlanId]), {
page: page,
rows: self.data.rows
}, null, function(code, data) {
if(data.rows.length == 0) {
app.dialog.msg('暂无数据');
return;
}
var liveRecoreArray;
if(page <= 1) {
liveRecoreArray = data.rows;
} else {
liveRecoreArray = self.data.liveRecoreList;
liveRecoreArray = liveRecoreArray.concat(data.rows);
}
self.setData({
currentPage: page,
'liveRecoreList': liveRecoreArray
})
}, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
wx.stopPullDownRefresh();
wx.hideLoading();
})
},
doChangeSrc: function(event) {
var self = this;
self.setData({
liveRecordSrc: event.currentTarget.dataset.liveRecordSrc
})
self.videoContext.play({
success: function() {
self.setData({
isPlay: true
})
}
});
},
onPlayStateChange: function(event) {
console.log(event.detail.code)
},
=======
},
>>>>>>> master
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
<<<<<<< HEAD
this.videoContext = wx.createLivePlayerContext('liveRecordVideo');
this.setData({
livePlanId: options.livePlanId
})
this.getLivePlanRecordList(1);
},
doPlay: function() {
var self = this;
if(!self.data.liveRecordSrc) {
if(self.data.liveRecoreList.length == 0) {
app.dialog.msg('无播放内容');
return;
}
self.setData({
liveRecordSrc : self.data.liveRecoreList[0].recordFilePath
});
self.videoContext.play({
success: function() {
self.setData({
isPlay: true
})
}
});
} else {
self.videoContext.play({
success: function() {
self.setData({
isPlay: true
})
}
});
}
},
doStop: function() {
var self = this;
self.videoContext.pause({
success: function() {
self.setData({
isPlay: false
})
}
});
},
=======
},
>>>>>>> master
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
<<<<<<< HEAD
this.getLivePlanRecordList(1);
=======
>>>>>>> master
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
<<<<<<< HEAD
this.getLivePlanRecordList(this.data.currentPage + 1);
=======
>>>>>>> master
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})