diff --git a/components.d.ts b/components.d.ts index 20e2399b..ea0d8f0b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -19,7 +19,6 @@ declare module 'vue' { BaseList: typeof import('./src/components/list/BaseList.vue')['default'] BasePage: typeof import('./src/components/BasePage.vue')['default'] BaseTable: typeof import('./src/components/BaseTable.vue')['default'] - BaseTable2: typeof import('./src/components/BaseTable2.vue')['default'] Book: typeof import('./src/components/Book.vue')['default'] ChannelIcons: typeof import('./src/components/ChannelIcons/ChannelIcons.vue')['default'] Checkbox: typeof import('./src/components/base/checkbox/Checkbox.vue')['default'] @@ -51,7 +50,6 @@ declare module 'vue' { IconFluentArrowClockwise20Regular: typeof import('~icons/fluent/arrow-clockwise20-regular')['default'] IconFluentArrowDownload20Regular: typeof import('~icons/fluent/arrow-download20-regular')['default'] IconFluentArrowLeft16Regular: typeof import('~icons/fluent/arrow-left16-regular')['default'] - IconFluentArrowMove20Regular: typeof import('~icons/fluent/arrow-move20-regular')['default'] IconFluentArrowRepeatAll20Regular: typeof import('~icons/fluent/arrow-repeat-all20-regular')['default'] IconFluentArrowRight16Regular: typeof import('~icons/fluent/arrow-right16-regular')['default'] IconFluentArrowShuffle16Regular: typeof import('~icons/fluent/arrow-shuffle16-regular')['default'] @@ -125,10 +123,12 @@ declare module 'vue' { IconMaterialSymbolsMail: typeof import('~icons/material-symbols/mail')['default'] IconMdiSparkles: typeof import('~icons/mdi/sparkles')['default'] IconPhExportLight: typeof import('~icons/ph/export-light')['default'] + IconPhMicrosoftWordLogoLight: typeof import('~icons/ph/microsoft-word-logo-light')['default'] IconRiTwitterFill: typeof import('~icons/ri/twitter-fill')['default'] IconSimpleIconsGithub: typeof import('~icons/simple-icons/github')['default'] IconSimpleIconsWechat: typeof import('~icons/simple-icons/wechat')['default'] IconSimpleIconsXiaohongshu: typeof import('~icons/simple-icons/xiaohongshu')['default'] + IconStreamlineColorPenDrawFlat: typeof import('~icons/streamline-color/pen-draw-flat')['default'] IconStreamlineDiscountPercentCoupon: typeof import('~icons/streamline/discount-percent-coupon')['default'] IconSystemUiconsImport: typeof import('~icons/system-uicons/import')['default'] IconUiwAlipay: typeof import('~icons/uiw/alipay')['default'] diff --git a/package.json b/package.json index f8e89b2a..ac71b78e 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@iconify-json/ri": "^1.2.5", "@iconify-json/simple-icons": "^1.2.48", "@iconify-json/streamline": "^1.2.5", + "@iconify-json/streamline-color": "^1.2.2", "@iconify-json/system-uicons": "^1.2.4", "@iconify-json/uiw": "^1.2.3", "@types/file-saver": "^2.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5240a8fa..5910fe57 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -108,6 +108,9 @@ importers: '@iconify-json/streamline': specifier: ^1.2.5 version: 1.2.5 + '@iconify-json/streamline-color': + specifier: ^1.2.2 + version: 1.2.2 '@iconify-json/system-uicons': specifier: ^1.2.4 version: 1.2.4 @@ -571,6 +574,9 @@ packages: '@iconify-json/simple-icons@1.2.48': resolution: {integrity: sha512-EACOtZMoPJtERiAbX1De0asrrCtlwI27+03c9OJlYWsly9w1O5vcD8rTzh+kDPjo+K8FOVnq2Qy+h/CzljSKDA==} + '@iconify-json/streamline-color@1.2.2': + resolution: {integrity: sha512-+ypc4kzeKTFbHVM2uNWFqt1iR7E4XeMTI3Wa3LcmeHLPjyk6u6e9NJqqOHUU02rpA8GaN80XHySXzX+4DuZbzA==} + '@iconify-json/streamline@1.2.5': resolution: {integrity: sha512-u6l9BOJoIIPjjDXWl6D/hPDzeBk5WiaEHZ+U9SbkQ14N9hgotaYyIZVMfgF175CG1TTS06j8k15D3FM2OYaFIw==} @@ -4263,6 +4269,10 @@ snapshots: dependencies: '@iconify/types': 2.0.0 + '@iconify-json/streamline-color@1.2.2': + dependencies: + '@iconify/types': 2.0.0 + '@iconify-json/streamline@1.2.5': dependencies: '@iconify/types': 2.0.0 diff --git a/src/config/env.ts b/src/config/env.ts index c0c1ee9c..81d15e4d 100644 --- a/src/config/env.ts +++ b/src/config/env.ts @@ -19,7 +19,7 @@ export const ENV = Object.assign(map['DEV'], common) export let AppEnv = { TOKEN: localStorage.getItem('token') ?? '', - IS_OFFICIAL: true, + IS_OFFICIAL: false, IS_LOGIN: false, CAN_REQUEST: false, } @@ -92,6 +92,7 @@ export const TourConfig = { total: 7, } +export const IS_DEV = import.meta.env.MODE === 'development' export const LIB_JS_URL = { SHEPHERD: import.meta.env.MODE === 'development' diff --git a/src/hooks/dict.ts b/src/hooks/dict.ts index 1989ff1e..8253688b 100644 --- a/src/hooks/dict.ts +++ b/src/hooks/dict.ts @@ -144,12 +144,12 @@ export function getCurrentStudyWord(): TaskWords { } } - //如果是自由模式,那么统统设置到new字段里面去 - if (settingStore.wordPracticeMode === WordPracticeMode.Free) { - data.new = data.new.length ? data.new : data.review - data.review = [] - return data - } + // //如果是自由模式,那么统统设置到new字段里面去 + // if (settingStore.wordPracticeMode === WordPracticeMode.Free) { + // data.new = data.new.length ? data.new : data.review + // data.review = [] + // return data + // } // 上上次更早的单词 //默认只取start之前的单词 diff --git a/src/pages/word/PracticeWords.vue b/src/pages/word/PracticeWords.vue index 5f851143..d53c966e 100644 --- a/src/pages/word/PracticeWords.vue +++ b/src/pages/word/PracticeWords.vue @@ -12,6 +12,7 @@ import { TaskWords, Word, WordPracticeMode, + WordPracticeStage, WordPracticeType, } from '@/types/types.ts' import { @@ -45,7 +46,14 @@ import { getDefaultDict, getDefaultWord } from '@/types/func.ts' import ConflictNotice from '@/components/ConflictNotice.vue' import PracticeLayout from '@/components/PracticeLayout.vue' -import { AppEnv, DICT_LIST, LIB_JS_URL, PracticeSaveWordKey, TourConfig } from '@/config/env.ts' +import { + AppEnv, + DICT_LIST, + IS_DEV, + LIB_JS_URL, + PracticeSaveWordKey, + TourConfig, +} from '@/config/env.ts' import { ToastInstance } from '@/components/base/toast/type.ts' import { watchOnce } from '@vueuse/core' import { setUserDictProp } from '@/apis' @@ -115,11 +123,11 @@ async function loadDict() { } watch( - () => store.load, - n => { - if (n && loading) loadDict() - }, - { immediate: true } + () => store.load, + n => { + if (n && loading) loadDict() + }, + { immediate: true } ) onMounted(() => { @@ -144,50 +152,50 @@ onUnmounted(() => { }) watchOnce( - () => data.words.length, - (newVal, oldVal) => { - //如果是从无值变有值,代表是开始 - if (!oldVal && newVal) { - _nextTick(async () => { - const Shepherd = await loadJsLib('Shepherd', LIB_JS_URL.SHEPHERD) - const tour = new Shepherd.Tour(TourConfig) - tour.on('cancel', () => { - localStorage.setItem('tour-guide', '1') - }) - tour.addStep({ - id: 'step5', - text: '这里可以练习拼写单词,只需要按下键盘上对应的按键即可,没有输入框!', - attachTo: { element: '#word', on: 'bottom' }, - buttons: [ - { - text: `下一步(5/${TourConfig.total})`, - action: tour.next, - }, - ], - }) + () => data.words.length, + (newVal, oldVal) => { + //如果是从无值变有值,代表是开始 + if (!oldVal && newVal) { + _nextTick(async () => { + const Shepherd = await loadJsLib('Shepherd', LIB_JS_URL.SHEPHERD) + const tour = new Shepherd.Tour(TourConfig) + tour.on('cancel', () => { + localStorage.setItem('tour-guide', '1') + }) + tour.addStep({ + id: 'step5', + text: '这里可以练习拼写单词,只需要按下键盘上对应的按键即可,没有输入框!', + attachTo: { element: '#word', on: 'bottom' }, + buttons: [ + { + text: `下一步(5/${TourConfig.total})`, + action: tour.next, + }, + ], + }) - tour.addStep({ - id: 'step6', - text: '这里是文章练习', - attachTo: { element: '#article', on: 'top' }, - buttons: [ - { - text: `下一步(6/${TourConfig.total})`, - action() { - tour.next() - router.push('/articles') - }, + tour.addStep({ + id: 'step6', + text: '这里是文章练习', + attachTo: { element: '#article', on: 'top' }, + buttons: [ + { + text: `下一步(6/${TourConfig.total})`, + action() { + tour.next() + router.push('/articles') }, - ], - }) + }, + ], + }) - const r = localStorage.getItem('tour-guide') - if (settingStore.first && !r && !isMobile()) { - tour.start() - } - }, 500) - } + const r = localStorage.getItem('tour-guide') + if (settingStore.first && !r && !isMobile()) { + tour.start() + } + }, 500) } + } ) useStartKeyboardEventListener() @@ -197,6 +205,10 @@ function initData(initVal: TaskWords, init: boolean = false) { let d = localStorage.getItem(PracticeSaveWordKey.key) if (d && init) { try { + //todo 记得删除 + if (IS_DEV) { + throw new Error('开发环境,抛出错误跳过缓存') + } let obj = JSON.parse(d) let s = obj.val taskWords = Object.assign(taskWords, s.taskWords) @@ -211,71 +223,41 @@ function initData(initVal: TaskWords, init: boolean = false) { // taskWords = initVal //不能直接赋值,会导致 inject 的数据为默认值 taskWords = Object.assign(taskWords, initVal) - - // 检查是否为独立模式 - const isStandaloneMode = settingStore.wordPracticeMode >= WordPracticeMode.DictationOnly - - if (isStandaloneMode) { - // 独立模式:根据模式设置对应的练习类型 - switch (settingStore.wordPracticeMode) { - case WordPracticeMode.DictationOnly: - settingStore.wordPracticeType = WordPracticeType.Dictation - break - case WordPracticeMode.ListenOnly: - settingStore.wordPracticeType = WordPracticeType.Listen - break - case WordPracticeMode.IdentifyOnly: - settingStore.wordPracticeType = WordPracticeType.Identify - break - case WordPracticeMode.FollowWriteOnly: - settingStore.wordPracticeType = WordPracticeType.FollowWrite - break - } - - // 独立模式:按优先级选择起始单词列表(新词 -> 复习上次 -> 复习之前) - let selectedWords: Word[] = [] - if (taskWords.new.length > 0) { - currentWordListStage = 'new' - selectedWords = taskWords.new - } else if (taskWords.review.length > 0) { - currentWordListStage = 'review' - selectedWords = taskWords.review - } else if (taskWords.write.length > 0) { - currentWordListStage = 'write' - selectedWords = taskWords.write - } else { - Toast.warning('没有可学习的单词!') - router.push('/word') - return - } - - data.words = selectedWords - statStore.step = 0 // 独立模式不使用 step 逻辑 - statStore.total = taskWords.review.length + taskWords.new.length + taskWords.write.length - statStore.newWordNumber = taskWords.new.length - statStore.reviewWordNumber = taskWords.review.length - statStore.writeWordNumber = taskWords.write.length - } else if (taskWords.shuffle.length === 0) { - // 原有的智能模式逻辑 + + if (taskWords.shuffle.length === 0) { if (taskWords.new.length === 0) { if (taskWords.review.length) { settingStore.wordPracticeType = WordPracticeType.Identify statStore.step = 3 + statStore.stage = WordPracticeStage.IdentifyReview data.words = taskWords.review } else { if (taskWords.write.length) { settingStore.wordPracticeType = WordPracticeType.Identify data.words = taskWords.write statStore.step = 6 + statStore.stage = WordPracticeStage.IdentifyReviewAll } else { Toast.warning('没有可学习的单词!') router.push('/word') } } } else { - settingStore.wordPracticeType = WordPracticeType.FollowWrite data.words = taskWords.new statStore.step = 0 + if (settingStore.wordPracticeMode === WordPracticeMode.System) { + statStore.stage = WordPracticeStage.FollowWriteNewWord + } else if (settingStore.wordPracticeMode === WordPracticeMode.Free) { + statStore.stage = WordPracticeStage.FollowWriteNewWord + } else if (settingStore.wordPracticeMode === WordPracticeMode.IdentifyOnly) { + statStore.stage = WordPracticeStage.IdentifyNewWord + } else if (settingStore.wordPracticeMode === WordPracticeMode.DictationOnly) { + statStore.stage = WordPracticeStage.DictationNewWord + } else if (settingStore.wordPracticeMode === WordPracticeMode.ListenOnly) { + statStore.stage = WordPracticeStage.ListenNewWord + } else if (settingStore.wordPracticeMode === WordPracticeMode.FollowWriteOnly) { + statStore.stage = WordPracticeStage.FollowWriteNewWord + } } statStore.total = taskWords.review.length + taskWords.new.length + taskWords.write.length statStore.newWordNumber = taskWords.new.length @@ -285,6 +267,7 @@ function initData(initVal: TaskWords, init: boolean = false) { settingStore.wordPracticeType = WordPracticeType.Dictation data.words = taskWords.shuffle statStore.step = 10 + statStore.stage = WordPracticeStage.Shuffle statStore.total = taskWords.shuffle.length statStore.newWordNumber = 0 statStore.reviewWordNumber = 0 @@ -321,31 +304,34 @@ const nextWord: Word = $computed(() => { }) watch( - () => settingStore.wordPracticeType, - n => { - // Free 模式不自动设置,System 模式和独立模式都需要设置 - if (settingStore.wordPracticeMode === WordPracticeMode.Free) return - switch (n) { - case WordPracticeType.Spell: - case WordPracticeType.Dictation: - settingStore.dictation = true - settingStore.translate = true - break - case WordPracticeType.Listen: - settingStore.dictation = true - settingStore.translate = false - break - case WordPracticeType.FollowWrite: - settingStore.dictation = false - settingStore.translate = true - break - case WordPracticeType.Identify: - settingStore.dictation = false - settingStore.translate = false - break - } - }, - { immediate: true } + () => settingStore.wordPracticeMode, + n => { + // Free 模式不自动设置,System 模式和独立模式都需要设置 + if (settingStore.wordPracticeMode === WordPracticeMode.Free) return + switch (n) { + case WordPracticeMode.DictationOnly: + settingStore.dictation = true + settingStore.translate = true + settingStore.wordPracticeType = WordPracticeType.Dictation + break + case WordPracticeMode.ListenOnly: + settingStore.dictation = true + settingStore.translate = false + settingStore.wordPracticeType = WordPracticeType.Listen + break + case WordPracticeMode.FollowWriteOnly: + settingStore.dictation = false + settingStore.translate = true + settingStore.wordPracticeType = WordPracticeType.FollowWrite + break + case WordPracticeMode.IdentifyOnly: + settingStore.dictation = false + settingStore.translate = false + settingStore.wordPracticeType = WordPracticeType.Identify + break + } + }, + { immediate: true } ) const groupSize = 7 @@ -389,11 +375,29 @@ function goNextStep(originList, mode, msg) { } } +function nextStage(originList, log, nextStage) { + //每次都判断,因为每次都可能新增已掌握的单词 + let list = originList.filter(v => !data.excludeWords.includes(v.word)) + console.log(log) + if (list.length) { + if (toastInstance) toastInstance.close() + toastInstance = Toast.info('输入完成后按空格键切换下一个', { duration: 5000 }) + data.words = list + data.index = 0 + statStore.stage = nextStage + } else { + console.log(log + ':无单词略过') + statStore.stage = nextStage + next() + } +} + async function next(isTyping: boolean = true) { + debugger if (isTyping) statStore.inputWordNumber++ if (settingStore.wordPracticeMode === WordPracticeMode.Free) { if (data.index === data.words.length - 1) { - data.wrongWords = data.wrongWords.filter(v => (!data.excludeWords.includes(v.word))) + data.wrongWords = data.wrongWords.filter(v => !data.excludeWords.includes(v.word)) if (data.wrongWords.length) { isTypingWrongWord.value = true settingStore.wordPracticeType = WordPracticeType.FollowWrite @@ -410,62 +414,9 @@ async function next(isTyping: boolean = true) { } else { data.index++ } - } else if (settingStore.wordPracticeMode >= WordPracticeMode.DictationOnly) { - // 独立模式 - if (data.index === data.words.length - 1) { - // 处理错词 - data.wrongWords = data.wrongWords.filter(v => (!data.excludeWords.includes(v.word))) - if (data.wrongWords.length) { - isTypingWrongWord.value = true - console.log('当前学完了,但还有错词') - data.words = shuffle(cloneDeep(data.wrongWords)) - data.index = 0 - data.wrongWords = [] - } else { - isTypingWrongWord.value = false - // 按顺序切换到下一个单词列表:新词 -> 复习上次 -> 复习之前 -> 结束 - let nextWords: Word[] = [] - let nextStage: 'new' | 'review' | 'write' | 'finished' = 'finished' - - if (currentWordListStage === 'new') { - // 新词完成,切换到复习上次 - if (taskWords.review.length > 0) { - nextWords = taskWords.review - nextStage = 'review' - } else if (taskWords.write.length > 0) { - // 如果没有复习上次,直接跳到复习之前 - nextWords = taskWords.write - nextStage = 'write' - } - } else if (currentWordListStage === 'review') { - // 复习上次完成,切换到复习之前 - if (taskWords.write.length > 0) { - nextWords = taskWords.write - nextStage = 'write' - } - } - // currentWordListStage === 'write' 时,nextStage 保持为 'finished' - - if (nextStage === 'finished') { - // 全部完成 - console.log('独立模式,全完学完了') - showStatDialog = true - clearInterval(timer) - setTimeout(() => localStorage.removeItem(PracticeSaveWordKey.key), 300) - } else { - // 切换到下一个阶段 - currentWordListStage = nextStage - data.words = nextWords - data.index = 0 - // 保持相同的练习类型 - } - } - } else { - data.index++ - } } else { if (data.index === data.words.length - 1) { - if (statStore.step === 0 || isTypingWrongWord.value) { + if (statStore.stage === WordPracticeStage.FollowWriteNewWord || isTypingWrongWord.value) { if (settingStore.wordPracticeType !== WordPracticeType.Spell) { //回到最后一组的开始位置 data.index = Math.floor(data.index / groupSize) * groupSize @@ -474,7 +425,7 @@ async function next(isTyping: boolean = true) { return } } - data.wrongWords = data.wrongWords.filter(v => (!data.excludeWords.includes(v.word))) + data.wrongWords = data.wrongWords.filter(v => !data.excludeWords.includes(v.word)) if (data.wrongWords.length) { isTypingWrongWord.value = true settingStore.wordPracticeType = WordPracticeType.FollowWrite @@ -485,57 +436,87 @@ async function next(isTyping: boolean = true) { } else { isTypingWrongWord.value = false console.log('当前学完了,没错词', statStore.total, statStore.step, data.index) - //学完了,这里第 7 步如果无单词,加 3 就是 9 了 - if (statStore.step >= 8) { + + const complete = () => { console.log('全完学完了') showStatDialog = true clearInterval(timer) setTimeout(() => localStorage.removeItem(PracticeSaveWordKey.key), 300) - return; } - //开始默写之前 - if (statStore.step === 7) { - return goNextStep(shuffle(taskWords.write), WordPracticeType.Dictation, '开始默写之前') - } - - //开始听写之前 - if (statStore.step === 6) { - return goNextStep(shuffle(taskWords.write), WordPracticeType.Listen, '开始听写之前') - } - - //开始自测之前 - if (statStore.step === 5) { - return goNextStep(taskWords.write, WordPracticeType.Identify, '开始自测之前') - } - - //开始默写上次 - if (statStore.step === 4) { - return goNextStep(shuffle(taskWords.review), WordPracticeType.Dictation, '开始默写上次') - } - - //开始听写上次 - if (statStore.step === 3) { - return goNextStep(shuffle(taskWords.review), WordPracticeType.Listen, '开始听写上次') - } - - //开始自测昨日 - if (statStore.step === 2) { - return goNextStep(taskWords.review, WordPracticeType.Identify, '开始自测昨日') - } - - //开始默写新词 - if (statStore.step === 1) { - return goNextStep(shuffle(taskWords.new), WordPracticeType.Dictation, '开始默写新词') - } - - //开始听写新词 - if (statStore.step === 0) { - return goNextStep(shuffle(taskWords.new), WordPracticeType.Listen, '开始听写新词') + if (settingStore.wordPracticeMode === WordPracticeMode.System) { + if (statStore.stage === WordPracticeStage.FollowWriteNewWord) { + settingStore.wordPracticeType = WordPracticeType.Listen + return nextStage(shuffle(taskWords.new), '开始听写新词', WordPracticeStage.ListenNewWord) + } + if (statStore.stage === WordPracticeStage.ListenNewWord) { + settingStore.wordPracticeType = WordPracticeType.Dictation + return nextStage(shuffle(taskWords.new), '开始默写新词', WordPracticeStage.DictationNewWord) + } + if (statStore.stage === WordPracticeStage.DictationNewWord) { + settingStore.wordPracticeType = WordPracticeType.Identify + return nextStage(taskWords.review, '开始自测昨日', WordPracticeStage.IdentifyReview) + } + if (statStore.stage === WordPracticeStage.IdentifyReview) { + settingStore.wordPracticeType = WordPracticeType.Listen + return nextStage(shuffle(taskWords.review), '开始听写上次', WordPracticeStage.ListenReview) + } + if (statStore.stage === WordPracticeStage.ListenReview) { + settingStore.wordPracticeType = WordPracticeType.Dictation + return nextStage(shuffle(taskWords.review), '开始默写上次', WordPracticeStage.DictationReview) + } + if (statStore.stage === WordPracticeStage.DictationReview) { + settingStore.wordPracticeType = WordPracticeType.Identify + return nextStage(taskWords.write, '开始自测之前', WordPracticeStage.IdentifyReviewAll) + } + if (statStore.stage === WordPracticeStage.IdentifyReviewAll) { + settingStore.wordPracticeType = WordPracticeType.Listen + return nextStage(shuffle(taskWords.review), '开始听写之前', WordPracticeStage.ListenReviewAll) + } + if (statStore.stage === WordPracticeStage.ListenReviewAll) { + settingStore.wordPracticeType = WordPracticeType.Dictation + return nextStage(shuffle(taskWords.review), '开始默写之前', WordPracticeStage.DictationReviewAll) + } + if (statStore.stage === WordPracticeStage.DictationReviewAll) { + complete() + } + } else if (settingStore.wordPracticeMode === WordPracticeMode.ListenOnly) { + settingStore.wordPracticeType = WordPracticeType.Listen + if (statStore.stage === WordPracticeStage.ListenNewWord) { + return nextStage(taskWords.review, '开始听写昨日', WordPracticeStage.ListenReview) + } + if (statStore.stage === WordPracticeStage.ListenReview) { + return nextStage(taskWords.write, '开始听写之前', WordPracticeStage.ListenReviewAll) + } + if (statStore.stage === WordPracticeStage.ListenReviewAll) { + complete() + } + } else if (settingStore.wordPracticeMode === WordPracticeMode.DictationOnly) { + settingStore.wordPracticeType = WordPracticeType.Dictation + if (statStore.stage === WordPracticeStage.DictationNewWord) { + return nextStage(taskWords.review, '开始默写昨日', WordPracticeStage.DictationReview) + } + if (statStore.stage === WordPracticeStage.DictationReview) { + return nextStage(taskWords.write, '开始默写之前', WordPracticeStage.DictationReviewAll) + } + if (statStore.stage === WordPracticeStage.DictationReviewAll) { + complete() + } + } else if (settingStore.wordPracticeMode === WordPracticeMode.IdentifyOnly) { + settingStore.wordPracticeType = WordPracticeType.Identify + if (statStore.stage === WordPracticeStage.IdentifyNewWord) { + return nextStage(taskWords.review, '开始自测昨日', WordPracticeStage.IdentifyReview) + } + if (statStore.stage === WordPracticeStage.IdentifyReview) { + return nextStage(taskWords.write, '开始自测之前', WordPracticeStage.IdentifyReviewAll) + } + if (statStore.stage === WordPracticeStage.IdentifyReviewAll) { + complete() + } } } } else { - if (statStore.step === 0) { + if (statStore.stage === WordPracticeStage.FollowWriteNewWord) { wordLoop() } else { if (isTypingWrongWord.value) wordLoop() @@ -580,15 +561,15 @@ function onTypeWrong() { function savePracticeData() { // console.log('savePracticeData') localStorage.setItem( - PracticeSaveWordKey.key, - JSON.stringify({ - version: PracticeSaveWordKey.version, - val: { - taskWords, - practiceData: data, - statStoreData: statStore.$state, - }, - }) + PracticeSaveWordKey.key, + JSON.stringify({ + version: PracticeSaveWordKey.version, + val: { + taskWords, + practiceData: data, + statStoreData: statStore.$state, + }, + }) ) } @@ -699,8 +680,8 @@ async function continueStudy() { if (taskWords.shuffle.length) { let ignoreList = [store.allIgnoreWords, store.knownWords][settingStore.ignoreSimpleWord ? 0 : 1] temp.shuffle = shuffle(store.sdict.words.filter(v => !ignoreList.includes(v.word))).slice( - 0, - runtimeStore.routeData.total + 0, + runtimeStore.routeData.total ) if (showStatDialog) showStatDialog = false } else { @@ -782,9 +763,9 @@ useEvents([