1
This commit is contained in:
@@ -247,32 +247,28 @@ export class UserService {
|
||||
static async get_user_info(user_id?: string): Promise<UserInfo> {
|
||||
try {
|
||||
const response = await httpService.post<UserDetailData>(API_CONFIG.USER.DETAIL, user_id ? { user_id } : {}, {
|
||||
needAuth: false,
|
||||
|
||||
showLoading: false
|
||||
});
|
||||
|
||||
if (response.code === 0) {
|
||||
const userData = response.data;
|
||||
return {
|
||||
id: userData.user_code || user_id || '1',
|
||||
nickname: userData.nickname || '用户',
|
||||
avatar: userData.avatar_url || require('../static/userInfo/default_avatar.svg'),
|
||||
join_date: userData.subscribe_time ? `${new Date(userData.subscribe_time).getFullYear()}年${new Date(userData.subscribe_time).getMonth() + 1}月加入` : '未知时间加入',
|
||||
id: userData.user_code || user_id || '',
|
||||
nickname: userData.nickname || '',
|
||||
avatar: userData.avatar_url || '',
|
||||
join_date: userData.subscribe_time ? `${new Date(userData.subscribe_time).getFullYear()}年${new Date(userData.subscribe_time).getMonth() + 1}月加入` : '',
|
||||
stats: {
|
||||
following: userData.stats?.following_count || 0,
|
||||
friends: userData.stats?.followers_count || 0,
|
||||
hosted: userData.stats?.hosted_games_count || 0,
|
||||
participated: userData.stats?.participated_games_count || 0
|
||||
},
|
||||
tags: [
|
||||
userData.city || '未知地区',
|
||||
userData.province || '未知省份',
|
||||
'NTRP 3.0' // 默认等级,需要其他接口获取
|
||||
],
|
||||
bio: '这个人很懒,什么都没有写...',
|
||||
location: userData.city || '未知地区',
|
||||
occupation: '未知职业', // 需要其他接口获取
|
||||
ntrp_level: 'NTRP 3.0', // 需要其他接口获取
|
||||
|
||||
bio: '',
|
||||
location:userData.province + userData.city || '',
|
||||
occupation: '',
|
||||
ntrp_level: '',
|
||||
phone: userData.phone || '',
|
||||
gender: userData.gender || ''
|
||||
};
|
||||
@@ -282,25 +278,7 @@ export class UserService {
|
||||
} catch (error) {
|
||||
console.error('获取用户信息失败:', error);
|
||||
// 返回默认用户信息
|
||||
return {
|
||||
id: user_id || '1',
|
||||
nickname: '用户',
|
||||
avatar: require('../static/userInfo/default_avatar.svg'),
|
||||
join_date: '未知时间加入',
|
||||
stats: {
|
||||
following: 0,
|
||||
friends: 0,
|
||||
hosted: 0,
|
||||
participated: 0
|
||||
},
|
||||
tags: ['未知地区', '未知职业', 'NTRP 3.0'],
|
||||
bio: '这个人很懒,什么都没有写...',
|
||||
location: '未知地区',
|
||||
occupation: '未知职业',
|
||||
ntrp_level: 'NTRP 3.0',
|
||||
phone: '',
|
||||
gender: ''
|
||||
};
|
||||
return {} as UserInfo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +288,7 @@ export class UserService {
|
||||
const response = await httpService.post<any>(API_CONFIG.USER.HOSTED_GAMES, {
|
||||
user_id
|
||||
}, {
|
||||
needAuth: false,
|
||||
|
||||
showLoading: false
|
||||
});
|
||||
|
||||
@@ -323,41 +301,7 @@ export class UserService {
|
||||
} catch (error) {
|
||||
console.error('获取主办球局失败:', error);
|
||||
// 返回符合ListContainer data格式的模拟数据
|
||||
return [
|
||||
{
|
||||
id: 1,
|
||||
title: '女生轻松双打',
|
||||
dateTime: '明天(周五) 下午5点',
|
||||
location: '仁恒河滨花园网球场',
|
||||
distance: '3.5km',
|
||||
registeredCount: 2,
|
||||
maxCount: 4,
|
||||
skillLevel: '2.0-2.5',
|
||||
matchType: '双打',
|
||||
images: [
|
||||
require('../static/userInfo/game1.svg'),
|
||||
require('../static/userInfo/game2.svg'),
|
||||
require('../static/userInfo/game3.svg')
|
||||
],
|
||||
shinei: '室外'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: '新手友好局',
|
||||
dateTime: '周日 下午2点',
|
||||
location: '徐汇网球中心',
|
||||
distance: '1.8km',
|
||||
registeredCount: 4,
|
||||
maxCount: 6,
|
||||
skillLevel: '1.5-2.0',
|
||||
matchType: '双打',
|
||||
images: [
|
||||
require('../static/userInfo/game1.svg'),
|
||||
require('../static/userInfo/game2.svg')
|
||||
],
|
||||
shinei: '室外'
|
||||
}
|
||||
];
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +311,7 @@ export class UserService {
|
||||
const response = await httpService.post<any>(API_CONFIG.USER.PARTICIPATED_GAMES, {
|
||||
user_id
|
||||
}, {
|
||||
needAuth: false,
|
||||
|
||||
showLoading: false
|
||||
});
|
||||
|
||||
@@ -380,56 +324,8 @@ export class UserService {
|
||||
} catch (error) {
|
||||
console.error('获取参与球局失败:', error);
|
||||
// 返回符合ListContainer data格式的模拟数据
|
||||
return [
|
||||
{
|
||||
id: 2,
|
||||
title: '周末双打练习',
|
||||
dateTime: '后天(周六) 上午10点',
|
||||
location: '上海网球中心',
|
||||
distance: '5.2km',
|
||||
registeredCount: 6,
|
||||
maxCount: 8,
|
||||
skillLevel: '3.0-3.5',
|
||||
matchType: '双打',
|
||||
images: [
|
||||
require('../static/userInfo/game2.svg'),
|
||||
require('../static/userInfo/game3.svg')
|
||||
],
|
||||
shinei: '室内'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '晨练单打',
|
||||
dateTime: '明天(周五) 早上7点',
|
||||
location: '浦东网球俱乐部',
|
||||
distance: '2.8km',
|
||||
registeredCount: 1,
|
||||
maxCount: 2,
|
||||
skillLevel: '2.5-3.0',
|
||||
matchType: '单打',
|
||||
images: [
|
||||
require('../static/userInfo/game1.svg')
|
||||
],
|
||||
shinei: '室外'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: '夜场混双',
|
||||
dateTime: '今晚 晚上8点',
|
||||
location: '虹桥网球中心',
|
||||
distance: '4.1km',
|
||||
registeredCount: 3,
|
||||
maxCount: 4,
|
||||
skillLevel: '3.5-4.0',
|
||||
matchType: '混双',
|
||||
images: [
|
||||
require('../static/userInfo/game1.svg'),
|
||||
require('../static/userInfo/game2.svg'),
|
||||
require('../static/userInfo/game3.svg')
|
||||
],
|
||||
shinei: '室内'
|
||||
}
|
||||
];
|
||||
return [];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +343,7 @@ export class UserService {
|
||||
try {
|
||||
const endpoint = is_following ? API_CONFIG.USER.UNFOLLOW : API_CONFIG.USER.FOLLOW;
|
||||
const response = await httpService.post<any>(endpoint, { user_id }, {
|
||||
needAuth: false,
|
||||
|
||||
showLoading: true,
|
||||
loadingText: is_following ? '取消关注中...' : '关注中...'
|
||||
});
|
||||
@@ -484,7 +380,7 @@ export class UserService {
|
||||
};
|
||||
|
||||
const response = await httpService.post<any>(API_CONFIG.USER.UPDATE, updateParams, {
|
||||
needAuth: false,
|
||||
|
||||
showLoading: true,
|
||||
loadingText: '保存中...'
|
||||
});
|
||||
@@ -508,7 +404,7 @@ export class UserService {
|
||||
page,
|
||||
limit
|
||||
}, {
|
||||
needAuth: false,
|
||||
|
||||
showLoading: false
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user