Commit be4dd06f36ff1b08c87a0b0afa1d25ea31d44e27

Authored by 后端研发-倪永富
1 parent 533368ee

上拉加载更多回放

packageA/pages/liveStream/liveStream.js
... ... @@ -18,16 +18,16 @@ Page({
18 18 data: {
19 19 curPage: 1,
20 20 pageNum: 0,
21   - list: [],
22   - live: {
23   - ing:[],
24   - toBegin:[],
25   - over:[]
26   - },
27 21 liveing: [],
28 22 livetoBegin: [],
29 23 liveOver: []
30 24 },
  25 + // list: [],
  26 + // live: {
  27 + // ing:[],
  28 + // toBegin:[],
  29 + // over:[]
  30 + // },
31 31  
32 32 // 点击直播列表项
33 33 clickItem: function (e) {
... ... @@ -69,10 +69,10 @@ Page({
69 69  
70 70 loadLiveList: function (curPage) {
71 71 // console.log('---->curPage', curPage);
72   - var live = {};
73   - live.toBegin = []; // 即将开始
74   - live.ing = []; // 直播中
75   - live.over = []; // 已结束
  72 + // var live = {};
  73 + // live.toBegin = []; // 即将开始
  74 + // live.ing = []; // 直播中
  75 + // var liveOver = []; // 已结束
76 76 var that = this;
77 77 var storeId = o.stoid;
78 78  
... ... @@ -80,7 +80,8 @@ Page({
80 80 getApp().request.promiseGet("/api/weshop/wx/livelist/page", {
81 81 data: {
82 82 storedId: storeId,
83   - page: curPage
  83 + page: curPage,
  84 + live_status: 103
84 85 }
85 86 }).then(res => {
86 87 if (res.data.code == 0) {
... ... @@ -88,6 +89,7 @@ Page({
88 89 var total = res.data.data.total;
89 90 var pageSize = res.data.data.pageSize;
90 91 var pageNum = total % pageSize;
  92 +
91 93 that.setData({
92 94 pageNum: pageNum
93 95 });
... ... @@ -95,31 +97,31 @@ Page({
95 97 // 如果当前请求的是第一页数据,则执行赋值,否则执行合并再赋值
96 98 if(curPage == 1) {
97 99 that.setData({
98   - list: res.data.data.pageData
  100 + liveOver: res.data.data.pageData
99 101 // 测试
100   - // list: that.data.list.concat(res.data.data.pageData)
  102 + // liveOver: that.data.liveOver.concat(res.data.data.pageData)
101 103 });
102 104 } else {
103 105 that.setData({
104   - list: that.data.list.concat(res.data.data.pageData)
  106 + liveOver: that.data.liveOver.concat(res.data.data.pageData)
105 107 });
106 108 };
107 109  
108   - var list = that.data.list;
109   - for(var i in list) {
110   - var liveStatus = list[i].live_status;
111   - if (liveStatus == '101') {
112   - live.ing.push(list[i]);
113   - } else if (liveStatus == '102') {
114   - live.toBegin.push(list[i]);
115   - } else if (liveStatus == '103') {
116   - live.over.push(list[i]);
117   - }
118   - }
  110 + // var list = that.data.list;
  111 + // for(var i in list) {
  112 + // var liveStatus = list[i].live_status;
  113 + // if (liveStatus == '101') {
  114 + // live.ing.push(list[i]);
  115 + // } else if (liveStatus == '102') {
  116 + // live.toBegin.push(list[i]);
  117 + // } else if (liveStatus == '103') {
  118 + // live.over.push(list[i]);
  119 + // }
  120 + // }
119 121  
120   - that.setData({
121   - live
122   - });
  122 + // that.setData({
  123 + // liveOver: list
  124 + // });
123 125  
124 126 curPage ++;
125 127 that.setData({
... ... @@ -182,9 +184,6 @@ Page({
182 184 self.getData(102);
183 185 self.getData(103);
184 186 });
185   - // this.getData(101);
186   - // this.getData(102);
187   - // this.getData(103);
188 187 },
189 188  
190 189 /**
... ... @@ -224,26 +223,26 @@ Page({
224 223 * 页面上拉触底事件的处理函数
225 224 */
226 225 onReachBottom: function () {
227   - // var self = this;
228   - // var curPage = this.data.curPage;
229   - // var pageNum = this.data.pageNum;
  226 + var self = this;
  227 + var curPage = this.data.curPage;
  228 + var pageNum = this.data.pageNum;
230 229  
231   - // if(curPage <= pageNum) {
232   - // wx.showLoading({
233   - // title: '加载中...',
234   - // })
235   - // setTimeout(function() {
236   - // self.loadLiveList(curPage);
237   - // wx.hideLoading();
238   - // }, 500);
  230 + if(curPage <= pageNum) {
  231 + wx.showLoading({
  232 + title: '加载中...',
  233 + })
  234 + setTimeout(function() {
  235 + self.loadLiveList(1);
  236 + wx.hideLoading();
  237 + }, 500);
239 238  
240   - // } else {
241   - // wx.showToast({
242   - // title: '已经到底啦~',
243   - // duration: 1000
244   - // })
245   - // }
246   - // console.log('当前curpage',curPage);
  239 + } else {
  240 + wx.showToast({
  241 + title: '已经到底啦~',
  242 + duration: 1000
  243 + })
  244 + }
  245 + console.log('当前curpage',curPage, pageNum);
247 246 },
248 247  
249 248 /**
... ...
packageA/pages/liveStream/liveStream.json
... ... @@ -3,9 +3,7 @@
3 3 "subscribe": "plugin-private://wx2b03c6e691cd7370/components/subscribe/subscribe"
4 4 },
5 5 "navigationBarTitleText": "直播",
6   - "enablePullDownRefresh": true,
7   - "backgroundColor": "#eee",
8   - "backgroundTextStyle": "dark",
9 6 "onReachBottomDistance": 300
10 7 }
  8 +
11 9  
12 10 \ No newline at end of file
... ...