适配讲解详情聚合接口

This commit is contained in:
lyf
2026-07-22 19:40:17 +08:00
parent dd29ead041
commit 4d8cc55a5c
10 changed files with 440 additions and 152 deletions

View File

@@ -259,7 +259,7 @@ const resume = () => {
})
}
const switchLanguage = async (lang: AudioLanguage) => {
const switchLanguage = async (lang: AudioLanguage, localAudio?: AudioItem | null) => {
if (pendingLanguage.value) {
return false
}
@@ -291,6 +291,35 @@ const switchLanguage = async (lang: AudioLanguage) => {
}
try {
if (localAudio?.audioUrl) {
currentSource.value = nextSource
return await play(localAudio, {
source: nextSource,
retryOnError: retryOnError || undefined,
displayMode: preservedMode
})
}
if (localAudio) {
stopAudioElement()
currentSource.value = nextSource
currentAudio.value = {
...localAudio,
audioUrl: '',
duration: 0,
language: lang
}
visible.value = true
displayMode.value = preservedMode
playing.value = false
loading.value = false
currentTime.value = 0
duration.value = 0
error.value = '当前语言暂无语音讲解'
showToast(error.value)
return false
}
const playInfo = await audioPlayInfoRepository.getPlayInfo({
targetType: source.targetType,
targetId: source.targetId,