// pages/broadcastList/broadcastList.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { liveRecordContentUrl: app.newsContentUrl, liveUrl: app.liveUrl, liveRecordUrl: app.liveRecordUrl, livePlanId: null, page: 1, rows: 20, liveRecordList: [], videoPath: '' }, getLivePlanRecordList: function () { var self = this app.restAjax.get(app.restAjax.path('{liveUrl}/app/liverecord/listpageliverecordrelease/' + self.data.livePlanId, [app.liveUrl]), { page: self.data.page, rows: self.data.rows }, null, function (code, data) { if (data.rows.length > 0) { self.setData({ liveRecordList: data.rows }) } else { wx.showToast({ title: '暂无更多', icon: "none", duration: 1500 }) } if (self.data.page == 1) { self.setData({ videoPath: data.rows[0].recordFilePath }) } } ) }, playVideo: function (e) { this.setData({ videoPath: e.currentTarget.dataset.url }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ livePlanId: options.livePlanId }) this.getLivePlanRecordList(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { this.setData({ page: this.data.page + 1 }) this.getLivePlanRecordList() }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.setData({ page: this.data.page + 1 }) this.getLivePlanRecordList() }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })