新增首页前置加载页并等待模型就绪
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-05 19:57:13 +08:00
parent 21d118b967
commit 4b581da81d
5 changed files with 308 additions and 1 deletions

View File

@@ -300,6 +300,8 @@ const emit = defineEmits<{
targetFocus: [result: TargetPoiFocusResult]
autoSwitch: [event: { from: 'overview' | 'floor'; to: 'overview' | 'floor'; trigger: 'zoom-in' | 'zoom-out'; distance: number }]
autoSwitchBlocked: [reason: { reason: 'loading-locked' | 'cooldown' | 'disabled' }]
initialModelReady: [event: { view: ViewMode; floorId?: string; elapsedMs?: number }]
initialModelFailed: [event: { view: ViewMode; floorId?: string; message: string; elapsedMs?: number }]
}>()
const containerRef = ref<ContainerRef>(null)
@@ -4726,6 +4728,11 @@ const init3DScene = async () => {
setProgress(100, '馆内三维模型加载完成')
isLoading.value = false
emit('initialModelReady', {
view: activeView.value,
floorId: currentFloor.value,
elapsedMs: firstModelLoadStartedAt ? Math.round(getNow() - firstModelLoadStartedAt) : undefined
})
await syncRequestedIndoorView()
queueTargetFocus(pendingTargetFocus || props.targetFocus || null)
} catch (error) {
@@ -4734,7 +4741,14 @@ const init3DScene = async () => {
console.error('馆内 3D 模型资源加载失败:', error)
loadError.value = true
isLoading.value = false
setProgress(0, error instanceof Error ? error.message : '请检查模型资源或网络状态后重试')
const message = error instanceof Error ? error.message : '请检查模型资源或网络状态后重试'
setProgress(0, message)
emit('initialModelFailed', {
view: activeView.value,
floorId: currentFloor.value,
message,
elapsedMs: firstModelLoadStartedAt ? Math.round(getNow() - firstModelLoadStartedAt) : undefined
})
}
}

View File

@@ -26,6 +26,8 @@
@selection-clear="handleSelectionClear"
@target-focus="handleTargetFocus"
@auto-switch="handleAutoSwitch"
@initial-model-ready="handleInitialModelReady"
@initial-model-failed="handleInitialModelFailed"
/>
<!-- #endif -->
<!-- #ifndef H5 -->
@@ -401,6 +403,8 @@ const emit = defineEmits<{
selectionClear: []
targetFocus: [result: TargetPoiFocusResult]
autoSwitch: [event: { from: 'overview' | 'floor'; to: 'overview' | 'floor'; trigger: string; distance: number }]
initialModelReady: [event: { view: IndoorViewMode; floorId?: string; elapsedMs?: number }]
initialModelFailed: [event: { view: IndoorViewMode; floorId?: string; message: string; elapsedMs?: number }]
mapTap: [location: { latitude: number; longitude: number }]
}>()
@@ -706,6 +710,14 @@ const handleAutoSwitch = (event: { from: 'overview' | 'floor'; to: 'overview' |
emit('autoSwitch', event)
}
const handleInitialModelReady = (event: { view: IndoorViewMode; floorId?: string; elapsedMs?: number }) => {
emit('initialModelReady', event)
}
const handleInitialModelFailed = (event: { view: IndoorViewMode; floorId?: string; message: string; elapsedMs?: number }) => {
emit('initialModelFailed', event)
}
const handleMapTap = (location: { latitude?: number; longitude?: number }) => {
const { latitude, longitude } = location
if (latitude !== undefined && longitude !== undefined) {