From 137037f2ec8681860a181c4aa99fb214a72382b2 Mon Sep 17 00:00:00 2001 From: zyronon Date: Tue, 28 May 2024 08:48:03 +0800 Subject: [PATCH] save --- src/pages/pc/word/StudyWord.vue | 9 +++++++-- src/stores/practice.ts | 3 +++ src/types.ts | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/pages/pc/word/StudyWord.vue b/src/pages/pc/word/StudyWord.vue index 0b0d146b..5b5bbd43 100644 --- a/src/pages/pc/word/StudyWord.vue +++ b/src/pages/pc/word/StudyWord.vue @@ -139,9 +139,14 @@ let wordData = $ref({ }) function getCurrentPractice() { - if (store.currentStudyWordDict.words?.length) { + let c = store.currentStudy.word + let wordDict = store.currentStudyWordDict; + if (wordDict.words?.length) { wordData.index = 0 - wordData.words = cloneDeep(store.currentStudyWordDict.words.slice(store.currentStudy.word.lastLearnIndex, store.currentStudy.word.lastLearnIndex + store.currentStudy.word.perDayStudyNumber)) + wordData.statistics.map(v=>{ + + }) + wordData.words = cloneDeep(wordDict.words.slice(c.lastLearnIndex, c.lastLearnIndex + c.perDayStudyNumber)) emitter.emit(EventKey.resetWord) } } diff --git a/src/stores/practice.ts b/src/stores/practice.ts index 8e531872..dee27c89 100644 --- a/src/stores/practice.ts +++ b/src/stores/practice.ts @@ -3,10 +3,12 @@ import {Word} from "@/types.ts" export interface PracticeState { wrongWords: Word[], + //todo 废弃 repeatNumber: number, startDate: number, total: number, index: number,//当前输入的第几个,用于和total计算进度 + newWordNumber: number, inputWordNumber: number,//当前总输入了多少个单词(不包含跳过) wrongWordNumber: number, correctRate: number, @@ -21,6 +23,7 @@ export const usePracticeStore = defineStore('practice', { correctRate: -1, total: 0, index: 0, + newWordNumber: 0, inputWordNumber: 0, wrongWordNumber: 0, } diff --git a/src/types.ts b/src/types.ts index 0f461cf3..f1dbaf0f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -32,6 +32,11 @@ export const DefaultWord: Word = { trans: [], } +export type StudyWord = { + type: 'new' | 'repeat' | 'wrong' + word: Word +} + export const PronunciationApi = 'https://dict.youdao.com/dictvoice?audio=' export type TranslateLanguageType = 'en' | 'zh-CN' | 'ja' | 'de' | 'common' | '' @@ -117,6 +122,8 @@ export const DefaultArticle: Article = { } export interface Statistics { + startIndex:number, + endIndex:number, startDate: number,//开始日期 endDate: number//结束日期 spend: number,//花费时间 @@ -131,6 +138,8 @@ export interface DisplayStatistics extends Statistics { } export const DefaultDisplayStatistics: DisplayStatistics = { + startIndex: -1, + endIndex: -1, startDate: Date.now(), endDate: -1, spend: -1,