From 75bb3d32ed7202ab9395c3da38ae800106aef611 Mon Sep 17 00:00:00 2001 From: zyronon Date: Mon, 28 Aug 2023 23:08:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Type.vue | 9 --------- src/stores/base.ts | 34 +++++----------------------------- src/types.ts | 13 ++++++++++--- 3 files changed, 15 insertions(+), 41 deletions(-) diff --git a/src/components/Type.vue b/src/components/Type.vue index 678f7c36..5de10265 100644 --- a/src/components/Type.vue +++ b/src/components/Type.vue @@ -14,18 +14,10 @@ import {$computed, $ref} from "vue/macros" import {useSound} from "@/hooks/useSound.ts" import {useBaseStore} from "@/stores/base.ts" import {DictType, SaveKey, Word} from "../types"; -import WordList from "../components/WordList.vue"; -import Side from "@/components/Side.vue" import {usePlayWordAudio} from "@/hooks/usePlayWordAudio.ts" -import DictModal from "@/components/Modal/DictModal.vue" -import Backgorund from "@/components/Backgorund.vue" -import Statistics from "@/components/Modal/Statistics.vue"; import useTheme from "@/hooks/useTheme.ts"; import Tooltip from "@/components/Tooltip.vue"; -import Toolbar from "@/components/Toolbar/Toolbar.vue" -import {KeyboardOne} from "@icon-park/vue-next"; import BaseButton from "@/components/BaseButton.vue"; -import Type from "@/components/Type.vue"; import { Down, Delete, @@ -95,7 +87,6 @@ function repeatWrong() { function next() { if (store.currentDict.wordIndex === store.chapter.length - 1) { if (store.currentDict.chapterIndex !== store.currentDict.chapterList.length - 1) { - store.currentDict.wordIndex++ console.log('这一章节完了') if (store.currentWrongDict.wordList.length) { repeatWrong() diff --git a/src/stores/base.ts b/src/stores/base.ts index 2f68901c..2fd50b63 100644 --- a/src/stores/base.ts +++ b/src/stores/base.ts @@ -60,30 +60,6 @@ export const useBaseStore = defineStore('base', { dictStatistics: [], chapterWordNumber: 15 }, - currentWrongDict: { - type: DictType.currentWrongDict, - sort: Sort.normal, - name: '当前章节错词', - description: '当前章节错词', - category: '', - tags: [], - url: '', - length: -1, - language: 'en', - languageCategory: 'en', - wordList: [], - chapterList: [], - chapterIndex: 0, - wordIndex: 0, - dictStatistics: [], - statistics: { - startDate: Date.now(),//开始日期 - endDate: -1, - correctRate: -1, - wrongNumber: -1 - }, - chapterWordNumber: 15 - }, dict: { type: DictType.inner, sort: Sort.normal, @@ -186,11 +162,11 @@ export const useBaseStore = defineStore('base', { // console.log('this/', this) }, async init() { - let configStr = localStorage.getItem(SaveKey) - if (configStr) { - let obj: Config = JSON.parse(configStr) - this.setState(obj) - } + // let configStr = localStorage.getItem(SaveKey) + // if (configStr) { + // let obj: Config = JSON.parse(configStr) + // this.setState(obj) + // } if (this.currentDictType === DictType.inner) { let r = await fetch(`/public/${this.dict.url}`) r.json().then(v => { diff --git a/src/types.ts b/src/types.ts index 2002d0dc..90a2f709 100644 --- a/src/types.ts +++ b/src/types.ts @@ -112,6 +112,7 @@ export interface Dict extends DictJson { statistics?: Statistics } + export interface DictStatistics { startDate: number,//开始日期 endDate: number//结束日期 @@ -122,6 +123,7 @@ export interface DictStatistics { export interface Statistics { startDate: number,//开始日期 endDate: number//结束日期 + chapterWordNumber: number//章节单词数量 correctRate: number//正确率 wrongNumber: number//错误数 } @@ -139,8 +141,13 @@ export interface State { currentWrongDict: Dict, dict: Dict, oldDicts: Dict[], - currentDictType: DictType, - lastDictType: DictType, + current: { + dictType:DictType, + words: Word[], + wrongWords: Word[], + repeatNumber:number, + statistics: Statistics + }, sideIsOpen: boolean, isDictation: boolean, theme: string, @@ -152,4 +159,4 @@ export interface State { value3: number, value4: boolean, } -} \ No newline at end of file +}