feat:重构代码

This commit is contained in:
zyronon
2025-07-16 23:40:41 +08:00
parent d59bab48fc
commit 7bedaafcc0
24 changed files with 114 additions and 1092 deletions

View File

@@ -89,7 +89,6 @@ export function usePlayCorrect() {
export function usePlayWordAudio() {
const settingStore = useSettingStore()
const store = useBaseStore()
const audio = $ref(new Audio())
function playAudio(word: string) {
@@ -99,12 +98,6 @@ export function usePlayWordAudio() {
} else if (settingStore.wordSoundType === 'us') {
url = `${PronunciationApi}${word}&type=2`
}
if (store.currentDict.language === 'ja') {
url += '&le=jap'
}
if (store.currentDict.language === 'de') {
url += '&le=de'
}
audio.src = url
audio.volume = settingStore.wordSoundVolume / 100
audio.playbackRate = settingStore.wordSoundSpeed
@@ -160,7 +153,6 @@ export function useWatchAllSound() {
watch([
() => settingStore.wordSound,
() => settingStore.keyboardSound,
() => settingStore.translateSound,
() => settingStore.effectSound,
], (n) => {
settingStore.allSound = n.some(v => v);
@@ -173,6 +165,5 @@ export function useChangeAllSound(e: boolean) {
settingStore.allSound = e
settingStore.wordSound = e
settingStore.keyboardSound = e
settingStore.translateSound = e
settingStore.effectSound = e
}
}