定位信息增加地址解析
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user