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