From ef59570b0e28f4e3b2513c6f76b980a9798f1d04 Mon Sep 17 00:00:00 2001 From: lyf <2514544224@qq.com> Date: Tue, 14 Jul 2026 10:00:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2=E7=82=B9?= =?UTF-8?q?=E4=BD=8D=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/facility/detail.vue | 83 +++++++++++++++++---------- src/pages/index/index.vue | 29 ++++++---- tests/unit/FacilityDetail.spec.ts | 20 +++++++ tests/unit/IndexPoiSearchFlow.spec.ts | 14 ++--- 4 files changed, 95 insertions(+), 51 deletions(-) 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 = () => {