diff --git a/src/pages/facility/detail.vue b/src/pages/facility/detail.vue index 9a99158..b487ff2 100644 --- a/src/pages/facility/detail.vue +++ b/src/pages/facility/detail.vue @@ -8,6 +8,7 @@ @back="handlePageBack" > + + 正在准备位置预览... + @@ -117,6 +121,7 @@ const targetFocusRequest = ref(null) const targetFocusRequestId = ref(0) const locationErrorMessage = ref('') const resolutionLoadFailed = ref(false) +const mapContextReady = ref(false) interface TargetPoiFocusResult { requestId: number | string @@ -340,39 +345,40 @@ const tryResolveFacilityPoi = async () => { } onLoad(async (options: Record = {}) => { + mapContextReady.value = false searchContext.value = parseFacilityDetailSearchContext(options) resolutionLoadFailed.value = false - await loadGuideFloors() - - if (options.id) { - facility.value.id = decodeRouteText(options.id) - } - - if (options.target) { - facility.value.name = decodeRouteText(options.target) - } - - const requestedFloorId = decodeRouteText(options.floorId) - || searchContext.value.searchFloorId - if (requestedFloorId) { - requestedTargetFloorId.value = normalizeGuideFloorId(requestedFloorId) - if (requestedTargetFloorId.value) { - activeFloor.value = requestedTargetFloorId.value - } - } - - const requestedFloorLabel = decodeRouteText(options.floorLabel) - || searchContext.value.searchFloorLabel - if (requestedFloorLabel) { - facility.value.floor = requestedFloorLabel - } - - if (!facility.value.id && !options.target) { - locationErrorMessage.value = '未提供可定位的点位信息。' - return - } - try { + await loadGuideFloors() + + if (options.id) { + facility.value.id = decodeRouteText(options.id) + } + + if (options.target) { + facility.value.name = decodeRouteText(options.target) + } + + const requestedFloorId = decodeRouteText(options.floorId) + || searchContext.value.searchFloorId + if (requestedFloorId) { + requestedTargetFloorId.value = normalizeGuideFloorId(requestedFloorId) + if (requestedTargetFloorId.value) { + activeFloor.value = requestedTargetFloorId.value + } + } + + const requestedFloorLabel = decodeRouteText(options.floorLabel) + || searchContext.value.searchFloorLabel + if (requestedFloorLabel) { + facility.value.floor = requestedFloorLabel + } + + if (!facility.value.id && !options.target) { + locationErrorMessage.value = '未提供可定位的点位信息。' + return + } + const poi = await tryResolveFacilityPoi() if (poi) { facility.value = toFacilityDetailViewModel(poi) @@ -396,6 +402,9 @@ onLoad(async (options: Record = {}) => { } catch (error) { console.error('加载设施位置详情失败:', error) locationErrorMessage.value = '位置数据加载失败,请稍后重试。' + } finally { + // 目标楼层与聚焦请求准备完成后再挂载 ThreeMap,避免默认楼层的中间帧。 + mapContextReady.value = true } }) @@ -443,6 +452,20 @@ const handlePageBack = () => {