@@ -258,12 +244,11 @@ const progressTextRight = $computed(() => {
toggleSelect(item)" :show-checkbox="isMultiple && j >= 3"
- v-for="(item, j) in store.word.bookList" @click="getDictDetail(item)"/>
-
+ v-for="(item, j) in store.word.bookList" @click="goDictDetail(item)"/>
+
diff --git a/src/router.ts b/src/router.ts
index b2340200..f97b1c15 100644
--- a/src/router.ts
+++ b/src/router.ts
@@ -12,6 +12,8 @@ import StudyWord from "@/pages/pc/word/StudyWord.vue";
import EditArticlePage from "@/pages/pc/article/EditArticlePage.vue";
import BookDetail from "@/pages/pc/article/BookDetail.vue";
import BatchEditArticlePage from "@/pages/pc/article/BatchEditArticlePage.vue";
+import DictList from "@/pages/pc/word/DictList.vue";
+import Setting from "@/pages/pc/Setting.vue";
export const routes: RouteRecordRaw[] = [
{
@@ -20,6 +22,7 @@ export const routes: RouteRecordRaw[] = [
children: [
{path: 'home', component: HomeIndex},
{path: 'word', component: WordHomePage},
+ {path: 'dict-list', component: DictList},
{path: 'study-word', component: StudyWord},
{path: 'dict-detail', component: DictDetail},
{path: 'article', component: ArticleHomePage},
@@ -27,6 +30,7 @@ export const routes: RouteRecordRaw[] = [
{path: 'edit-article', component: EditArticlePage},
{path: 'batch-edit-article', component: BatchEditArticlePage},
{path: 'book-detail', component: BookDetail},
+ {path: 'setting', component: Setting},
]
},
diff --git a/src/stores/base.ts b/src/stores/base.ts
index 5e5eb95e..131f3979 100644
--- a/src/stores/base.ts
+++ b/src/stores/base.ts
@@ -1,5 +1,5 @@
import {defineStore} from 'pinia'
-import {Article, Dict, DictType, getDefaultDict, Sort, Word} from "../types.ts"
+import {Article, Dict, DictId, DictType, getDefaultDict, Sort, Word} from "../types.ts"
import {cloneDeep, merge, reverse, shuffle} from "lodash-es";
import {emitter, EventKey} from "@/utils/eventBus.ts"
import * as localforage from "localforage";
@@ -32,11 +32,9 @@ export const DefaultBaseState = (): BaseState => ({
load: false,
word: {
bookList: [
- getDefaultDict({
- id: 'word-collect', name: '收藏', words: []
- }),
- getDefaultDict({id: 'word-wrong', name: '错词'}),
- getDefaultDict({id: 'word-known', name: '已掌握'}),
+ getDefaultDict({id: DictId.wordCollect, name: '收藏', words: []}),
+ getDefaultDict({id: DictId.wordWrong, name: '错词'}),
+ getDefaultDict({id: DictId.wordKnown, name: '已掌握'}),
// getDefaultDict({
// id: 'nce-new-2',
// name: '新概念英语(新版)-2',
@@ -54,7 +52,7 @@ export const DefaultBaseState = (): BaseState => ({
},
article: {
bookList: [
- getDefaultDict({id: 'article-collect', name: '收藏'})
+ getDefaultDict({id: DictId.articleCollect, name: '收藏'})
],
studyIndex: -1,
}
diff --git a/src/types.ts b/src/types.ts
index 94f929b1..9dcd769e 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -74,7 +74,6 @@ export enum DictType {
simple = 'simple',
wrong = 'wrong',
known = 'known',
- collectWord = 'collect-word',
word = 'word',
article = 'article',
}
@@ -240,10 +239,21 @@ export type DictResource = {
category: string
tags: string[]
translateLanguage: TranslateLanguageType
+ //todo 可以考虑删除了
type: DictType
language: LanguageType
}
+export interface Dict extends DictResource {
+ lastLearnIndex: number,
+ perDayStudyNumber: number,
+ words: Word[],
+ articles: Article[],
+ statistics: Statistics[],
+ custom: boolean,//是否是自定义词典
+ complete: boolean,//是否学习完成,学完了设为true,然后lastLearnIndex重置
+}
+
export function getDefaultDict(val: Partial = {}): Dict {
return {
id: '',
@@ -262,20 +272,11 @@ export function getDefaultDict(val: Partial = {}): Dict {
articles: [],
statistics: [],
custom: false,
+ complete: false,
...val
}
}
-export interface Dict extends DictResource {
- lastLearnIndex: number,
- perDayStudyNumber: number,
- words: Word[],
- articles: Article[],
- statistics: Statistics[],
- custom: boolean,//是否是自定义词典
- complete: boolean,//是否学习完成,学完了设为true,然后lastLearnIndex重置
-}
-
export interface ArticleItem {
item: Article,
index: number
@@ -291,3 +292,10 @@ export interface StudyData {
words: any[],
wrongWords: any[],
}
+
+export class DictId {
+ static wordCollect = 'wordCollect'
+ static wordWrong = 'wordWrong'
+ static wordKnown = 'wordKnown'
+ static articleCollect = 'articleCollect'
+}