修复首页快捷入口与三维点位同步
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
cxk
2026-07-21 00:40:06 +08:00
parent 1f89e8b3e0
commit b90c58451c
7 changed files with 257 additions and 16 deletions

View File

@@ -583,17 +583,21 @@ const markFloorSwitchFailedIfUnrendered = (floorId: string, requestSeq: number)
})
}
const handleFloorChange = (floor: { id: string; label: string }) => {
const requestFloorSwitch = (
floor: { id: string; label: string },
options: { force?: boolean } = {}
) => {
const floorId = floor.id
if (!floorId || loadingFloorId.value) return
if (!floorId) return Promise.resolve()
if (loadingFloorId.value === floorId) return Promise.resolve()
if (
floorId === renderedFloorId.value
!options.force && floorId === renderedFloorId.value
&& activeFloorId.value === floorId
&& props.indoorView === 'floor'
&& props.layerMode !== 'multi'
) {
emit('floorChange', floorId)
return
return Promise.resolve()
}
requestedFloorId.value = floorId
@@ -607,7 +611,7 @@ const handleFloorChange = (floor: { id: string; label: string }) => {
floorId,
floorLabel: floor.label
})
Promise.resolve(indoorRendererRef.value?.switchFloor?.(floorId))
return Promise.resolve(indoorRendererRef.value?.switchFloor?.(floorId))
.then(() => {
markFloorSwitchFailedIfUnrendered(floorId, requestSeq)
})
@@ -623,6 +627,10 @@ const handleFloorChange = (floor: { id: string; label: string }) => {
})
}
const handleFloorChange = (floor: { id: string; label: string }) => {
void requestFloorSwitch(floor)
}
const handleLayerModeChange = (mode: LayerDisplayMode) => {
// 手动切换展示层数时使用统一的短保护期。
indoorRendererRef.value?.disableAutoSwitchTemporarily?.(manualAutoSwitchPauseMs)
@@ -789,7 +797,11 @@ defineExpose({
indoorRendererRef.value?.clearRoute?.()
},
// 仅发起切换;父级必须以 floor-change 作为已提交的唯一依据。
switchFloor: (floorId: string) => indoorRendererRef.value?.switchFloor?.(floorId),
switchFloor: (floorId: string) => {
const floor = findFloorItemById(floorId)
if (!floor) return Promise.resolve()
return requestFloorSwitch(floor, { force: true })
},
showOverview: handleShowOverview,
resetToViewBaseline: (options: {
view: 'overview' | 'floor'

View File

@@ -248,6 +248,7 @@ import type {
PoiCategoryResultState,
PoiSearchContext
} from '@/domain/poiSearch'
import { nextHomeSearchResultVersion } from './homeSearchResultVersion'
import { isEmbeddedInWechatMiniProgram } from '@/utils/hostEnvironment'
const props = withDefaults(defineProps<{
@@ -397,7 +398,8 @@ const emitResultsState = () => {
emit('results-change', {
...context,
visiblePoiIds: active ? context.visiblePoiIds : [],
active
active,
requestId: props.variant === 'home' ? nextHomeSearchResultVersion() : undefined
})
}
@@ -411,7 +413,8 @@ const emitPendingHomeSearchResults = (floor?: Pick<MuseumFloor, 'id' | 'label'>)
floorLabel: floor?.label || context.floorLabel,
visiblePoiIds: [],
active: true,
pending: true
pending: true,
requestId: nextHomeSearchResultVersion()
})
}

View File

@@ -0,0 +1,7 @@
// This version survives a PoiSearchPanel remount, unlike its local request sequence.
let latestHomeSearchResultVersion = 0
export const nextHomeSearchResultVersion = () => {
latestHomeSearchResultVersion += 1
return latestHomeSearchResultVersion
}