其他学习词典
@@ -97,20 +99,21 @@ watch(() => base.currentStudyWordProgress, n => {
@click="router.push('/dict')"/>
-
+
-
{{ base.currentDict.name }}
+
{{ i.name }}
-
-
+
+
已学习5555个单词的1%
-
diff --git a/src/stores/base.ts b/src/stores/base.ts
index 62932fda..58537557 100644
--- a/src/stores/base.ts
+++ b/src/stores/base.ts
@@ -267,6 +267,9 @@ export const useBaseStore = defineStore('base', {
if (!this.currentStudyWordDict.words?.length) return 0
return Number(((this.currentStudy.word.lastLearnIndex / this.currentStudyWordDict.words?.length) * 100).toFixed())
},
+ otherWordDictList(): Dict[] {
+ return this.wordDictList.filter(v => this.currentStudyWordDict.id !== v.id)
+ },
currentArticleDict(): Dict {
return this.articleDictList[this.currentStudy.article.dictIndex] ?? {}
},
@@ -479,6 +482,11 @@ export const useBaseStore = defineStore('base', {
}
console.log('changeDict', cloneDeep(dict),)
+ this.wordDictList.map(v => {
+ v.words = []
+ v.originWords = []
+ })
+
// await checkDictHasTranslate(dict)
let rIndex = this.wordDictList.findIndex((v: Dict) => v.id === dict.id)
if (rIndex > -1) {
@@ -486,7 +494,7 @@ export const useBaseStore = defineStore('base', {
this.currentStudy.word.dictIndex = rIndex
} else {
this.wordDictList.push(cloneDeep(dict))
- this.currentStudy.word.dictIndex = this.wordDictList.length - 1
+ this.currentStudy.word.dictIndex = this.wordDictList.length - 1
}
this.currentStudy.word.lastLearnIndex = 0
emitter.emit(EventKey.changeDict)
@@ -557,5 +565,16 @@ export const useBaseStore = defineStore('base', {
emitter.emit(EventKey.changeDict)
},
+ delWordDict(dict: Dict) {
+ let oldId = this.currentStudyWordDict.id;
+ let rIndex = this.wordDictList.findIndex((v: Dict) => v.id === dict.id)
+ if (rIndex > -1) {
+ this.wordDictList.splice(rIndex, 1)
+ }
+ rIndex = this.wordDictList.findIndex((v: Dict) => v.id === oldId)
+ if (rIndex > -1) {
+ this.currentStudy.word.dictIndex = rIndex
+ }
+ }
},
})
\ No newline at end of file
diff --git a/src/utils/eventBus.ts b/src/utils/eventBus.ts
index 11477a4d..ff5517d5 100644
--- a/src/utils/eventBus.ts
+++ b/src/utils/eventBus.ts
@@ -14,7 +14,6 @@ export const EventKey = {
keyup: 'keyup',
onTyping: 'onTyping',
repeat: 'repeat',
- //TODO 废弃
next: 'next',
write: 'write',
editDict: 'editDict',