修改 地区定位
This commit is contained in:
@@ -18,6 +18,7 @@ interface UserDetailData {
|
||||
country: string;
|
||||
province: string;
|
||||
city: string;
|
||||
district:string;
|
||||
language: string;
|
||||
phone: string;
|
||||
is_subscribed: string;
|
||||
@@ -118,9 +119,6 @@ export class UserService {
|
||||
const start_time = new Date(game.start_time);
|
||||
const date_time = this.format_date_time(start_time);
|
||||
|
||||
// 处理技能等级
|
||||
const skill_level = this.format_skill_level(game.skill_level_min, game.skill_level_max);
|
||||
|
||||
// 处理图片数组 - 兼容两种数据格式
|
||||
let images: string[] = [];
|
||||
if (game.image_list && game.image_list.length > 0) {
|
||||
@@ -150,17 +148,21 @@ export class UserService {
|
||||
const registered_count = game.current_players || game.participant_count || 0;
|
||||
const max_count = game.max_players || game.max_participants || 0;
|
||||
|
||||
// 转换为 ListCard 期望的格式
|
||||
return {
|
||||
id: game.id,
|
||||
title: game.title || '未命名球局',
|
||||
dateTime: date_time,
|
||||
start_time: date_time,
|
||||
location: location,
|
||||
distance: distance,
|
||||
registeredCount: registered_count,
|
||||
maxCount: max_count,
|
||||
skillLevel: skill_level,
|
||||
distance_km: parseFloat(distance.replace('km', '')) || 0,
|
||||
current_players: registered_count,
|
||||
max_players: max_count,
|
||||
skill_level_min: parseInt(game.skill_level_min) || 0,
|
||||
skill_level_max: parseInt(game.skill_level_max) || 0,
|
||||
play_type: game.play_type || '不限',
|
||||
image_list: images,
|
||||
court_type: game.court_type || '未知',
|
||||
matchType: game.play_type || '不限',
|
||||
images: images,
|
||||
shinei: game.court_type || '未知'
|
||||
};
|
||||
});
|
||||
@@ -191,22 +193,6 @@ export class UserService {
|
||||
return `${date_str} ${time_str}`;
|
||||
}
|
||||
|
||||
// 格式化技能等级
|
||||
private static format_skill_level(min: string, max: string): string {
|
||||
const min_num = parseInt(min) || 0;
|
||||
const max_num = parseInt(max) || 0;
|
||||
|
||||
if (min_num === 0 && max_num === 0) {
|
||||
return '不限';
|
||||
}
|
||||
|
||||
if (min_num === max_num) {
|
||||
return `${min_num}.0`;
|
||||
}
|
||||
|
||||
return `${min_num}.0-${max_num}.0`;
|
||||
}
|
||||
|
||||
// 计算距离(模拟实现,实际需要根据用户位置计算)
|
||||
private static calculate_distance(latitude: number, longitude: number): string {
|
||||
if (latitude === 0 && longitude === 0) {
|
||||
@@ -241,7 +227,7 @@ export class UserService {
|
||||
},
|
||||
|
||||
personal_profile: '',
|
||||
location: userData.province + userData.city || '',
|
||||
location: userData.city + userData.district|| '',
|
||||
occupation: '',
|
||||
ntrp_level: '',
|
||||
phone: userData.phone || '',
|
||||
|
||||
Reference in New Issue
Block a user