diff --git a/components.d.ts b/components.d.ts index 0db739a8..40b4d3ff 100644 --- a/components.d.ts +++ b/components.d.ts @@ -13,6 +13,7 @@ declare module 'vue' { Close: typeof import('./src/components/icon/Close.vue')['default'] DeleteIcon: typeof import('./src/components/icon/DeleteIcon.vue')['default'] ElButton: typeof import('element-plus/es')['ElButton'] + ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElInput: typeof import('element-plus/es')['ElInput'] @@ -27,6 +28,7 @@ declare module 'vue' { ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTableV2: typeof import('element-plus/es')['ElTableV2'] Empty: typeof import('./src/components/Empty.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/package.json b/package.json index 5f809cbe..ce6326bb 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "@unocss/postcss": "^0.60.2", "@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue-jsx": "^3.0.1", - "@vue-macros/reactivity-transform": "^0.4.5", "@vue/compiler-sfc": "^3.3.4", "commitizen": "^4.3.0", "cz-conventional-changelog": "^3.3.0", @@ -61,7 +60,6 @@ "unocss": "^0.60.2", "unplugin-auto-import": "^0.16.6", "unplugin-vue-components": "^0.25.2", - "unplugin-vue-define-options": "^1.4.1", "unplugin-vue-macros": "^2.9.3", "vite": "^5.2.11", "vue-tsc": "^2.0.19", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c55d66ec..6335e468 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,9 +99,6 @@ importers: '@vitejs/plugin-vue-jsx': specifier: ^3.0.1 version: 3.1.0(vite@5.2.12(@types/node@20.12.13)(sass@1.77.4))(vue@3.4.27(typescript@5.4.5)) - '@vue-macros/reactivity-transform': - specifier: ^0.4.5 - version: 0.4.6(rollup@4.18.0)(vue@3.4.27(typescript@5.4.5)) '@vue/compiler-sfc': specifier: ^3.3.4 version: 3.4.27 @@ -141,9 +138,6 @@ importers: unplugin-vue-components: specifier: ^0.25.2 version: 0.25.2(@babel/parser@7.24.6)(rollup@4.18.0)(vue@3.4.27(typescript@5.4.5)) - unplugin-vue-define-options: - specifier: ^1.4.1 - version: 1.4.5(rollup@4.18.0)(vue@3.4.27(typescript@5.4.5)) unplugin-vue-macros: specifier: ^2.9.3 version: 2.9.3(@vueuse/core@9.13.0(vue@3.4.27(typescript@5.4.5)))(esbuild@0.20.2)(rollup@4.18.0)(typescript@5.4.5)(vite@5.2.12(@types/node@20.12.13)(sass@1.77.4))(vue@3.4.27(typescript@5.4.5)) @@ -1189,7 +1183,7 @@ packages: engines: {node: '>=8'} bindings@1.5.0: - resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==, tarball: https://r2.cnpmjs.org/bindings/-/bindings-1.5.0.tgz} bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} @@ -1720,7 +1714,7 @@ packages: resolution: {integrity: sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==} file-uri-to-path@1.0.0: - resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==, tarball: https://r2.cnpmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz} fill-range@4.0.0: resolution: {integrity: sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==} @@ -1815,7 +1809,7 @@ packages: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} fsevents@1.2.13: - resolution: {integrity: sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==} + resolution: {integrity: sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==, tarball: https://r2.cnpmjs.org/fsevents/-/fsevents-1.2.13.tgz} engines: {node: '>= 4.0'} os: [darwin] deprecated: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 diff --git a/src/hooks/dict.ts b/src/hooks/dict.ts index e3077384..3153d24a 100644 --- a/src/hooks/dict.ts +++ b/src/hooks/dict.ts @@ -156,7 +156,7 @@ export function getCurrentStudyWord() { }) } - console.timeEnd() - console.log('data', data) + // console.timeEnd() + // console.log('data', data) return data } \ No newline at end of file diff --git a/src/pages/mobile/practice/index-test.vue b/src/pages/mobile/practice/index-test.vue deleted file mode 100644 index 48f83fc0..00000000 --- a/src/pages/mobile/practice/index-test.vue +++ /dev/null @@ -1,368 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/pages/mobile/practice/index.vue b/src/pages/mobile/practice/index.vue index e4e3228e..d9b5be20 100644 --- a/src/pages/mobile/practice/index.vue +++ b/src/pages/mobile/practice/index.vue @@ -29,10 +29,10 @@ watch(statisticsStore, () => { if (statisticsStore.inputWordNumber < 1) { return statisticsStore.correctRate = -1 } - if (statisticsStore.wrongWordNumber > statisticsStore.inputWordNumber) { + if (statisticsStore.wrong > statisticsStore.inputWordNumber) { return statisticsStore.correctRate = 0 } - statisticsStore.correctRate = 100 - Math.trunc(((statisticsStore.wrongWordNumber) / (statisticsStore.inputWordNumber)) * 100) + statisticsStore.correctRate = 100 - Math.trunc(((statisticsStore.wrong) / (statisticsStore.inputWordNumber)) * 100) }) diff --git a/src/pages/mobile/practice/practice-word/TypingWord.vue b/src/pages/mobile/practice/practice-word/TypingWord.vue index bf0ae275..6bc31aa7 100644 --- a/src/pages/mobile/practice/practice-word/TypingWord.vue +++ b/src/pages/mobile/practice/practice-word/TypingWord.vue @@ -69,7 +69,7 @@ watch(() => props.words, () => { statisticsStore.startDate = Date.now() statisticsStore.correctRate = -1 statisticsStore.inputWordNumber = 0 - statisticsStore.wrongWordNumber = 0 + statisticsStore.wrong = 0 stat = cloneDeep(DefaultDisplayStatistics) }, {immediate: true}) @@ -96,10 +96,10 @@ function next(isTyping: boolean = true) { total: props.words.length, correctRate: -1, inputWordNumber: statisticsStore.inputWordNumber, - wrongWordNumber: data.wrongWords.length, + wrong: data.wrongWords.length, wrongWords: data.wrongWords, } - stat.correctRate = 100 - Math.trunc(((stat.wrongWordNumber) / (stat.total)) * 100) + stat.correctRate = 100 - Math.trunc(((stat.wrong) / (stat.total)) * 100) } if (data.wrongWords.length) { @@ -109,7 +109,7 @@ function next(isTyping: boolean = true) { statisticsStore.total = data.words.length statisticsStore.index = data.index = 0 statisticsStore.inputWordNumber = 0 - statisticsStore.wrongWordNumber = 0 + statisticsStore.wrong = 0 data.wrongWords = [] } else { console.log('这章节完了') @@ -138,7 +138,7 @@ function wordWrong() { } if (!data.wrongWords.find((v: Word) => v.word.toLowerCase() === word.word.toLowerCase())) { data.wrongWords.push(word) - statisticsStore.wrongWordNumber++ + statisticsStore.wrong++ } } diff --git a/src/pages/pc/article/ArticleIndexTEST.vue b/src/pages/pc/article/ArticleIndexTEST.vue index 8b1552f5..82dc3634 100644 --- a/src/pages/pc/article/ArticleIndexTEST.vue +++ b/src/pages/pc/article/ArticleIndexTEST.vue @@ -28,10 +28,10 @@ watch(statisticsStore, () => { if (statisticsStore.inputWordNumber < 1) { return statisticsStore.correctRate = -1 } - if (statisticsStore.wrongWordNumber > statisticsStore.inputWordNumber) { + if (statisticsStore.wrong > statisticsStore.inputWordNumber) { return statisticsStore.correctRate = 0 } - statisticsStore.correctRate = 100 - Math.trunc(((statisticsStore.wrongWordNumber) / (statisticsStore.inputWordNumber)) * 100) + statisticsStore.correctRate = 100 - Math.trunc(((statisticsStore.wrong) / (statisticsStore.inputWordNumber)) * 100) }) diff --git a/src/pages/pc/article/LearnArticle.vue b/src/pages/pc/article/LearnArticle.vue index 242e31ab..77c1fedd 100644 --- a/src/pages/pc/article/LearnArticle.vue +++ b/src/pages/pc/article/LearnArticle.vue @@ -28,10 +28,10 @@ watch(statisticsStore, () => { if (statisticsStore.inputWordNumber < 1) { return statisticsStore.correctRate = -1 } - if (statisticsStore.wrongWordNumber > statisticsStore.inputWordNumber) { + if (statisticsStore.wrong > statisticsStore.inputWordNumber) { return statisticsStore.correctRate = 0 } - statisticsStore.correctRate = 100 - Math.trunc(((statisticsStore.wrongWordNumber) / (statisticsStore.inputWordNumber)) * 100) + statisticsStore.correctRate = 100 - Math.trunc(((statisticsStore.wrong) / (statisticsStore.inputWordNumber)) * 100) }) diff --git a/src/pages/pc/components/TypingWord.vue b/src/pages/pc/components/TypingWord.vue index d63d76d7..915aa0b8 100644 --- a/src/pages/pc/components/TypingWord.vue +++ b/src/pages/pc/components/TypingWord.vue @@ -2,7 +2,7 @@ import {onMounted, onUnmounted, watch} from "vue" import {useBaseStore} from "@/stores/base.ts" import {DefaultDisplayStatistics, DictType, getDefaultWord, ShortcutKey, Sort, Word} from "@/types.ts"; -import {emitter, EventKey} from "@/utils/eventBus.ts" +import {emitter, EventKey, useEvents} from "@/utils/eventBus.ts" import {cloneDeep, reverse, shuffle} from "lodash-es" import {usePracticeStore} from "@/stores/practice.ts" import {useSettingStore} from "@/stores/setting.ts"; @@ -72,7 +72,7 @@ watch(() => props.data, () => { statStore.startDate = Date.now() statStore.correctRate = -1 statStore.inputWordNumber = 0 - statStore.wrongWordNumber = 0 + statStore.wrong = 0 statStore.total = props.data.review.concat(props.data.new).concat(props.data.write).length statStore.newWordNumber = props.data.new.length statStore.index = 0 @@ -142,7 +142,7 @@ function wordWrong() { } if (!allWrongWords.find((v: Word) => v.word.toLowerCase() === word.word.toLowerCase())) { allWrongWords.push(word) - statStore.wrongWordNumber++ + statStore.wrong++ } } @@ -197,23 +197,14 @@ function play() { typingRef.play() } -onMounted(() => { - emitter.on(ShortcutKey.ShowWord, show) - emitter.on(ShortcutKey.Previous, prev) - emitter.on(ShortcutKey.Next, skip) - emitter.on(ShortcutKey.ToggleCollect, collect) - emitter.on(ShortcutKey.ToggleSimple, toggleWordSimpleWrapper) - emitter.on(ShortcutKey.PlayWordPronunciation, play) -}) - -onUnmounted(() => { - emitter.off(ShortcutKey.ShowWord, show) - emitter.off(ShortcutKey.Previous, prev) - emitter.off(ShortcutKey.Next, skip) - emitter.off(ShortcutKey.ToggleCollect, collect) - emitter.off(ShortcutKey.ToggleSimple, toggleWordSimpleWrapper) - emitter.off(ShortcutKey.PlayWordPronunciation, play) -}) +useEvents([ + [ShortcutKey.ShowWord, show], + [ShortcutKey.Previous, prev], + [ShortcutKey.Next, skip], + [ShortcutKey.ToggleCollect, collect], + [ShortcutKey.ToggleSimple, toggleWordSimpleWrapper], + [ShortcutKey.PlayWordPronunciation, play], +]) const status = $computed(() => { let str = '正在' diff --git a/src/pages/pc/components/dialog/DictDiglog.vue b/src/pages/pc/components/dialog/DictDiglog.vue index bb51666d..fe702b57 100644 --- a/src/pages/pc/components/dialog/DictDiglog.vue +++ b/src/pages/pc/components/dialog/DictDiglog.vue @@ -5,6 +5,8 @@ import WordListDialog from "@/pages/pc/components/dialog/WordListDialog.vue"; import {emitter, EventKey, useEvent} from "@/utils/eventBus.ts"; import BaseIcon from "@/components/BaseIcon.vue"; import Dialog from "@/pages/pc/components/dialog/Dialog.vue"; +import {_dateFormat} from "@/utils"; +import {sumBy} from "lodash-es"; const store = useBaseStore() @@ -23,7 +25,17 @@ useEvent(EventKey.openDictModal, () => { }) const startDate = $computed(() => { + if (store.sdict.statistics.length) { + return _dateFormat(store.sdict.statistics[0].startDate, 'YYYY-MM-DD') + } else { + return '-' + } +}) +const speedTime = $computed(() => { + let d = Math.ceil(sumBy(store.sdict.statistics, 'speed') / 1000 / 60) + if (d < 60) return d + '分钟' + else return (d / 60).toFixed(1) + '小时' }) @@ -43,9 +55,9 @@ const startDate = $computed(() => { title="单词列表" /> -
开始日期:-
-
花费时间:-
-
累积错误:-
+
开始日期:{{ startDate }}
+
花费时长:{{ speedTime }}
+
累积错误:{{ sumBy(store.sdict.statistics, 'wrong') }}
已学习{{ store.currentStudyProgress }}% @@ -64,7 +76,7 @@ const startDate = $computed(() => { \ No newline at end of file diff --git a/src/pages/pc/practice/practice-article/index.vue b/src/pages/pc/practice/practice-article/index.vue index 18f080d1..7d495472 100644 --- a/src/pages/pc/practice/practice-article/index.vue +++ b/src/pages/pc/practice/practice-article/index.vue @@ -75,7 +75,7 @@ function setArticle(val: Article) { articleData.articles[store.currentArticleDict.chapterIndex] = tempVal articleData.article = tempVal statisticsStore.inputWordNumber = 0 - statisticsStore.wrongWordNumber = 0 + statisticsStore.wrong = 0 statisticsStore.total = 0 statisticsStore.startDate = Date.now() articleData.article.sections.map((v, i) => { @@ -195,7 +195,7 @@ function wrong(word: Word) { } function over() { - if (statisticsStore.wrongWordNumber === 0) { + if (statisticsStore.wrong === 0) { // if (false) { console.log('这章节完了') let now = Date.now() @@ -205,9 +205,9 @@ function over() { spend: now - statisticsStore.startDate, total: statisticsStore.total, correctRate: -1, - wrongWordNumber: statisticsStore.wrongWordNumber, + wrong: statisticsStore.wrong, } - stat.correctRate = 100 - Math.trunc(((stat.wrongWordNumber) / (stat.total)) * 100) + stat.correctRate = 100 - Math.trunc(((stat.wrong) / (stat.total)) * 100) emitter.emit(EventKey.openStatModal, stat) } else { tabIndex = 1 diff --git a/src/pages/pc/word/EditWordDict.vue b/src/pages/pc/word/EditWordDict.vue index 25f55537..67be5523 100644 --- a/src/pages/pc/word/EditWordDict.vue +++ b/src/pages/pc/word/EditWordDict.vue @@ -1,4 +1,4 @@ -