修复馆内预览状态与点位展示
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-19 14:05:54 +08:00
parent 58887d928a
commit 215428db90
11 changed files with 280 additions and 35 deletions

View File

@@ -586,10 +586,13 @@ const markFloorSwitchFailedIfUnrendered = (floorId: string, requestSeq: number)
const handleFloorChange = (floor: { id: string; label: string }) => {
const floorId = floor.id
if (!floorId || loadingFloorId.value) return
if (floorId === renderedFloorId.value && activeFloorId.value === floorId && props.layerMode !== 'multi') {
if (
floorId === renderedFloorId.value
&& activeFloorId.value === floorId
&& props.indoorView === 'floor'
&& props.layerMode !== 'multi'
) {
emit('floorChange', floorId)
emit('indoorViewChange', 'floor')
emit('layerModeChange', 'single')
return
}
@@ -604,9 +607,6 @@ const handleFloorChange = (floor: { id: string; label: string }) => {
floorId,
floorLabel: floor.label
})
emit('indoorViewChange', 'floor')
emit('layerModeChange', 'single')
Promise.resolve(indoorRendererRef.value?.switchFloor?.(floorId))
.then(() => {
markFloorSwitchFailedIfUnrendered(floorId, requestSeq)
@@ -667,10 +667,12 @@ const handleLayerModeChange = (mode: LayerDisplayMode) => {
})
console.error('楼层切换失败:', error)
})
emit('indoorViewChange', 'floor')
// floor-change 才代表 ThreeMap 已提交单层模型。
}
emit('layerModeChange', mode)
if (mode === 'multi') {
emit('layerModeChange', mode)
}
}
const handleLayerModeToggle = () => {
@@ -786,6 +788,8 @@ defineExpose({
clearRoute: () => {
indoorRendererRef.value?.clearRoute?.()
},
// 仅发起切换;父级必须以 floor-change 作为已提交的唯一依据。
switchFloor: (floorId: string) => indoorRendererRef.value?.switchFloor?.(floorId),
showOverview: handleShowOverview,
resetToViewBaseline: (options: {
view: 'overview' | 'floor'

View File

@@ -3,13 +3,21 @@
class="guide-top-tabs"
:class="`variant-${variant}`"
:style="{ top }"
role="tablist"
aria-label="主功能"
>
<view
v-for="tab in GUIDE_TOP_TABS"
:key="tab.id"
class="guide-top-tab"
:class="{ active: activeTab === tab.id }"
role="tab"
:tabindex="activeTab === tab.id ? 0 : -1"
:aria-selected="activeTab === tab.id"
:aria-label="`切换至${tab.label}`"
@tap="handleTabTap(tab.id)"
@keydown.enter.prevent="handleTabTap(tab.id)"
@keydown.space.prevent="handleTabTap(tab.id)"
>
<view
v-if="activeTab === tab.id && variant === 'underline'"

View File

@@ -226,6 +226,9 @@ import {
import {
guideUseCase
} from '@/usecases/guideUseCase'
import {
createVisitorPoiPresentations
} from '@/view-models/visitorPoiPresentation'
import {
HOME_POI_CATEGORIES,
POI_CATEGORIES,
@@ -356,13 +359,18 @@ const isPoiLocatable = (poi: MuseumPoi) => !getPoiDataIssues(poi).some((issue) =
const unavailablePoiCount = computed(() => pois.value.filter((poi) => !isPoiLocatable(poi)).length)
// 数据质量统计保留给诊断日志,普通游客只看到可恢复的加载状态。
const dataWarning = computed(() => {
const warnings: string[] = []
if (excludedPoiCount.value) warnings.push(`${excludedPoiCount.value} 个点位分类或楼层信息不完整`)
if (duplicatePoiCount.value) warnings.push(`${duplicatePoiCount.value} 个重复点位已合并`)
if (unavailablePoiCount.value) warnings.push(`${unavailablePoiCount.value} 个点位暂无地图坐标`)
if (floorLoadError.value) warnings.push('楼层信息读取失败')
return warnings.join('')
const diagnostic = {
excluded: excludedPoiCount.value,
duplicates: duplicatePoiCount.value,
unavailable: unavailablePoiCount.value,
floorLoadError: floorLoadError.value
}
if (import.meta.env.DEV && Object.values(diagnostic).some(Boolean)) {
console.debug('[guide-poi-diagnostics]', diagnostic)
}
return ''
})
const dedupePois = (items: MuseumPoi[]) => {
@@ -860,7 +868,10 @@ const restoreResultListScroll = async () => {
if (resultListElement) resultListElement.scrollTop = scrollTop
}
const poiDisplayName = (poi: MuseumPoi) => poi.name?.trim() || '未命名点位'
const poiPresentations = computed(() => createVisitorPoiPresentations(pois.value))
const poiDisplayName = (poi: MuseumPoi) => (
poiPresentations.value.get(poi.id)?.displayName || '未命名点位'
)
const poiResultMeta = (poi: MuseumPoi) => {
const categoryLabel = resolvePoiCategory(poi)?.label || poi.primaryCategory?.label || '其他'