优化讲解数据请求与缓存管理
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-16 14:43:57 +08:00
parent 72885b7f54
commit d86845afeb
11 changed files with 259 additions and 137 deletions

View File

@@ -31,7 +31,7 @@ import {
explainUseCase
} from '@/usecases/explainUseCase'
import type {
ExplainBusinessUnit
ExplainGuideStop
} from '@/domain/museum'
import {
normalizeExplainDetailTargetFromGuideStop
@@ -49,8 +49,8 @@ const explainGuideStopItems = ref<ExplainGuideStopSelectItem[]>([])
const explainLoading = ref(false)
const explainError = ref('')
const toGuideStopItems = (unit: ExplainBusinessUnit): ExplainGuideStopSelectItem[] => (
unit.stops.map((stop) => ({
const toGuideStopItems = (stops: ExplainGuideStop[]): ExplainGuideStopSelectItem[] => (
stops.map((stop) => ({
id: stop.id,
name: stop.name,
hallId: stop.hallId,
@@ -99,7 +99,11 @@ onLoad(async (options: any = {}) => {
}
selectedExplainBusinessUnitName.value = unit.name || selectedExplainBusinessUnitName.value
syncPageTitle(selectedExplainBusinessUnitName.value)
explainGuideStopItems.value = toGuideStopItems(unit)
const stops = await explainUseCase.listGuideStopsByBusinessUnit(
selectedExplainHallId.value,
selectedExplainBusinessUnitId.value
)
explainGuideStopItems.value = toGuideStopItems(stops)
} catch (error) {
explainError.value = '讲解点加载失败,请稍后重试'
} finally {
@@ -118,6 +122,10 @@ const handleExplainGuideStopClick = (stop: ExplainGuideStopSelectItem) => {
targetType: target.targetType,
targetId: target.targetId
})
if (stop.hallId) params.set('hallId', stop.hallId)
if (stop.hallName) params.set('hallName', stop.hallName)
if (stop.floorId) params.set('floorId', stop.floorId)
if (stop.poiId) params.set('poiId', stop.poiId)
uni.navigateTo({
url: `/pages/exhibit/detail?${params.toString()}`