修改 地区定位

This commit is contained in:
张成
2025-09-10 22:13:15 +08:00
parent 01d131f224
commit a9511ea828

View File

@@ -18,6 +18,7 @@ interface UserDetailData {
country: string; country: string;
province: string; province: string;
city: string; city: string;
district:string;
language: string; language: string;
phone: string; phone: string;
is_subscribed: string; is_subscribed: string;
@@ -118,9 +119,6 @@ export class UserService {
const start_time = new Date(game.start_time); const start_time = new Date(game.start_time);
const date_time = this.format_date_time(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[] = []; let images: string[] = [];
if (game.image_list && game.image_list.length > 0) { 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 registered_count = game.current_players || game.participant_count || 0;
const max_count = game.max_players || game.max_participants || 0; const max_count = game.max_players || game.max_participants || 0;
// 转换为 ListCard 期望的格式
return { return {
id: game.id, id: game.id,
title: game.title || '未命名球局', title: game.title || '未命名球局',
dateTime: date_time, start_time: date_time,
location: location, location: location,
distance: distance, distance_km: parseFloat(distance.replace('km', '')) || 0,
registeredCount: registered_count, current_players: registered_count,
maxCount: max_count, max_players: max_count,
skillLevel: skill_level, 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 || '不限', matchType: game.play_type || '不限',
images: images,
shinei: game.court_type || '未知' shinei: game.court_type || '未知'
}; };
}); });
@@ -191,22 +193,6 @@ export class UserService {
return `${date_str} ${time_str}`; 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 { private static calculate_distance(latitude: number, longitude: number): string {
if (latitude === 0 && longitude === 0) { if (latitude === 0 && longitude === 0) {
@@ -241,7 +227,7 @@ export class UserService {
}, },
personal_profile: '', personal_profile: '',
location: userData.province + userData.city || '', location: userData.city + userData.district|| '',
occupation: '', occupation: '',
ntrp_level: '', ntrp_level: '',
phone: userData.phone || '', phone: userData.phone || '',