diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4bbeadec..28d13cf8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,16 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + dependencies: lodash: specifier: ^4.17.21 version: 4.17.21 + pinia: + specifier: ^2.1.6 + version: 2.1.6(typescript@5.0.2)(vue@3.3.4) vue: specifier: ^3.3.4 version: 3.3.4 @@ -321,6 +328,10 @@ packages: '@vue/compiler-dom': 3.3.4 '@vue/shared': 3.3.4 + /@vue/devtools-api@6.5.0: + resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==} + dev: false + /@vue/language-core@1.8.5(typescript@5.0.2): resolution: {integrity: sha512-DKQNiNQzNV7nrkZQujvjfX73zqKdj2+KoM4YeKl+ft3f+crO3JB4ycPnmgaRMNX/ULJootdQPGHKFRl5cXxwaw==} peerDependencies: @@ -574,6 +585,24 @@ packages: engines: {node: '>=8.6'} dev: true + /pinia@2.1.6(typescript@5.0.2)(vue@3.3.4): + resolution: {integrity: sha512-bIU6QuE5qZviMmct5XwCesXelb5VavdOWKWaB17ggk++NUwQWWbP5YnsONTk3b752QkW9sACiR81rorpeOMSvQ==} + peerDependencies: + '@vue/composition-api': ^1.4.0 + typescript: '>=4.4.4' + vue: ^2.6.14 || ^3.3.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + typescript: + optional: true + dependencies: + '@vue/devtools-api': 6.5.0 + typescript: 5.0.2 + vue: 3.3.4 + vue-demi: 0.14.5(vue@3.3.4) + dev: false + /postcss@8.4.27: resolution: {integrity: sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==} engines: {node: ^10 || ^12 || >=14} @@ -634,7 +663,6 @@ packages: resolution: {integrity: sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==} engines: {node: '>=12.20'} hasBin: true - dev: true /vite@4.4.5(sass@1.64.2): resolution: {integrity: sha512-4m5kEtAWHYr0O1Fu7rZp64CfO1PsRGZlD3TAB32UmQlpd7qg15VF7ROqGN5CyqN7HFuwr7ICNM2+fDWRqFEKaA==} @@ -672,6 +700,21 @@ packages: fsevents: 2.3.2 dev: true + /vue-demi@0.14.5(vue@3.3.4): + resolution: {integrity: sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + dependencies: + vue: 3.3.4 + dev: false + /vue-template-compiler@2.7.14: resolution: {integrity: sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ==} dependencies: diff --git a/src/App.vue b/src/App.vue index 6c85af14..e36e68da 100644 --- a/src/App.vue +++ b/src/App.vue @@ -53,14 +53,6 @@ onMounted(() => { let obj: Config = JSON.parse(configStr) store.init(obj) } - if (config.dict === 'nce2') { - wordList = chunk(NCE_2, 15) as any - let wordTemp = wordList?.[config.chapterIndex]?.[config.wordIndex] - if (wordTemp && config.skipWordNames.includes(wordTemp.name)) { - next() - } - } - window.addEventListener('keydown', onKeyDown) }) @@ -172,7 +164,8 @@ function playAudio() {
{{ input }} {{ wrong }} - {{ store.word.name.slice(input.length + wrong.length) }} + + {{ store.word.name }}
播放
diff --git a/src/stores/base.ts b/src/stores/base.ts index b270f6aa..f456dca4 100644 --- a/src/stores/base.ts +++ b/src/stores/base.ts @@ -1,11 +1,15 @@ import {defineStore} from 'pinia' import {Config, Word} from "../types.ts" +import {chunk} from "lodash"; +import NCE_2 from "../assets/dicts/NCE_2.json"; export const useBaseStore = defineStore('base', { state: () => ({ newWords: [], skipWords: [], skipWordNames: [], + wordList: [], + wordListSplit: [], dict: 'nce2', chapterIndex: 0, wordIndex: 0, @@ -13,7 +17,7 @@ export const useBaseStore = defineStore('base', { ), getters: { word: (state): Word => { - return state.wordList?.[state.chapterIndex]?.[state.wordIndex] ?? { + return state.wordListSplit?.[state.chapterIndex]?.[state.wordIndex] ?? { trans: [], name: '' } @@ -27,6 +31,16 @@ export const useBaseStore = defineStore('base', { this.dict = config.dict this.chapterIndex = config.chapterIndex this.wordIndex = 0 + + if (this.dict === 'nce2') { + this.wordList = NCE_2 + this.wordListSplit = chunk(this.wordList, 15) + console.log('this.wordListSplit', this.wordListSplit) + // let wordTemp = wordList?.[config.chapterIndex]?.[config.wordIndex] + // if (wordTemp && config.skipWordNames.includes(wordTemp.name)) { + // next() + // } + } }, }, }) \ No newline at end of file