From f6a5aae77ecbb705919b8226fbf48dfd1d6fc1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=8F=B6?= Date: Thu, 10 Feb 2022 10:21:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=81=E5=9F=9F=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/siyutong/activityDetail/index.wxml | 4 +- pages/siyutong/index.js | 51 +++++++++++++++++------- pages/siyutong/index.wxml | 42 +++++++------------ 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/pages/siyutong/activityDetail/index.wxml b/pages/siyutong/activityDetail/index.wxml index c3304be..bdd29a7 100644 --- a/pages/siyutong/activityDetail/index.wxml +++ b/pages/siyutong/activityDetail/index.wxml @@ -6,7 +6,7 @@ 活动内容 {{info.remark}} - + 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 41338f2..5b6f547 100644 --- a/pages/siyutong/index.wxml +++ b/pages/siyutong/index.wxml @@ -2,43 +2,29 @@ - + + + - - - - - - - {{it.title}} - - {{it.type_name}} - - - - - - - - - - - + + + {{item.title}} + + {{item.type_name}} + + - + + + \ No newline at end of file