diff --git a/src/pages/home/information.wpy b/src/pages/home/information.wpy index 4485b55..963d7fb 100644 --- a/src/pages/home/information.wpy +++ b/src/pages/home/information.wpy @@ -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() {