feat: wire guide data source and POI focus UI

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
lyf
2026-06-12 09:25:22 +08:00
parent a6bfda30e1
commit 2055b13b90
58 changed files with 5768 additions and 1898 deletions

View File

@@ -50,7 +50,7 @@
<view class="action-btn-group">
<view class="action-btn" @tap="handleNavigate">
<text class="btn-icon">🗺</text>
<text class="btn-text">导航</text>
<text class="btn-text">查看位置</text>
</view>
<view class="action-btn" @tap="handleCollect">
<text class="btn-icon">{{ isCollected ? '❤️' : '🤍' }}</text>
@@ -70,32 +70,39 @@
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import GuidePageFrame from '@/components/navigation/GuidePageFrame.vue'
import {
explainUseCase
} from '@/usecases/explainUseCase'
import {
toExplainDetailViewModel,
type ExplainDetailViewModel
} from '@/view-models/explainViewModels'
import {
isGuideTopTab,
navigateToGuideTopTab,
type GuideTopTab
} from '@/utils/guideTopTabs'
const exhibit = ref({
id: '1',
name: '蒙娜丽莎',
artist: '列奥纳多·达·芬奇',
year: '1503-1519',
material: '木板油画',
size: '77cm × 53cm',
hall: '1号展厅 1F',
const exhibit = ref<ExplainDetailViewModel>({
id: '',
name: '展项内容',
hall: '展厅位置待补充',
image: '/static/exhibit-placeholder.jpg',
description: '《蒙娜丽莎》是意大利文艺复兴时期画家列奥纳多·达·芬奇创作的油画,现收藏于法国卢浮宫博物馆。该画作主要表现了女性的典雅和恬静的典型形象,塑造了资本主义上升时期一位城市有产阶级的妇女形象。'
description: '该展项介绍待正式内容库补充。',
hasAudio: false,
audioUnavailableReason: '正式讲解音频尚未接入媒体仓储'
})
const isPlaying = ref(false)
const isCollected = ref(false)
const activeTopTab = ref<GuideTopTab>('guide')
onLoad((options: any) => {
onLoad(async (options: any) => {
if (options.id) {
// 根据 ID 加载展品数据
console.log('加载展品:', options.id)
const exhibitData = await explainUseCase.getExhibitById(options.id)
if (exhibitData) {
exhibit.value = toExplainDetailViewModel(exhibitData)
}
}
const tab = Array.isArray(options.tab) ? options.tab[0] : options.tab
@@ -104,14 +111,29 @@ onLoad((options: any) => {
}
})
const handlePlayAudio = () => {
isPlaying.value = !isPlaying.value
console.log('播放/暂停音频')
const handlePlayAudio = async () => {
const selection = exhibit.value.id
? await explainUseCase.selectAudioForExhibit(exhibit.value.id)
: null
uni.showToast({
title: selection?.unavailableMessage || exhibit.value.audioUnavailableReason || '该展项暂无讲解音频',
icon: 'none'
})
}
const handleNavigate = () => {
console.log('导航到展品位置')
uni.navigateBack()
if (!exhibit.value.poiId) {
uni.showToast({
title: '该展项暂无三维位置数据',
icon: 'none'
})
return
}
uni.navigateTo({
url: `/pages/route/detail?facilityId=${encodeURIComponent(exhibit.value.poiId)}&target=${encodeURIComponent(exhibit.value.name)}&state=preview`
})
}
const handleCollect = () => {