接入编号讲解后端查询
Some checks failed
CI / verify (push) Has been cancelled

- 使用真实讲解编号解析接口替换本地演示映射
- 成功后复用现有详情页并自动播放讲解
- 增加查询状态、业务错误提示和相关测试

Made-with: Proma
This commit is contained in:
lyf
2026-08-25 18:00:52 +08:00
parent 00585a7b48
commit 130f155bdf
13 changed files with 490 additions and 13 deletions

View File

@@ -246,6 +246,7 @@ const detailTextLoadedByLanguage = ref<Record<AudioLanguage, boolean>>({
'en-US': false
})
const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
const shouldAutoplayOnEntry = ref(false)
const isAudioLanguage = (value: unknown): value is AudioLanguage => (
value === 'zh-CN' || value === 'yue-HK' || value === 'en-US'
@@ -531,6 +532,8 @@ onLoad(async (options: any = {}) => {
return
}
const rawLang = Array.isArray(options.lang) ? options.lang[0] : options.lang
const rawAutoplay = Array.isArray(options.autoplay) ? options.autoplay[0] : options.autoplay
shouldAutoplayOnEntry.value = rawAutoplay === '1' || rawAutoplay === 'true'
const lang = typeof rawLang === 'string'
? normalizeGuideAudioLanguage(rawLang)
: 'zh-CN'
@@ -545,6 +548,18 @@ onLoad(async (options: any = {}) => {
poiId: Array.isArray(options.poiId) ? options.poiId[0] : options.poiId
}
await loadExplainDetail(detailEntryRequest.value, lang)
if (shouldAutoplayOnEntry.value) {
shouldAutoplayOnEntry.value = false
try {
await handlePlayAudio()
} catch (error) {
console.warn('自动播放讲解失败,将等待用户手动播放:', error)
uni.showToast({
title: '点击底部播放键开始讲解',
icon: 'none'
})
}
}
} catch (error) {
console.error('讲解详情加载失败:', error)
detailState.value = 'error'