diff --git a/components.d.ts b/components.d.ts index 2b805ad6..4071719a 100644 --- a/components.d.ts +++ b/components.d.ts @@ -24,9 +24,6 @@ declare module 'vue' { EditArticle: typeof import('./src/components/Article/EditArticle.vue')['default'] EditBatchArticleModal: typeof import('./src/components/Article/EditBatchArticleModal.vue')['default'] EditSingleArticleModal: typeof import('./src/components/Article/EditSingleArticleModal.vue')['default'] - ElButton: typeof import('element-plus/es')['ElButton'] - ElForm: typeof import('element-plus/es')['ElForm'] - ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElOption: typeof import('element-plus/es')['ElOption'] diff --git a/src/components/Modal/SettingModal.vue b/src/components/Modal/SettingModal.vue index 3c41d24d..b21af740 100644 --- a/src/components/Modal/SettingModal.vue +++ b/src/components/Modal/SettingModal.vue @@ -4,12 +4,14 @@ import {useBaseStore} from "@/stores/base.ts" import {Icon} from '@iconify/vue'; import {watch, ref} from "vue"; import {useSettingStore} from "@/stores/setting.ts"; -import {useChangeAllSound, useWatchAllSound} from "@/hooks/sound.ts"; +import {getAudioFileUrl, useChangeAllSound, usePlayAudio, useWatchAllSound} from "@/hooks/sound.ts"; import {getShortcutKey, useDisableEventListener, useEventListener} from "@/hooks/event.ts"; import {$computed, $ref} from "vue/macros"; import {cloneDeep} from "lodash-es"; import {DefaultShortcutKeyMap, ShortcutKey} from "@/types.ts"; import BaseButton from "@/components/BaseButton.vue"; +import {SoundFileOptions} from "@/utils/const.ts"; +import VolumeIcon from "@/components/icon/VolumeIcon.vue"; const tabIndex = $ref(0) const settingStore = useSettingStore() @@ -105,7 +107,7 @@ function resetShortcutKeyMap() {
- +
+
+ +
+ + + + +
+
@@ -124,7 +137,7 @@ function resetShortcutKeyMap() {
- + {{ settingStore.wordSoundSpeed }}
@@ -139,6 +152,28 @@ function resetShortcutKeyMap() { />
+
+ +
+ + +
+ {{ item.label }} + +
+
+
+
+
@@ -147,23 +182,23 @@ function resetShortcutKeyMap() {
-
- -
- -
-
-
- -
- - {{ settingStore.translateSoundVolume }}% -
-
+ + + + + + + + + + + + + + + + +
@@ -185,7 +220,7 @@ function resetShortcutKeyMap() {
- +
- 开启后,练习中会在上方展示上一个/下一个单词 + 开启后,练习中会在上方显示上一个/下一个单词
- +
- +
\ No newline at end of file diff --git a/src/components/Practice/Panel.vue b/src/components/Practice/Panel.vue index df7255ac..5a5f20e5 100644 --- a/src/components/Practice/Panel.vue +++ b/src/components/Practice/Panel.vue @@ -4,7 +4,7 @@ import WordList from "@/components/list/WordList.vue" import {$ref} from "vue/macros" import {computed, provide, watch} from "vue" -import {Dict, DictType} from "@/types.ts" +import {Dict, DictType, ShortcutKey} from "@/types.ts" import PopConfirm from "@/components/PopConfirm.vue" import BaseButton from "@/components/BaseButton.vue"; import {useSettingStore} from "@/stores/setting.ts"; @@ -47,9 +47,12 @@ const {
- + + +
当前
diff --git a/src/components/Practice/Practice.vue b/src/components/Practice/Practice.vue index ff1f741c..036e6f40 100644 --- a/src/components/Practice/Practice.vue +++ b/src/components/Practice/Practice.vue @@ -105,7 +105,7 @@ function openDictDetail() { function toggleConciseMode() { settingStore.showToolbar = !settingStore.showToolbar - settingStore.showPanel = !settingStore.showPanel + settingStore.showPanel = settingStore.showToolbar } function togglePanel() { diff --git a/src/components/Toolbar/Toolbar.vue b/src/components/Toolbar/Toolbar.vue index 7e8104a6..6091ccb9 100644 --- a/src/components/Toolbar/Toolbar.vue +++ b/src/components/Toolbar/Toolbar.vue @@ -123,9 +123,11 @@ watch(() => store.load, n => { - + - + @@ -188,6 +190,7 @@ header { align-items: center; cursor: pointer; transition: all .3s; + max-width: 45%; &:hover { background: var(--color-main-active); @@ -219,6 +222,8 @@ header { } .with-bg { + display: flex; + align-items: center; position: relative; background: var(--color-second-bg); } diff --git a/src/hooks/sound.ts b/src/hooks/sound.ts index d7e45b82..ca76c76b 100644 --- a/src/hooks/sound.ts +++ b/src/hooks/sound.ts @@ -23,11 +23,13 @@ export function useSound(audioSrcList?: string[], audioFileLength?: number) { index = 0 } - function play() { + function play(volume: number = 100) { index++ if (audioList.length > 1 && audioList.length !== audioLength) { + audioList[index % audioList.length].volume = volume / 100 audioList[index % audioList.length].play() } else { + audioList[index % audioLength].volume = volume / 100 audioList[index % audioLength].play() } } @@ -35,6 +37,7 @@ export function useSound(audioSrcList?: string[], audioFileLength?: number) { return {play, setAudio} } + export function usePlayKeyboardAudio() { const settingStore = useSettingStore() const {play, setAudio} = useSound() @@ -46,7 +49,7 @@ export function usePlayKeyboardAudio() { function playAudio() { if (settingStore.keyboardSound) { - play() + play(settingStore.keyboardSoundVolume) } } @@ -59,7 +62,7 @@ export function usePlayBeep() { function playAudio() { if (settingStore.effectSound) { - play() + play(settingStore.effectSoundVolume) } } @@ -72,7 +75,7 @@ export function usePlayCorrect() { function playAudio() { if (settingStore.effectSound) { - play() + play(settingStore.effectSoundVolume) } } @@ -89,6 +92,8 @@ export function usePlayWordAudio() { } else if (settingStore.wordSoundType === 'us') { audio.src = `${PronunciationApi}${word}&type=2` } + audio.volume = settingStore.wordSoundVolume / 100 + audio.playbackRate = settingStore.wordSoundSpeed audio.play() } @@ -111,14 +116,13 @@ export function useTTsPlayAudio() { msg.lang = 'zh-CN'; isPlay = true window.speechSynthesis.speak(msg); - console.log('text',text) + console.log('text', text) } return play } - export function usePlayAudio(url: string) { new Audio(url).play().then(r => void 0) } diff --git a/src/stores/base.ts b/src/stores/base.ts index f6b168fc..9448eacc 100644 --- a/src/stores/base.ts +++ b/src/stores/base.ts @@ -228,9 +228,7 @@ export const useBaseStore = defineStore('base', { if (res) w = Object.assign(w, res) }) - setTimeout(()=>{ - resolve(true) - },5000) + resolve(true) }) }) } else {