feat: 支持讲解详情页粤语语音切换
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-14 18:25:45 +08:00
parent 04c6ccd40b
commit d813f0b375
12 changed files with 291 additions and 70 deletions

View File

@@ -119,6 +119,7 @@
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
import type { AudioLanguage as RepositoryAudioLanguage } from '@/repositories/AudioPlayInfoRepository'
export interface AudioItem {
id: string
name: string
@@ -129,7 +130,7 @@ export interface AudioItem {
supportedLanguages?: AudioLanguage[]
}
export type AudioLanguage = 'zh-CN' | 'en-US'
export type AudioLanguage = RepositoryAudioLanguage
export type AudioDisplayMode = 'expanded' | 'mini' | 'floating'
const props = defineProps<{
@@ -202,7 +203,11 @@ const displayMode = computed<AudioDisplayMode>(() => props.mode || 'mini')
const closable = computed(() => props.closable !== false)
const expandable = computed(() => props.expandable !== false)
const displayAudioLanguage = computed<AudioLanguage>(() => (
displayAudio.value?.language === 'en-US' ? 'en-US' : 'zh-CN'
displayAudio.value?.language === 'en-US'
? 'en-US'
: displayAudio.value?.language === 'yue-HK'
? 'yue-HK'
: 'zh-CN'
))
const formattedCurrentTime = computed(() => formatTime(displayCurrentTime.value))
const formattedDuration = computed(() => formatTime(resolvedDuration.value))
@@ -210,7 +215,9 @@ const expandedSubtitle = computed(() => {
if (displayPlaybackError.value) return displayPlaybackError.value
if (displayLoading.value) return '音频加载中'
if (!displayAudio.value?.audioUrl) return '当前语言暂无语音讲解'
return displayAudioLanguage.value === 'en-US' ? '英文语音讲解' : '中文语音讲解'
if (displayAudioLanguage.value === 'en-US') return '英文语音讲解'
if (displayAudioLanguage.value === 'yue-HK') return '粤语语音讲解'
return '中文语音讲解'
})
// 格式化时间