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.throttle = false
vm.$post({url: `${service.host}/follow/user/${vm.id}`}).then(({code, data}) => { vm.$post({url: `${service.host}/follow/user/${vm.id}`}).then(({code, data}) => {
if (code == 0) { if (code == 0) {
if (data.is_followed) { if (!vm.userInfo.base_profile.is_followed) {
vm.$showToast(`已关注`) vm.$showToast(`已关注`)
vm.userInfo.is_followed = true vm.userInfo.base_profile.is_followed = true
vm.userInfo.fans_count = vm.userInfo.fans_count + 1 vm.userInfo.base_profile.fans_count = vm.userInfo.base_profile.fans_count + 1
} else { } else {
vm.userInfo.is_followed = false vm.userInfo.base_profile.is_followed = false
vm.userInfo.fans_count = vm.userInfo.fans_count - 1 vm.userInfo.base_profile.fans_count = vm.userInfo.base_profile.fans_count - 1
vm.$showToast(`已取消关注`) vm.$showToast(`已取消关注`)
} }
} }
vm.throttle = true
wx.hideLoading() wx.hideLoading()
}).catch(() => { }).catch(() => {
vm.throttle = true
wx.hideLoading() wx.hideLoading()
}) })
}
}, },
// 取消好友 // 取消好友
deletefriend() { deletefriend() {