修复导览与讲解位置预览逻辑

This commit is contained in:
lyf
2026-06-30 11:00:49 +08:00
parent f2a33888b1
commit 1c2cc788d1
29 changed files with 1111 additions and 756 deletions

View File

@@ -126,11 +126,15 @@
<text class="layer-mode-label">{{ layerModeActionLabel }}</text>
</view>
<view
<scroll-view
v-if="showIndoorRightControls && showFloor"
class="floor-switcher"
:class="`side-${floorSide}`"
:style="floorSwitcherStyle"
scroll-y
:show-scrollbar="false"
:scroll-into-view="activeFloorScrollIntoView"
:scroll-with-animation="true"
>
<view
v-if="showFloorHeader"
@@ -142,15 +146,16 @@
<text class="floor-header-label">楼层</text>
</view>
<view
v-for="floor in floorLabels"
:key="floor"
v-for="floor in floorItems"
:id="floor.scrollId"
:key="floor.id"
class="floor-item"
:class="{ active: activeFloor === floor && layerMode !== 'multi' }"
@tap="handleFloorChange(floor)"
:class="{ active: activeFloorId === floor.id && layerMode !== 'multi' }"
@tap="handleFloorChange(floor.label)"
>
<text class="floor-label">{{ floor }}</text>
<text class="floor-label">{{ floor.label }}</text>
</view>
</view>
</scroll-view>
<view v-if="showZoomControls" class="zoom-controls" :style="zoomControlsStyle">
<view class="zoom-btn" @tap="handleZoomClick('in')">
@@ -364,7 +369,7 @@ const props = withDefaults(defineProps<{
dimmed: false,
targetFocusRequest: null,
touchGestureMode: 'orbit',
targetFocusDistanceFactor: 0.22,
targetFocusDistanceFactor: 0.36,
routePreview: null,
showRoute: false,
disableAutoExit: false,
@@ -415,7 +420,11 @@ const indoorRendererRef = ref<{
} | null>(null)
const indoorFloors = computed(() => props.floors.filter((floor) => isIndoorNavigableFloor(floor)))
const floorLabels = computed(() => indoorFloors.value.map((floor) => floor.label))
const createFloorScrollId = (floorId: string) => `guide-floor-${floorId.replace(/[^a-zA-Z0-9_-]/g, '-')}`
const floorItems = computed(() => indoorFloors.value.map((floor) => ({
...floor,
scrollId: createFloorScrollId(floor.id)
})))
// #ifdef H5
const effectiveIndoorModelSource = computed(() => props.indoorModelSource)
// #endif
@@ -435,6 +444,29 @@ const activeFloorId = computed(() => {
))
return normalizedFloor?.id || normalizedFloorId
})
const activeFloorScrollIntoView = ref('')
const syncActiveFloorScroll = () => {
if (props.mapType !== 'indoor' || props.indoorView === 'overview' || props.layerMode === 'multi') {
activeFloorScrollIntoView.value = ''
return
}
const matchedFloor = floorItems.value.find((floor) => floor.id === activeFloorId.value)
activeFloorScrollIntoView.value = matchedFloor?.scrollId || ''
}
watch(
() => [
activeFloorId.value,
props.indoorView,
props.layerMode,
props.mapType,
floorItems.value.map((floor) => floor.id).join('|')
],
syncActiveFloorScroll,
{ immediate: true }
)
const searchFieldStyle = computed(() => ({
top: props.searchTop

View File

@@ -22,7 +22,7 @@
<view class="action-row">
<view class="action-btn secondary" @tap="emit('viewOutdoorMap')">
<text class="action-text">外入口参考</text>
<text class="action-text">外入口参考</text>
</view>
<view class="action-btn primary" @tap="handleShowTargetLocation">
<text class="action-text">查看三维位置</text>

View File

@@ -220,7 +220,7 @@ const canNavigate = computed(() => {
const navigateButtonText = computed(() => {
if (props.loading) return '规划中...'
if (hasRoute.value) return '开始导航'
if (hasRoute.value) return '打开地图'
return '规划路线'
})

View File

@@ -195,17 +195,11 @@ const canViewRoute = computed(() => Boolean(
const canPrimaryAction = computed(() => canViewRoute.value && !props.error)
const primaryActionText = computed(() => (
props.hasRoutePreview
? '开始导览'
: (props.routeReady ? '查看路线' : '查看位置关系')
))
const primaryActionText = computed(() => '查看位置关系')
const routeOptionsTitle = computed(() => '馆内导览')
const loadingText = computed(() => (
props.routeReady ? '正在规划馆内导览路线' : '正在生成馆内位置关系'
))
const loadingText = computed(() => '正在生成馆内位置关系')
const collapsedSummary = computed(() => {
if (props.startPoint && props.endPoint) {
@@ -217,7 +211,7 @@ const collapsedSummary = computed(() => {
const routeOptions = computed(() => {
const unavailable = Boolean(props.error)
const summaryText = props.summary || (props.routeReady ? '选择后规划真实路线' : '选择后查看位置关系')
const summaryText = props.summary || '选择后查看位置关系'
return [
{
id: 'recommended',
@@ -226,23 +220,21 @@ const routeOptions = computed(() => {
? '当前暂不可用'
: props.hasRoutePreview
? summaryText
: props.routeReady
? '调用 SGS SDK 路线规划'
: '查看起点终点位置关系',
: '查看起点终点位置关系',
active: !unavailable,
disabled: unavailable
},
{
id: 'stairs',
title: '少走楼梯',
meta: props.routeReady ? '偏好能力待接入' : '偏好预览,待路线数据验证',
meta: '偏好预览,待路线数据验证',
active: false,
disabled: true
},
{
id: 'elevator',
title: '电梯优先',
meta: props.routeReady ? '偏好能力待接入' : '偏好预览,待路线数据验证',
meta: '偏好预览,待路线数据验证',
active: false,
disabled: true
}