From 785c85b73a3408bbf3ef5d9792bcb46827fb1f97 Mon Sep 17 00:00:00 2001 From: micahh28 <1067051515@qq.com> Date: Fri, 21 Jan 2022 12:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=B2=A1=E6=9C=89=E5=8F=8A=E6=97=B6=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/pages/bookEdit/index.js | 1 + miniprogram/pages/books/books.js | 7 +++++-- miniprogram/pages/friends/friends.js | 1 - miniprogram/pages/index/index.js | 23 +++++++++++++++++------ miniprogram/pages/profile/profile.js | 14 +++++++++++--- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/miniprogram/pages/bookEdit/index.js b/miniprogram/pages/bookEdit/index.js index 0e053752..93258df8 100644 --- a/miniprogram/pages/bookEdit/index.js +++ b/miniprogram/pages/bookEdit/index.js @@ -63,6 +63,7 @@ Page({ } }, delBook() { + app.globalData.refreshRequired.home = true app.globalData.refreshRequired.book = true var that = this wx.showModal({ diff --git a/miniprogram/pages/books/books.js b/miniprogram/pages/books/books.js index e78903ad..82c3495a 100644 --- a/miniprogram/pages/books/books.js +++ b/miniprogram/pages/books/books.js @@ -53,6 +53,7 @@ Page({ var that = this switch (event.detail.name) { case '删除': + app.globalData.refreshRequired.home = true wx.showModal({ title: '删除礼簿?', content: '该礼簿所有来往记录都将被删除,确定删除?', @@ -122,8 +123,10 @@ Page({ loadData(page) { if (page == 0) { - this.data.giftBooks = [] - this.data.pageNo = 0 + this.setData({ + pageNo: 0, + giftBooks: [] + }) } this.setData({ isHideTips: app.globalData.user.tips_hide_book diff --git a/miniprogram/pages/friends/friends.js b/miniprogram/pages/friends/friends.js index a4b5c19e..1718c190 100644 --- a/miniprogram/pages/friends/friends.js +++ b/miniprogram/pages/friends/friends.js @@ -97,7 +97,6 @@ Page({ } } listTemp.push(noletter) - console.log(listTemp) let list = listTemp.filter((i) => { return i.subItems.length != 0 }) diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index bb466afa..3faa3707 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -33,8 +33,12 @@ Page({ }) .end() .then(res => { + let resTotal = 0 + if (res.list.length != 0) { + resTotal = res.list[0].total + } that.setData({ - receiveTotal: res.list[0].total.toFixed(2), + receiveTotal: resTotal.toFixed(2), }); }) @@ -50,8 +54,12 @@ Page({ }) .end() .then(res => { + let resTotal = 0 + if (res.list.length != 0) { + resTotal = res.list[0].total + } that.setData({ - giveTotal: res.list[0].total.toFixed(2), + giveTotal: resTotal.toFixed(2), }); }) }, @@ -91,8 +99,10 @@ Page({ return } if (page == 0) { - this.data.giftList = [] - this.data.pageNo = 0 + this.setData({ + giftList: [], + pageNo: 0 + }) } let that = this wx.cloud.callFunction({ @@ -151,7 +161,7 @@ Page({ onShow: function () { // 是否需要刷新 if (app.globalData.refreshRequired.home) { - this.loadData(0) + this.loadData(0); this.computedGiftTotl(); app.globalData.refreshRequired.home = false } @@ -175,7 +185,8 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - this.loadData(0) + this.loadData(0); + this.computedGiftTotl(); setTimeout(() => { wx.stopPullDownRefresh() }, 1500); diff --git a/miniprogram/pages/profile/profile.js b/miniprogram/pages/profile/profile.js index 0f87db89..28f54198 100644 --- a/miniprogram/pages/profile/profile.js +++ b/miniprogram/pages/profile/profile.js @@ -101,8 +101,12 @@ Page({ }) .end() .then(res => { + let resTotal = 0 + if (res.list.length != 0) { + resTotal = res.list[0].total + } this.setData({ - receiveTotal: res.list[0].total.toFixed(2), + receiveTotal: resTotal.toFixed(2), }); }) @@ -118,11 +122,15 @@ Page({ }) .end() .then(res => { + let resTotal = 0 + if (res.list.length != 0) { + resTotal = res.list[0].total + } this.setData({ - giveTotal: res.list[0].total.toFixed(2), + giveTotal: resTotal.toFixed(2), }); }) - app.globalData.refreshRequired.profile = false + app.globalData.refreshRequired.profile = false }, /**