From 3d4f4c1d9aff93a65decd81c189e3a91ce960300 Mon Sep 17 00:00:00 2001 From: lyf <2514544224@qq.com> Date: Fri, 17 Jul 2026 15:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DF1=E6=A5=BC=E5=B1=82=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=BF=9B=E5=85=A5=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/ThreeMap.vue | 6 ++++-- src/pages/index/index.vue | 4 +++- tests/unit/IndexPoiSearchFlow.spec.ts | 10 +++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/map/ThreeMap.vue b/src/components/map/ThreeMap.vue index 9d26664..5e94176 100644 --- a/src/components/map/ThreeMap.vue +++ b/src/components/map/ThreeMap.vue @@ -63,7 +63,8 @@ import type { GuideRouteResult } from '@/domain/museum' import { - compareFloorsTopToBottom + compareFloorsTopToBottom, + getFloorSortLevel } from '@/domain/guideFloor' import { guideModelLoadManager, @@ -3139,7 +3140,8 @@ const resolveFloorIdFromRequest = (requestedFloorId?: string | null) => { } const isGroundEntryFloor = (floor: FloorIndexItem) => ( - getFloorMatchKeys(floor).some((key) => { + getFloorSortLevel(floor) === 1 + || getFloorMatchKeys(floor).some((key) => { const normalizedKey = normalizeModelMatchKey(key) return normalizedKey === 'l1' || normalizedKey === '1f' }) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 1069e71..0a685ee 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -345,6 +345,7 @@ import type { MuseumHall, MuseumPoi } from '@/domain/museum' +import { getFloorSortLevel } from '@/domain/guideFloor' type GuideIndoorView = 'overview' | 'floor' | 'multi' type LayerDisplayMode = 'single' | 'multi' @@ -583,7 +584,8 @@ const guideFloors = ref([]) const normalizeGuideFloorId = (labelOrId: string) => guideUseCase.normalizeFloorId(labelOrId) const getPreferredInitialGuideFloorId = (floors: MuseumFloor[]) => ( floors.find((floor) => ( - normalizeGuideFloorId(floor.id) === 'L1' + getFloorSortLevel(floor) === 1 + || normalizeGuideFloorId(floor.id) === 'L1' || normalizeGuideFloorId(floor.label) === 'L1' ))?.id || floors[0]?.id diff --git a/tests/unit/IndexPoiSearchFlow.spec.ts b/tests/unit/IndexPoiSearchFlow.spec.ts index f5700c7..9d00fa7 100644 --- a/tests/unit/IndexPoiSearchFlow.spec.ts +++ b/tests/unit/IndexPoiSearchFlow.spec.ts @@ -366,17 +366,17 @@ describe('首页搜索与地图闭环', () => { it('楼层数据按高到低返回时,首次进入仍将 1F 作为自动缩放的默认目标', async () => { const originalFloors = [...floors] floors.splice(0, floors.length, - { id: 'L5', label: '5F', order: 5 }, - { id: 'L2', label: '2F', order: 2 }, - { id: 'L1', label: '1F', order: 1 } + { id: 'F5', label: 'F5', order: 5 }, + { id: 'F2', label: 'F2', order: 2 }, + { id: 'F1', label: 'F1', order: 1 } ) try { const wrapper = await mountIndex() const map = wrapper.getComponent(GuideMapShellStub) - expect(map.props('activeFloor')).toBe('L1') - expect(wrapper.getComponent(PoiSearchPanelStub).props('currentFloorId')).toBe('L1') + expect(map.props('activeFloor')).toBe('F1') + expect(wrapper.getComponent(PoiSearchPanelStub).props('currentFloorId')).toBe('F1') } finally { floors.splice(0, floors.length, ...originalFloors) }