完善个人页(测试NTRP水平未做)

This commit is contained in:
2025-09-14 11:46:29 +08:00
parent 01aad920ad
commit 6f0c0c30fa
8 changed files with 317 additions and 59 deletions

View File

@@ -28,6 +28,9 @@ interface UserDetailData {
last_login_time: string;
create_time: string;
last_modify_time: string;
personal_profile: string;
occupation: string;
birthday: string;
stats: {
followers_count: number;
following_count: number;
@@ -226,12 +229,13 @@ export class UserService {
participated: userData.stats?.participated_games_count || 0
},
personal_profile: '',
personal_profile: userData.personal_profile || '',
location: userData.city + userData.district|| '',
occupation: '',
occupation: userData.occupation || '',
ntrp_level: '',
phone: userData.phone || '',
gender: userData.gender || ''
gender: userData.gender || '',
birthday: userData.birthday || '',
};
} else {
throw new Error(response.message || '获取用户信息失败');
@@ -449,6 +453,24 @@ export class UserService {
return require('../static/userInfo/default_avatar.svg');
}
}
// 解析用户手机号
static async parse_phone(phone_code: string): Promise<string> {
try {
const response = await httpService.post<{ phone: string }>(API_CONFIG.USER.PARSE_PHONE, { phone_code }, {
showLoading: true,
loadingText: '获取手机号中...'
});
if (response.code === 0) {
return response.data.phone || '';
} else {
throw new Error(response.message || '获取手机号失败');
}
} catch (error) {
console.error('获取手机号失败:', error);
return '';
}
}
}
// 从 loginService 移过来的用户相关方法