From 4b7782a50fdc22cd77e686128d4f2bfa5f58df07 Mon Sep 17 00:00:00 2001 From: Zyronon Date: Thu, 25 Sep 2025 01:02:38 +0800 Subject: [PATCH] save --- src/assets/css/style.scss | 17 ++++ src/components/icon/VolumeIcon.vue | 9 +- src/hooks/article.ts | 37 +++++++-- src/pages/article/BatchEditArticlePage.vue | 20 +---- src/pages/article/PracticeArticles.vue | 5 +- .../article/components/TypingArticle.vue | 41 +++------ src/pages/setting/Setting.vue | 5 +- src/pages/word/PracticeWords.vue | 69 ++++++++++----- src/pages/word/WordsPage.vue | 49 +++++++---- src/pages/word/components/TypeWord.vue | 83 +++++++++++++------ src/types/types.ts | 6 -- src/utils/const.ts | 5 ++ src/utils/index.ts | 2 + 13 files changed, 219 insertions(+), 129 deletions(-) diff --git a/src/assets/css/style.scss b/src/assets/css/style.scss index 61c5e6b0..a9c4615e 100644 --- a/src/assets/css/style.scss +++ b/src/assets/css/style.scss @@ -444,4 +444,21 @@ a { .red-point { @apply bg-red w-3 h-3 rounded-full absolute right-3; +} + +.cursor { + position: absolute; + left: 0; + top: 0; + height: 1.8rem; + animation: underline 1s infinite steps(1, start); +} + +@keyframes underline { + 0%, 100% { + border-left: .1rem solid var(--color-article); + } + 50% { + border-left: .1rem solid transparent; + } } \ No newline at end of file diff --git a/src/components/icon/VolumeIcon.vue b/src/components/icon/VolumeIcon.vue index 83bbfdec..aae73d2f 100644 --- a/src/components/icon/VolumeIcon.vue +++ b/src/components/icon/VolumeIcon.vue @@ -4,6 +4,7 @@ import BaseIcon from "@/components/BaseIcon.vue"; const props = withDefaults(defineProps<{ time?: number, simple?: boolean + title?: string cb?: Function }>(), { time: 300, @@ -49,7 +50,9 @@ defineExpose({play}) diff --git a/src/types/types.ts b/src/types/types.ts index 28ae87fa..e74c02e0 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -104,18 +104,14 @@ export enum ShortcutKey { ShowWord = 'ShowWord', EditArticle = 'EditArticle', Next = 'Next', - Replay = 'Replay', Previous = 'Previous', ToggleSimple = 'ToggleSimple', ToggleCollect = 'ToggleCollect', - //todo 这里还用老的Chapter,要改 NextChapter = 'NextChapter', PreviousChapter = 'PreviousChapter', RepeatChapter = 'RepeatChapter', - //todo 废弃 DictationChapter = 'DictationChapter', PlayWordPronunciation = 'PlayWordPronunciation', - // PlayTranslatePronunciation = 'PlayTranslatePronunciation', ToggleShowTranslate = 'ToggleShowTranslate', ToggleDictation = 'ToggleDictation', ToggleTheme = 'ToggleTheme', @@ -128,7 +124,6 @@ export const DefaultShortcutKeyMap = { [ShortcutKey.ShowWord]: 'Escape', [ShortcutKey.Previous]: 'Alt+⬅', [ShortcutKey.Next]: 'Tab', - [ShortcutKey.Replay]: 'Tab', [ShortcutKey.ToggleSimple]: '`', [ShortcutKey.ToggleCollect]: 'Enter', [ShortcutKey.PreviousChapter]: 'Ctrl+⬅', @@ -136,7 +131,6 @@ export const DefaultShortcutKeyMap = { [ShortcutKey.RepeatChapter]: 'Ctrl+Enter', [ShortcutKey.DictationChapter]: 'Alt+Enter', [ShortcutKey.PlayWordPronunciation]: 'Ctrl+P', - // [ShortcutKey.PlayTranslatePronunciation]: 'Ctrl+O', [ShortcutKey.ToggleShowTranslate]: 'Ctrl+Z', [ShortcutKey.ToggleDictation]: 'Ctrl+I', [ShortcutKey.ToggleTheme]: 'Ctrl+Q', diff --git a/src/utils/const.ts b/src/utils/const.ts index 642faa6e..2d1ad305 100644 --- a/src/utils/const.ts +++ b/src/utils/const.ts @@ -27,3 +27,8 @@ export const EXPORT_DATA_KEY = { export const LOCAL_FILE_KEY = 'typing-word-files' +export enum PracticeSaveKey { + Word = 'PracticeSaveWordKey', + Article = 'PracticeSaveArticleKey', +} + diff --git a/src/utils/index.ts b/src/utils/index.ts index 93001017..20531f63 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -222,6 +222,8 @@ export function checkAndUpgradeSaveSetting(val: any) { state.load = false let version = Number(data.version) if (version === SAVE_SETTING_KEY.version) { + checkRiskKey(defaultState.shortcutKeyMap, state.shortcutKeyMap) + delete state.shortcutKeyMap checkRiskKey(defaultState, state) return defaultState } else {