From d087b72b17790f275953828fd3bbbc3634e253b3 Mon Sep 17 00:00:00 2001 From: zyronon Date: Wed, 6 Dec 2023 10:10:08 +0800 Subject: [PATCH] save --- src/stores/base.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/stores/base.ts b/src/stores/base.ts index 8488b187..2ad86cd2 100644 --- a/src/stores/base.ts +++ b/src/stores/base.ts @@ -229,6 +229,31 @@ export const useBaseStore = defineStore('base', { } const runtimeStore = useRuntimeStore() + if (location.href.includes('?mode=article')) { + console.log('文章') + let dict = { + ...cloneDeep(DefaultDict), + id: 'article_nce2', + name: "新概念英语2-课文", + description: '新概念英语2-课文', + category: '英语学习', + tags: ['新概念英语'], + url: 'NCE_2.json', + translateLanguage: 'common', + language: 'en', + type: DictType.article, + resourceId: 'article_nce2', + length: 96 + } + let rIndex = this.myDictList.findIndex((v: Dict) => v.id === dict.id) + if (rIndex > -1) { + this.myDictList[rIndex] = dict + this.current.index = rIndex + } else { + this.myDictList.push(cloneDeep(dict)) + this.current.index = this.myDictList.length - 1 + } + } if (this.current.index < 3) { } else {