完善建筑外观切换与宿主页面适配
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-11 17:51:45 +08:00
parent f9fefa11ef
commit ee0691174e
4 changed files with 74 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class="explain-hall-select" :class="{ 'host-navigation': shouldUseHostNavigation }">
<view v-if="!shouldUseHostNavigation" class="explain-page-header">
<view v-if="showInternalHeader" class="explain-page-header">
<view class="header-back" @tap="handleBack">
<text class="header-back-icon"></text>
<text class="header-back-text">返回</text>
@@ -241,6 +241,7 @@ const hallPreviewMap: Record<string, string> = {
const filteredHalls = computed(() => props.halls)
const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
const showInternalHeader = computed(() => !shouldUseHostNavigation.value)
const headerTitle = computed(() => {
if (props.stage === 'unit') return props.selectedHallName || '选择业务单元'
if (props.stage === 'stop') return props.selectedBusinessUnitName || '选择讲解点'

View File

@@ -5142,9 +5142,30 @@ const handleFloorChange = async (floorId: string) => {
}
const showOverview = async () => {
// 建筑外观不再作为手动切换入口;只在初始加载与缩放自动切换时展示。
if (activeView.value === 'overview') {
resetCamera()
return
}
const previousLoadToken = modelLoadVersion
try {
isLoading.value = true
loadError.value = false
clearMapSelection(false)
clearRoutePreview()
await loadOverview()
} catch (error) {
if (!isStaleModelLoadError(error)) {
console.error('建筑外观模型加载失败:', error)
loadError.value = true
setFriendlyModelLoadError()
}
throw error
} finally {
const requestWasSuperseded = modelLoadVersion > previousLoadToken + 1
if (!requestWasSuperseded) {
isLoading.value = false
}
}
}

View File

@@ -705,6 +705,18 @@ const handleZoomClick = (direction: 'in' | 'out') => {
emit('toolClick', direction === 'in' ? '放大' : '缩小')
}
const handleShowOverview = async () => {
indoorRendererRef.value?.disableAutoSwitchTemporarily?.(10000)
loadingFloorId.value = ''
requestedFloorId.value = ''
requestedFloorLabel.value = ''
failedFloorId.value = ''
await indoorRendererRef.value?.showOverview?.()
emit('selectionClear')
emit('indoorViewChange', 'overview')
emit('layerModeChange', 'single')
}
const handleMoreTap = () => {
emit('moreClick')
}
@@ -766,7 +778,8 @@ const handleOutdoorMarkerClick = (markerId: string) => {
defineExpose({
clearRoute: () => {
indoorRendererRef.value?.clearRoute?.()
}
},
showOverview: handleShowOverview
})
</script>

View File

@@ -135,7 +135,7 @@
<view class="guide-quick-icon-floor top"></view>
<view class="guide-quick-icon-floor bottom"></view>
</view>
<text class="guide-quick-action-text">馆内</text>
<text class="guide-quick-action-text">{{ indoorQuickActionLabel }}</text>
</view>
<view
class="guide-quick-action"
@@ -416,10 +416,12 @@ const routeReady = ref(false)
const activeRoutePreview = ref<GuideRouteResult | null>(null)
const isSimulatingRoute = ref(false)
const isPoiCardCollapsed = ref(false)
const returningToOverview = ref(false)
// GuideMapShell 组件引用,用于显式调用路线清除方法
const guideMapShellRef = ref<{
clearRoute?: () => void
showOverview?: () => Promise<void> | void
} | null>(null)
const homeSearchPanelRef = ref<{
expandHomePanel?: () => void
@@ -696,6 +698,9 @@ const guideQuickActiveAction = computed<'indoor' | 'arrival' | 'explain'>(() =>
if (showArrivalPanel.value) return 'arrival'
return is3DMode.value ? 'indoor' : 'arrival'
})
const indoorQuickActionLabel = computed(() => (
is3DMode.value && indoorView.value !== 'overview' ? '外观' : '馆内'
))
const toRoutePointOption = (target: GuideRouteTarget): RoutePointOption => ({
poiId: target.poiId,
@@ -1299,7 +1304,36 @@ const handleSwitchEntrance = () => {
guideOutdoorState.value = 'home'
}
const handleMoreRouteGuide = () => {
const handleMoreRouteGuide = async () => {
if (returningToOverview.value) return
if (is3DMode.value && indoorView.value !== 'overview') {
returningToOverview.value = true
showRoutePlanner.value = false
selectedGuidePoi.value = null
isPoiCardCollapsed.value = false
isSimulatingRoute.value = false
requestedFloorId.value = ''
requestedFloorLabel.value = ''
loadingFloorId.value = ''
failedFloorId.value = ''
clearRoutePreviewState()
try {
await guideMapShellRef.value?.showOverview?.()
indoorView.value = 'overview'
guideOutdoorState.value = 'home'
closeHomeSearchDock()
showIndoorHint('已返回建筑外观,可放大再次进入馆内', 3200)
} catch (error) {
console.error('返回建筑外观失败:', error)
showIndoorHint('建筑外观加载失败,请稍后重试', 3200)
} finally {
returningToOverview.value = false
}
return
}
closeArrivalPanel()
showRoutePlanner.value = false
is3DMode.value = true