定位信息增加地址解析

This commit is contained in:
stu2not
2026-05-27 17:05:24 +08:00
parent fb11e48584
commit 356e333c81
12 changed files with 281 additions and 8 deletions

View File

@@ -53,6 +53,14 @@ function formatOptionalNumber(value?: number | null, digits = 1): string | null
return Number(value).toFixed(digits)
}
function getLocationAddress(point: DeviceLocation | DeviceTrajectoryPoint): string {
const address = String(point.address || '').trim()
if (address) return address
if (point.address_resolve_status === 0) return '地点解析中'
if (point.address_resolve_status === 2) return '地点暂时无法解析'
return '当前地点未知'
}
function buildLocationDetailLines(
point: DeviceLocation | DeviceTrajectoryPoint,
options?: { includeIdentity?: boolean }
@@ -444,6 +452,7 @@ export default function Location() {
<Text>📍</Text>
</View>
<View className='location-info'>
<Text className='location-address'>{getLocationAddress(deviceLocation)}</Text>
<Text className='location-coordinate'>
{deviceLocation.lat.toFixed(6)}, {deviceLocation.lng.toFixed(6)}
</Text>

View File

@@ -16,6 +16,9 @@ export interface DeviceLocation {
battery_pct?: number | null
device_time: string
server_time: string
address?: string | null
address_resolved_at?: string | null
address_resolve_status?: number | null
updated_at: string
stale?: boolean
realtime?: boolean