diff --git a/pages/siyutong/index.js b/pages/siyutong/index.js index 32470b3..6b74797 100644 --- a/pages/siyutong/index.js +++ b/pages/siyutong/index.js @@ -17,6 +17,11 @@ Page({ }, swiperCurrent: 0, list: [], + pageNo: 1, + noData: false, + end: false, + load: true, + loading: false, }, //生命周期函数--监听页面加载 @@ -49,13 +54,29 @@ Page({ //活动列表 getAppSytactivityList(){ + this.setData({ + load: false, + loading: true, + }) let params = {}; - params['page'] = 1; - params['size'] = 100; + params['page'] = this.data.pageNo; + params['size'] = 10; _.apiQuery.getAppSytactivityList(params).then(res => { this.setData({ - list: this.getIconByGroup(res.data.list), + pageNo: this.data.pageNo + 1, + list: this.data.list.concat(res.data.list), + load: true, + loading: false, }) + if (res.data.total == 0) { + this.setData({ + noData: true + }) + } else if (this.data.list.length>10&&this.data.list.length == res.data.total) { + this.setData({ + end: true + }) + } wx.stopPullDownRefresh() }); }, @@ -88,23 +109,23 @@ Page({ }, //页面相关事件处理函数--监听用户下拉动作 - onPullDownRefresh: function () { + onPullDownRefresh(){ this.setData({ - swiperOptions: { - indicatorDots: false, - vertical: false, - autoplay: false, - interval: 4000, - duration: 1000, - items: 1, - circular: false, - current: 0 - }, - swiperCurrent: 0, list: [], + pageNo: 1, + noData: false, + end: false, + load: true, + loading: false, }) this.getAppSytactivityTabs() this.getAppSytactivityList() }, + //页面上拉触底事件的处理函数 + onReachBottom(){ + if (this.data.noData || this.data.end||!this.data.load) return; + this.getAppSytactivityList() + }, + }) \ No newline at end of file diff --git a/pages/siyutong/index.wxml b/pages/siyutong/index.wxml index fafffb8..5b6f547 100644 --- a/pages/siyutong/index.wxml +++ b/pages/siyutong/index.wxml @@ -1,4 +1,4 @@ - + @@ -10,35 +10,21 @@ --> - + + - - - - - - - {{it.title}} - - {{it.type_name}} - - - - - - - - - - - + + + {{item.title}} + + {{item.type_name}} + + - + + + \ No newline at end of file