fix: 修复路线距离和时长计算的数据源
从 payload.content.route 中解析 distance 和 duration 字段,而不是直接从 payload.content 获取,以确保数据准确性。
| | |
| | | setRoutePoints([]); |
| | | setPolyline([]); |
| | | } |
| | | const distance = Number(payload?.content?.distance); |
| | | const duration = Number(payload?.content?.duration); |
| | | const distance = Number(JSON.parse(payload?.content?.route)?.distance); |
| | | const duration = Number(JSON.parse(payload?.content?.route)?.duration); |
| | | const distanceKm = normalizeDistanceKm(distance); |
| | | if (distanceKm !== null) { |
| | | setRouteDistance(distanceKm); |