个人中心页面-自动获取isAgent

This commit is contained in:
WindowBird 2025-08-22 13:50:42 +08:00
parent 15da6597e7
commit c8656fd996

View File

@ -154,6 +154,7 @@ export default {
rentAmount: 0, rentAmount: 0,
}, },
loading: false, loading: false,
isAgent: false,
} }
}, },
onLoad() { onLoad() {
@ -181,6 +182,7 @@ export default {
this.fetchUserInfo(), this.fetchUserInfo(),
this.fetchFinancialData(), this.fetchFinancialData(),
this.fetchUserStats(), this.fetchUserStats(),
this.getIsAgent(),
]) ])
// //
@ -232,16 +234,15 @@ export default {
return response return response
} catch (error) { } catch (error) {
console.error('获取用户信息失败:', error) console.error('获取用户信息失败:', error)
// 使 }
return { },
code: 200,
data: { async getIsAgent() {
nickName: '昵称', try {
phonenumber: '123****1234', const response = await isAgent()
avatar: '', this.isAgent = response.data
userId: '1', } catch (error) {
}, console.error('获取是否是代理失败:', error)
}
} }
}, },
@ -252,16 +253,6 @@ export default {
return response return response
} catch (error) { } catch (error) {
console.error('获取财务数据失败:', error) console.error('获取财务数据失败:', error)
// 使
return {
code: 200,
data: {
balance: 0,
waitBalance: 0,
withdrawBalance: 0,
withdrawedBalance: 0,
},
}
} }
}, },
@ -350,8 +341,7 @@ export default {
}, },
async goToUserList() { async goToUserList() {
const response = await isAgent() if (this.isAgent) {
if (response.data) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/useList/useList', url: '/pages/useList/useList',
}) })
@ -364,8 +354,7 @@ export default {
}, },
async goToSharePromotion() { async goToSharePromotion() {
const response = await isAgent() if (this.isAgent) {
if (response.data) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/agents/requestAgent', url: '/pages/agents/requestAgent',
}) })