优化讲解数据请求与缓存管理
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

@@ -77,8 +77,8 @@
<view class="detail-audio-dock-main">
<button
class="detail-audio-play"
:class="{ disabled: audioDockState === 'unavailable' }"
:disabled="audioDockState === 'unavailable'"
:class="{ disabled: audioDockState === 'unavailable' || audioDockState === 'loading' }"
:disabled="audioDockState === 'unavailable' || audioDockState === 'loading'"
:aria-label="detailAudioActionLabel"
@tap="handlePlayAudio"
>
@@ -193,6 +193,11 @@ const detailEntryRequest = ref<{
exhibitId: string
targetType?: AudioPlayTargetType
targetId?: string
hallId?: string
hallName?: string
floorId?: string
floorLabel?: string
poiId?: string
} | null>(null)
const detailTextByLanguage = ref<Record<AudioLanguage, string>>({
'zh-CN': defaultDetail.body,
@@ -478,7 +483,11 @@ onLoad(async (options: any = {}) => {
detailEntryRequest.value = {
exhibitId,
targetType,
targetId
targetId,
hallId: Array.isArray(options.hallId) ? options.hallId[0] : options.hallId,
hallName: Array.isArray(options.hallName) ? options.hallName[0] : options.hallName,
floorId: Array.isArray(options.floorId) ? options.floorId[0] : options.floorId,
poiId: Array.isArray(options.poiId) ? options.poiId[0] : options.poiId
}
await loadExplainDetail(detailEntryRequest.value, lang)
} catch (error) {
@@ -737,7 +746,7 @@ const playDetailAudio = async (audio: AudioItem) => {
}
const handlePlayAudio = async (options: { forceRefresh?: boolean } = {}) => {
if (audioDockState.value === 'unavailable') return
if (audioDockState.value === 'unavailable' || audioDockState.value === 'loading') return
if (isCurrentDetailAudio.value && !options.forceRefresh) {
if (globalAudioPlayer.playing.value) {