Commit 94ce65ae66467d7b6480a1523c46a6f937f8a5ad
1 parent
efb6b05d
请求参数加live_stataus
Showing
2 changed files
with
75 additions
and
37 deletions
packageA/pages/liveStream/liveStream.js
| @@ -19,7 +19,14 @@ Page({ | @@ -19,7 +19,14 @@ Page({ | ||
| 19 | curPage: 1, | 19 | curPage: 1, |
| 20 | pageNum: 0, | 20 | pageNum: 0, |
| 21 | list: [], | 21 | list: [], |
| 22 | - live: {} | 22 | + live: { |
| 23 | + ing:[], | ||
| 24 | + toBegin:[], | ||
| 25 | + over:[] | ||
| 26 | + }, | ||
| 27 | + liveing: [], | ||
| 28 | + livetoBegin: [], | ||
| 29 | + liveOver: [] | ||
| 23 | }, | 30 | }, |
| 24 | 31 | ||
| 25 | // 点击直播列表项 | 32 | // 点击直播列表项 |
| @@ -125,6 +132,34 @@ Page({ | @@ -125,6 +132,34 @@ Page({ | ||
| 125 | }) | 132 | }) |
| 126 | }, | 133 | }, |
| 127 | 134 | ||
| 135 | + getData: function (liveStatus) { | ||
| 136 | + var that = this; | ||
| 137 | + var curPage = this.data.curPage | ||
| 138 | + getApp().request.promiseGet("/api/weshop/wx/livelist/page", { | ||
| 139 | + data: { | ||
| 140 | + storedId: o.stoid, | ||
| 141 | + page: curPage, | ||
| 142 | + live_status: liveStatus | ||
| 143 | + } | ||
| 144 | + }).then(res => { | ||
| 145 | + if (res.data.code == 0) { | ||
| 146 | + if(liveStatus == 101) { | ||
| 147 | + that.setData({ | ||
| 148 | + liveing: res.data.data.pageData | ||
| 149 | + }); | ||
| 150 | + } else if(liveStatus == 102) { | ||
| 151 | + that.setData({ | ||
| 152 | + livetoBegin: res.data.data.pageData | ||
| 153 | + }); | ||
| 154 | + } else if(liveStatus == 103) { | ||
| 155 | + that.setData({ | ||
| 156 | + liveOver: res.data.data.pageData | ||
| 157 | + }); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + } | ||
| 161 | + }); | ||
| 162 | + }, | ||
| 128 | 163 | ||
| 129 | /** | 164 | /** |
| 130 | * 生命周期函数--监听页面加载 | 165 | * 生命周期函数--监听页面加载 |
| @@ -137,10 +172,13 @@ Page({ | @@ -137,10 +172,13 @@ Page({ | ||
| 137 | * 生命周期函数--监听页面初次渲染完成 | 172 | * 生命周期函数--监听页面初次渲染完成 |
| 138 | */ | 173 | */ |
| 139 | onReady: function () { | 174 | onReady: function () { |
| 140 | - var self = this; | ||
| 141 | - this.updateLiveList().then(() => { | ||
| 142 | - self.loadLiveList(1); | ||
| 143 | - }); | 175 | + // var self = this; |
| 176 | + // this.updateLiveList().then(() => { | ||
| 177 | + // self.loadLiveList(1); | ||
| 178 | + // }); | ||
| 179 | + this.getData(101); | ||
| 180 | + this.getData(102); | ||
| 181 | + this.getData(103); | ||
| 144 | }, | 182 | }, |
| 145 | 183 | ||
| 146 | /** | 184 | /** |
| @@ -168,38 +206,38 @@ Page({ | @@ -168,38 +206,38 @@ Page({ | ||
| 168 | * 页面相关事件处理函数--监听用户下拉动作 | 206 | * 页面相关事件处理函数--监听用户下拉动作 |
| 169 | */ | 207 | */ |
| 170 | onPullDownRefresh: function () { | 208 | onPullDownRefresh: function () { |
| 171 | - var self = this; | ||
| 172 | - wx.showNavigationBarLoading(); //在标题栏中显示加载 | ||
| 173 | - setTimeout(function() { | ||
| 174 | - self.loadLiveList(1); | ||
| 175 | - wx.hideNavigationBarLoading(); //完成停止加载 | ||
| 176 | - wx.stopPullDownRefresh(); //停止下拉刷新 | ||
| 177 | - }, 500); | 209 | + // var self = this; |
| 210 | + // wx.showNavigationBarLoading(); //在标题栏中显示加载 | ||
| 211 | + // setTimeout(function() { | ||
| 212 | + // self.loadLiveList(1); | ||
| 213 | + // wx.hideNavigationBarLoading(); //完成停止加载 | ||
| 214 | + // wx.stopPullDownRefresh(); //停止下拉刷新 | ||
| 215 | + // }, 500); | ||
| 178 | }, | 216 | }, |
| 179 | /** | 217 | /** |
| 180 | * 页面上拉触底事件的处理函数 | 218 | * 页面上拉触底事件的处理函数 |
| 181 | */ | 219 | */ |
| 182 | onReachBottom: function () { | 220 | onReachBottom: function () { |
| 183 | - var self = this; | ||
| 184 | - var curPage = this.data.curPage; | ||
| 185 | - var pageNum = this.data.pageNum; | ||
| 186 | - | ||
| 187 | - if(curPage <= pageNum) { | ||
| 188 | - wx.showLoading({ | ||
| 189 | - title: '加载中...', | ||
| 190 | - }) | ||
| 191 | - setTimeout(function() { | ||
| 192 | - self.loadLiveList(curPage); | ||
| 193 | - wx.hideLoading(); | ||
| 194 | - }, 500); | 221 | + // var self = this; |
| 222 | + // var curPage = this.data.curPage; | ||
| 223 | + // var pageNum = this.data.pageNum; | ||
| 224 | + | ||
| 225 | + // if(curPage <= pageNum) { | ||
| 226 | + // wx.showLoading({ | ||
| 227 | + // title: '加载中...', | ||
| 228 | + // }) | ||
| 229 | + // setTimeout(function() { | ||
| 230 | + // self.loadLiveList(curPage); | ||
| 231 | + // wx.hideLoading(); | ||
| 232 | + // }, 500); | ||
| 195 | 233 | ||
| 196 | - } else { | ||
| 197 | - wx.showToast({ | ||
| 198 | - title: '已经到底啦~', | ||
| 199 | - duration: 1000 | ||
| 200 | - }) | ||
| 201 | - } | ||
| 202 | - console.log('当前curpage',curPage); | 234 | + // } else { |
| 235 | + // wx.showToast({ | ||
| 236 | + // title: '已经到底啦~', | ||
| 237 | + // duration: 1000 | ||
| 238 | + // }) | ||
| 239 | + // } | ||
| 240 | + // console.log('当前curpage',curPage); | ||
| 203 | }, | 241 | }, |
| 204 | 242 | ||
| 205 | /** | 243 | /** |
packageA/pages/liveStream/liveStream.wxml
| @@ -3,10 +3,10 @@ | @@ -3,10 +3,10 @@ | ||
| 3 | <view> | 3 | <view> |
| 4 | <block wx:if="{{live === '{}'}}">当前暂无直播</block> | 4 | <block wx:if="{{live === '{}'}}">当前暂无直播</block> |
| 5 | <!-- 即将开始 --> | 5 | <!-- 即将开始 --> |
| 6 | - <block wx:if="{{live.toBegin.length > 0}}"> | 6 | + <block wx:if="{{livetoBegin.length > 0}}"> |
| 7 | <view class="title">即将开始</view> | 7 | <view class="title">即将开始</view> |
| 8 | <view class="list"> | 8 | <view class="list"> |
| 9 | - <block wx:for="{{live.toBegin}}" wx:key="item"> | 9 | + <block wx:for="{{livetoBegin}}" wx:key="item"> |
| 10 | <view class="list-item" data-id="{{item.id}}" data-live="toBegin" catchtap="clickItem"> | 10 | <view class="list-item" data-id="{{item.id}}" data-live="toBegin" catchtap="clickItem"> |
| 11 | <view class="list-item-left"> | 11 | <view class="list-item-left"> |
| 12 | <image src="{{item.share_img}}" class="item-pic" mode="aspectFill"></image> | 12 | <image src="{{item.share_img}}" class="item-pic" mode="aspectFill"></image> |
| @@ -27,10 +27,10 @@ | @@ -27,10 +27,10 @@ | ||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | <!-- 直播中 --> | 29 | <!-- 直播中 --> |
| 30 | - <block wx:if="{{live.ing.length > 0}}"> | 30 | + <block wx:if="{{liveing.length > 0}}"> |
| 31 | <view class="title">直播中</view> | 31 | <view class="title">直播中</view> |
| 32 | <view class="list"> | 32 | <view class="list"> |
| 33 | - <block wx:for="{{live.ing}}" wx:key="item"> | 33 | + <block wx:for="{{liveing}}" wx:key="item"> |
| 34 | <view class="list-item" catchtap="clickItem" data-id="{{item.id}}" data-live="ing"> | 34 | <view class="list-item" catchtap="clickItem" data-id="{{item.id}}" data-live="ing"> |
| 35 | <view class="list-item-left"> | 35 | <view class="list-item-left"> |
| 36 | <image src="{{item.share_img}}" class="item-pic" mode="aspectFill"></image> | 36 | <image src="{{item.share_img}}" class="item-pic" mode="aspectFill"></image> |
| @@ -50,10 +50,10 @@ | @@ -50,10 +50,10 @@ | ||
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | <!-- 精彩回放 --> | 52 | <!-- 精彩回放 --> |
| 53 | - <block wx:if="{{live.over.length > 0}}"> | 53 | + <block wx:if="{{liveOver.length > 0}}"> |
| 54 | <view class="title">精彩回放</view> | 54 | <view class="title">精彩回放</view> |
| 55 | <view class="list"> | 55 | <view class="list"> |
| 56 | - <block wx:for="{{live.over}}" wx:key="item"> | 56 | + <block wx:for="{{liveOver}}" wx:key="item"> |
| 57 | <view class="list-item" bindtap="clickItem" data-id="{{item.id}}" data-live="over"> | 57 | <view class="list-item" bindtap="clickItem" data-id="{{item.id}}" data-live="over"> |
| 58 | <view class="list-item-left"> | 58 | <view class="list-item-left"> |
| 59 | <image src="{{item.share_img}}" class="item-pic" mode="aspectFill"></image> | 59 | <image src="{{item.share_img}}" class="item-pic" mode="aspectFill"></image> |