From 0a5115b8f4dc8bb70afa3ef61a3fa96ec91cd01d Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Mon, 24 Aug 2020 15:13:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF=E6=97=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pageD/activity/activity.vue | 10 ++++---- pageD/logistics/logistics.vue | 44 ++++++++++++++++++++++++++++------- pageD/notice/notice.vue | 4 ++++ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/pageD/activity/activity.vue b/pageD/activity/activity.vue index 0ad1ed7..65645d3 100644 --- a/pageD/activity/activity.vue +++ b/pageD/activity/activity.vue @@ -15,6 +15,7 @@ + @@ -23,9 +24,8 @@ data() { return { height:'600', - actives: [ - - ] + actives: [], + loadStatus: 'loadmore' }; }, onLoad(){ @@ -45,7 +45,9 @@ messageactivityList(){ this.$u.api.messageactivityList({}).then((res)=>{ if (res.errCode == 0) { - this.actives = res.data; + this.actives = res.data; + // 目前没有分页,只无数据提示用,他们建议这样做 + if(!this.actives.length) this.loadStatus = 'nomore'; } }) } diff --git a/pageD/logistics/logistics.vue b/pageD/logistics/logistics.vue index 7eabb61..3ce9c8e 100644 --- a/pageD/logistics/logistics.vue +++ b/pageD/logistics/logistics.vue @@ -18,6 +18,7 @@ + @@ -26,20 +27,45 @@ data() { return { actives: [], - page: 1 + page: 1, + timer: true, + loadStatus: 'loadmore' }; }, onLoad() { this.getCartList(); - }, + }, + onReachBottom() { + this.loadmore(); + }, methods: { - getCartList() { - this.$u.post("message/orderDeliveryList",{page: this.page}).then(res => { - console.log(res.data.data) - if (res.errCode == 0) { - this.actives = res.data.data; - } - }) + loadmore() { + if(!this.timer) return false; + this.loadStatus = "loading"; + this.page++; + this.getCartList({ load: 'loadmore' }).then(length => { + if(length == 0) { + this.page--; + this.loadStatus = 'nomore'; + } else { + this.loadStatus = 'loading'; + } + }).catch(() => { + this.loadStatus = "nomore"; + this.page--; + }) + }, + async getCartList({ load = 'reload' } = {}) { + const res = await this.$u.post("message/orderDeliveryList",{ page: this.page }) + this.timer = true; + if (res.errCode == 0) { + if(load == 'reload') { + this.actives = res.data.data; + if(res.data.data.length < 12) this.loadStatus = "nomore"; + } + else if(load == 'loadmore') this.actives.push(...res.data.data); + } + return res.data.data.length; }, viewLogistics(item) { let url; diff --git a/pageD/notice/notice.vue b/pageD/notice/notice.vue index 4c7d154..d4eaed5 100644 --- a/pageD/notice/notice.vue +++ b/pageD/notice/notice.vue @@ -2,6 +2,7 @@ + @@ -11,6 +12,7 @@ data() { return { list: [], + loadStatus: 'loadmore' }; }, onLoad() { @@ -29,6 +31,8 @@ this.$u.api.informationList({}).then((res) => { if (res.errCode == 0) { this.list = res.data; + // 目前没有分页,只无数据提示用 + if(!this.list.length) this.loadStatus = 'nomore'; } }) }