From c8656fd99665881061b65fa6493a55221cf9b65d Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Fri, 22 Aug 2025 13:50:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2-=E8=87=AA=E5=8A=A8=E8=8E=B7=E5=8F=96isAgent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/profile/profile.vue | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/pages/profile/profile.vue b/pages/profile/profile.vue index 78c9922..2f83b3c 100644 --- a/pages/profile/profile.vue +++ b/pages/profile/profile.vue @@ -154,6 +154,7 @@ export default { rentAmount: 0, }, loading: false, + isAgent: false, } }, onLoad() { @@ -181,6 +182,7 @@ export default { this.fetchUserInfo(), this.fetchFinancialData(), this.fetchUserStats(), + this.getIsAgent(), ]) // 处理用户信息 @@ -232,16 +234,15 @@ export default { return response } catch (error) { console.error('获取用户信息失败:', error) - // 如果获取失败,使用默认数据 - return { - code: 200, - data: { - nickName: '昵称', - phonenumber: '123****1234', - avatar: '', - userId: '1', - }, - } + } + }, + + async getIsAgent() { + try { + const response = await isAgent() + this.isAgent = response.data + } catch (error) { + console.error('获取是否是代理失败:', error) } }, @@ -252,16 +253,6 @@ export default { return response } catch (error) { console.error('获取财务数据失败:', error) - // 如果获取失败,使用默认数据 - return { - code: 200, - data: { - balance: 0, - waitBalance: 0, - withdrawBalance: 0, - withdrawedBalance: 0, - }, - } } }, @@ -350,8 +341,7 @@ export default { }, async goToUserList() { - const response = await isAgent() - if (response.data) { + if (this.isAgent) { uni.navigateTo({ url: '/pages/useList/useList', }) @@ -364,8 +354,7 @@ export default { }, async goToSharePromotion() { - const response = await isAgent() - if (response.data) { + if (this.isAgent) { uni.navigateTo({ url: '/pages/agents/requestAgent', })