diff --git a/packageA/pages/liveStream/liveStream.js b/packageA/pages/liveStream/liveStream.js index 692ff28..ae9bee8 100644 --- a/packageA/pages/liveStream/liveStream.js +++ b/packageA/pages/liveStream/liveStream.js @@ -18,16 +18,16 @@ Page({ data: { curPage: 1, pageNum: 0, - list: [], - live: { - ing:[], - toBegin:[], - over:[] - }, liveing: [], livetoBegin: [], liveOver: [] }, + // list: [], + // live: { + // ing:[], + // toBegin:[], + // over:[] + // }, // 点击直播列表项 clickItem: function (e) { @@ -69,10 +69,10 @@ Page({ loadLiveList: function (curPage) { // console.log('---->curPage', curPage); - var live = {}; - live.toBegin = []; // 即将开始 - live.ing = []; // 直播中 - live.over = []; // 已结束 + // var live = {}; + // live.toBegin = []; // 即将开始 + // live.ing = []; // 直播中 + // var liveOver = []; // 已结束 var that = this; var storeId = o.stoid; @@ -80,7 +80,8 @@ Page({ getApp().request.promiseGet("/api/weshop/wx/livelist/page", { data: { storedId: storeId, - page: curPage + page: curPage, + live_status: 103 } }).then(res => { if (res.data.code == 0) { @@ -88,6 +89,7 @@ Page({ var total = res.data.data.total; var pageSize = res.data.data.pageSize; var pageNum = total % pageSize; + that.setData({ pageNum: pageNum }); @@ -95,31 +97,31 @@ Page({ // 如果当前请求的是第一页数据,则执行赋值,否则执行合并再赋值 if(curPage == 1) { that.setData({ - list: res.data.data.pageData + liveOver: res.data.data.pageData // 测试 - // list: that.data.list.concat(res.data.data.pageData) + // liveOver: that.data.liveOver.concat(res.data.data.pageData) }); } else { that.setData({ - list: that.data.list.concat(res.data.data.pageData) + liveOver: that.data.liveOver.concat(res.data.data.pageData) }); }; - var list = that.data.list; - for(var i in list) { - var liveStatus = list[i].live_status; - if (liveStatus == '101') { - live.ing.push(list[i]); - } else if (liveStatus == '102') { - live.toBegin.push(list[i]); - } else if (liveStatus == '103') { - live.over.push(list[i]); - } - } + // var list = that.data.list; + // for(var i in list) { + // var liveStatus = list[i].live_status; + // if (liveStatus == '101') { + // live.ing.push(list[i]); + // } else if (liveStatus == '102') { + // live.toBegin.push(list[i]); + // } else if (liveStatus == '103') { + // live.over.push(list[i]); + // } + // } - that.setData({ - live - }); + // that.setData({ + // liveOver: list + // }); curPage ++; that.setData({ @@ -182,9 +184,6 @@ Page({ self.getData(102); self.getData(103); }); - // this.getData(101); - // this.getData(102); - // this.getData(103); }, /** @@ -224,26 +223,26 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - // var self = this; - // var curPage = this.data.curPage; - // var pageNum = this.data.pageNum; + var self = this; + var curPage = this.data.curPage; + var pageNum = this.data.pageNum; - // if(curPage <= pageNum) { - // wx.showLoading({ - // title: '加载中...', - // }) - // setTimeout(function() { - // self.loadLiveList(curPage); - // wx.hideLoading(); - // }, 500); + if(curPage <= pageNum) { + wx.showLoading({ + title: '加载中...', + }) + setTimeout(function() { + self.loadLiveList(1); + wx.hideLoading(); + }, 500); - // } else { - // wx.showToast({ - // title: '已经到底啦~', - // duration: 1000 - // }) - // } - // console.log('当前curpage',curPage); + } else { + wx.showToast({ + title: '已经到底啦~', + duration: 1000 + }) + } + console.log('当前curpage',curPage, pageNum); }, /** diff --git a/packageA/pages/liveStream/liveStream.json b/packageA/pages/liveStream/liveStream.json index 0186e3c..4c7ef05 100644 --- a/packageA/pages/liveStream/liveStream.json +++ b/packageA/pages/liveStream/liveStream.json @@ -3,9 +3,7 @@ "subscribe": "plugin-private://wx2b03c6e691cd7370/components/subscribe/subscribe" }, "navigationBarTitleText": "直播", - "enablePullDownRefresh": true, - "backgroundColor": "#eee", - "backgroundTextStyle": "dark", "onReachBottomDistance": 300 } + \ No newline at end of file