This commit is contained in:
zengBin 2024-10-09 16:31:57 +08:00
parent d14beeda94
commit 0e33b23f52

View File

@ -1029,23 +1029,27 @@ wepy.page({
vm.loginShow = true vm.loginShow = true
return return
} }
vm.$showLoading('') if (vm.throttle) {
vm.$post({url: `${service.host}/follow/user/${vm.id}`}).then(({code, data}) => { vm.throttle = false
if (code == 0) { vm.$post({url: `${service.host}/follow/user/${vm.id}`}).then(({code, data}) => {
if (data.is_followed) { if (code == 0) {
vm.$showToast(`已关注`) if (!vm.userInfo.base_profile.is_followed) {
vm.userInfo.is_followed = true vm.$showToast(`已关注`)
vm.userInfo.fans_count = vm.userInfo.fans_count + 1 vm.userInfo.base_profile.is_followed = true
} else { vm.userInfo.base_profile.fans_count = vm.userInfo.base_profile.fans_count + 1
vm.userInfo.is_followed = false } else {
vm.userInfo.fans_count = vm.userInfo.fans_count - 1 vm.userInfo.base_profile.is_followed = false
vm.$showToast(`已取消关注`) vm.userInfo.base_profile.fans_count = vm.userInfo.base_profile.fans_count - 1
vm.$showToast(`已取消关注`)
}
} }
} vm.throttle = true
wx.hideLoading() wx.hideLoading()
}).catch(() => { }).catch(() => {
wx.hideLoading() vm.throttle = true
}) wx.hideLoading()
})
}
}, },
// 取消好友 // 取消好友
deletefriend() { deletefriend() {