xi_sangzhuzi/pages/broadcast/broadcast.js

105 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-06-23 19:14:44 +08:00
// pages/broadcast/broadcast.js
2020-06-26 19:32:52 +08:00
var app = getApp();
2020-06-23 19:14:44 +08:00
Page({
/**
* 页面的初始数据
*/
data: {
2020-06-26 19:32:52 +08:00
live: {
liveUrl: app.liveUrl,
liveList: []
},
currentPage: 1,
rows: 10
},
doGetLiveList: function(page) {
var self = this;
app.dialog.loading('正在加载');
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liveplan/listpageliveplanrelease', [self.data.live.liveUrl]), {
page: page,
rows: self.data.rows
}, null, function(code, data) {
if(data.rows.length == 0) {
app.dialog.msg('暂无数据');
return;
}
var liveArray;
if(page <= 1) {
liveArray = data.rows;
} else {
liveArray = self.data.live.liveList;
liveArray = liveArray.concat(data.rows);
}
self.setData({
currentPage: page,
'live.liveList': liveArray
})
}, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
wx.stopPullDownRefresh();
wx.hideLoading();
});
2020-06-23 19:14:44 +08:00
},
2020-06-26 19:32:52 +08:00
goDetail: function (event) {
2020-06-23 19:14:44 +08:00
wx.navigateTo({
2020-06-26 19:32:52 +08:00
url: '../broadcastDetail/broadcastDetail?livePlanId='+ event.currentTarget.dataset.livePlanId,
2020-06-23 19:14:44 +08:00
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
2020-06-26 19:32:52 +08:00
var self = this;
self.doGetLiveList(1);
2020-06-23 19:14:44 +08:00
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
2020-06-26 19:32:52 +08:00
this.doGetLiveList(1);
2020-06-23 19:14:44 +08:00
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
2020-06-26 19:32:52 +08:00
this.doGetLiveList(this.data.currentPage + 1);
2020-06-23 19:14:44 +08:00
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})