Skip to content

Commit

Permalink
修复 删除操作没有及时刷新的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Chadwuo committed Jan 21, 2022
1 parent ee0bbb6 commit 785c85b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
1 change: 1 addition & 0 deletions miniprogram/pages/bookEdit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Page({
}
},
delBook() {
app.globalData.refreshRequired.home = true
app.globalData.refreshRequired.book = true
var that = this
wx.showModal({
Expand Down
7 changes: 5 additions & 2 deletions miniprogram/pages/books/books.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Page({
var that = this
switch (event.detail.name) {
case '删除':
app.globalData.refreshRequired.home = true
wx.showModal({
title: '删除礼簿?',
content: '该礼簿所有来往记录都将被删除,确定删除?',
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion miniprogram/pages/friends/friends.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ Page({
}
}
listTemp.push(noletter)
console.log(listTemp)
let list = listTemp.filter((i) => {
return i.subItems.length != 0
})
Expand Down
23 changes: 17 additions & 6 deletions miniprogram/pages/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
})

Expand All @@ -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),
});
})
},
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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
}
Expand All @@ -175,7 +185,8 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.loadData(0)
this.loadData(0);
this.computedGiftTotl();
setTimeout(() => {
wx.stopPullDownRefresh()
}, 1500);
Expand Down
14 changes: 11 additions & 3 deletions miniprogram/pages/profile/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
})

Expand All @@ -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
},

/**
Expand Down

0 comments on commit 785c85b

Please sign in to comment.