From 27d8864852c7140c82ba75fc268eacffff35e61e Mon Sep 17 00:00:00 2001 From: lyf <2514544224@qq.com> Date: Fri, 10 Jul 2026 12:40:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A8=A1=E5=9E=8B=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/ThreeMap.vue | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/map/ThreeMap.vue b/src/components/map/ThreeMap.vue index 14a9201..b9c2e71 100644 --- a/src/components/map/ThreeMap.vue +++ b/src/components/map/ThreeMap.vue @@ -5,7 +5,7 @@ - {{ loadingMessage }} + {{ loadingDisplayMessage }} @@ -14,8 +14,8 @@ - 3D 模型加载失败 - {{ loadingMessage }} + {{ modelLoadErrorTitle }} + {{ modelLoadErrorMessage }} 重新加载 @@ -349,6 +349,12 @@ const loadingProgress = ref(0) const loadingMessage = ref('正在读取馆内导览资源...') const activeView = ref(props.initialView) const currentFloor = ref(props.initialFloorId) +const loadingDisplayMessage = '正在加载馆内三维场景' +const modelLoadErrorTitle = '馆内三维场景加载失败' +const modelLoadErrorMessage = '可能是网络原因,请重新加载。' +const setFriendlyModelLoadError = () => { + setProgress(0, modelLoadErrorMessage) +} const selectedPOI = ref(null) const activeFocusPoiId = ref('') const floorIndex = ref([]) @@ -3188,7 +3194,6 @@ const checkAutoSwitch = (options: { forceOverviewEntry?: boolean } = {}) => { detachPoiBeforeLoad: true }) }, - '单楼层模型加载失败', { showLoading: !hasSceneToKeep && !canLoadFloorSilently(targetFloorId) } ) return @@ -3249,15 +3254,13 @@ const checkAutoSwitch = (options: { forceOverviewEntry?: boolean } = {}) => { trigger: 'zoom-out', distance }, - loadOverview, - '建筑外观模型加载失败' + loadOverview ) } const runAutoSwitchLoad = async ( event: { from: 'overview' | 'floor'; to: 'overview' | 'floor'; trigger: 'zoom-in' | 'zoom-out'; distance: number }, loadTask: () => Promise, - fallbackMessage: string, options: { showLoading?: boolean } = {} ) => { const showLoading = options.showLoading ?? true @@ -3278,7 +3281,7 @@ const runAutoSwitchLoad = async ( console.error('馆内 3D 自动视角切换失败:', error) loadError.value = true isLoading.value = false - setProgress(0, error instanceof Error ? error.message : fallbackMessage) + setFriendlyModelLoadError() } finally { isAutoSwitchLocked = false } @@ -4854,7 +4857,7 @@ const focusTargetPoi = async (request: TargetPoiFocusRequest) => { console.error('目标 POI 聚焦失败:', error) loadError.value = true isLoading.value = false - setProgress(0, error instanceof Error ? error.message : '目标位置聚焦失败') + setFriendlyModelLoadError() emitTargetFocus(request, 'error', error instanceof Error ? error.message : '目标位置聚焦失败') return false } @@ -4962,7 +4965,7 @@ const init3DScene = async () => { loadError.value = true isLoading.value = false const message = error instanceof Error ? error.message : '请检查模型资源或网络状态后重试' - setProgress(0, message) + setFriendlyModelLoadError() initialModelSettled = true emit('initialModelFailed', { view: activeView.value, @@ -5010,7 +5013,7 @@ const handleFloorChange = async (floorId: string) => { console.error('楼层模型加载失败:', error) loadError.value = true restoreCommittedFloorPoiLayer() - setProgress(0, error instanceof Error ? error.message : '楼层模型加载失败') + setFriendlyModelLoadError() } finally { const requestWasSuperseded = modelLoadVersion > previousLoadToken + 1 if (!requestWasSuperseded || floorSwitchRequestedFloorId === requestedFloorId) { @@ -5039,7 +5042,7 @@ const showMultiFloor = async () => { console.error('多层展示模型加载失败:', error) loadError.value = true isLoading.value = false - setProgress(0, error instanceof Error ? error.message : '多层展示模型加载失败') + setFriendlyModelLoadError() } }