feat:重构代码
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user