From 94ce65ae66467d7b6480a1523c46a6f937f8a5ad Mon Sep 17 00:00:00 2001 From: taiyuan Date: Wed, 15 Jul 2020 14:56:14 +0800 Subject: [PATCH] 请求参数加live_stataus --- packageA/pages/liveStream/liveStream.js | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- packageA/pages/liveStream/liveStream.wxml | 12 ++++++------ 2 files changed, 75 insertions(+), 37 deletions(-) diff --git a/packageA/pages/liveStream/liveStream.js b/packageA/pages/liveStream/liveStream.js index 4fa2d01..c08200d 100644 --- a/packageA/pages/liveStream/liveStream.js +++ b/packageA/pages/liveStream/liveStream.js @@ -19,7 +19,14 @@ Page({ curPage: 1, pageNum: 0, list: [], - live: {} + live: { + ing:[], + toBegin:[], + over:[] + }, + liveing: [], + livetoBegin: [], + liveOver: [] }, // 点击直播列表项 @@ -125,6 +132,34 @@ Page({ }) }, + getData: function (liveStatus) { + var that = this; + var curPage = this.data.curPage + getApp().request.promiseGet("/api/weshop/wx/livelist/page", { + data: { + storedId: o.stoid, + page: curPage, + live_status: liveStatus + } + }).then(res => { + if (res.data.code == 0) { + if(liveStatus == 101) { + that.setData({ + liveing: res.data.data.pageData + }); + } else if(liveStatus == 102) { + that.setData({ + livetoBegin: res.data.data.pageData + }); + } else if(liveStatus == 103) { + that.setData({ + liveOver: res.data.data.pageData + }); + } + + } + }); + }, /** * 生命周期函数--监听页面加载 @@ -137,10 +172,13 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { - var self = this; - this.updateLiveList().then(() => { - self.loadLiveList(1); - }); + // var self = this; + // this.updateLiveList().then(() => { + // self.loadLiveList(1); + // }); + this.getData(101); + this.getData(102); + this.getData(103); }, /** @@ -168,38 +206,38 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - var self = this; - wx.showNavigationBarLoading(); //在标题栏中显示加载 - setTimeout(function() { - self.loadLiveList(1); - wx.hideNavigationBarLoading(); //完成停止加载 - wx.stopPullDownRefresh(); //停止下拉刷新 - }, 500); + // var self = this; + // wx.showNavigationBarLoading(); //在标题栏中显示加载 + // setTimeout(function() { + // self.loadLiveList(1); + // wx.hideNavigationBarLoading(); //完成停止加载 + // wx.stopPullDownRefresh(); //停止下拉刷新 + // }, 500); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - 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); + // 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); - } else { - wx.showToast({ - title: '已经到底啦~', - duration: 1000 - }) - } - console.log('当前curpage',curPage); + // } else { + // wx.showToast({ + // title: '已经到底啦~', + // duration: 1000 + // }) + // } + // console.log('当前curpage',curPage); }, /** diff --git a/packageA/pages/liveStream/liveStream.wxml b/packageA/pages/liveStream/liveStream.wxml index f315143..76d269b 100644 --- a/packageA/pages/liveStream/liveStream.wxml +++ b/packageA/pages/liveStream/liveStream.wxml @@ -3,10 +3,10 @@ 当前暂无直播 - + 即将开始 - + @@ -27,10 +27,10 @@ - + 直播中 - + @@ -50,10 +50,10 @@ - + 精彩回放 - + -- libgit2 0.21.4