save
This commit is contained in:
11
src/App.vue
11
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() {
|
||||
<div class="word" :class="wrong&&'is-wrong'">
|
||||
<span class="input" v-if="input">{{ input }}</span>
|
||||
<span class="wrong" v-if="wrong">{{ wrong }}</span>
|
||||
<span class="letter">{{ store.word.name.slice(input.length + wrong.length) }}</span>
|
||||
<!-- <span class="letter">{{ store.word.name.slice(input.length + wrong.length) }}</span>-->
|
||||
<span class="letter">{{ store.word.name }}</span>
|
||||
</div>
|
||||
<div class="audio" @click="playAudio">播放</div>
|
||||
</div>
|
||||
|
||||
@@ -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()
|
||||
// }
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user