54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
|
|
const request = require('../../utils/request')
|
||
|
|
|
||
|
|
Page({
|
||
|
|
data: {
|
||
|
|
loading: false,
|
||
|
|
userInfo: null,
|
||
|
|
auditTextMap: {
|
||
|
|
0: '未提交',
|
||
|
|
1: '待审核',
|
||
|
|
2: '已通过',
|
||
|
|
3: '已驳回'
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onShow() {
|
||
|
|
this.loadProfile()
|
||
|
|
},
|
||
|
|
|
||
|
|
async loadProfile() {
|
||
|
|
this.setData({ loading: true })
|
||
|
|
try {
|
||
|
|
const userInfo = await request({ url: '/users/me' })
|
||
|
|
this.setData({
|
||
|
|
userInfo: {
|
||
|
|
...userInfo,
|
||
|
|
nicknameText: userInfo.nickname || '未设置昵称',
|
||
|
|
auditStatusText: this.data.auditTextMap[userInfo.audit_status] || '未知'
|
||
|
|
}
|
||
|
|
})
|
||
|
|
} catch (err) {
|
||
|
|
console.error('Load profile failed:', err)
|
||
|
|
this.setData({ userInfo: null })
|
||
|
|
} finally {
|
||
|
|
this.setData({ loading: false })
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
goEdit() {
|
||
|
|
wx.navigateTo({ url: '/pages/profile-edit/profile-edit' })
|
||
|
|
},
|
||
|
|
|
||
|
|
goAudit() {
|
||
|
|
wx.navigateTo({ url: '/pages/audit-status/audit-status' })
|
||
|
|
},
|
||
|
|
|
||
|
|
goMyActivities() {
|
||
|
|
wx.navigateTo({ url: '/pages/my-activities/my-activities' })
|
||
|
|
},
|
||
|
|
|
||
|
|
goMyMatches() {
|
||
|
|
wx.navigateTo({ url: '/pages/my-matches/my-matches' })
|
||
|
|
}
|
||
|
|
})
|