个人中心页面-自动获取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,
},
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',
})