添加统计
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
13
src/types.ts
13
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user