From eac6fd674886b85a4f2fd38b4cb08fa7ceb9b86a Mon Sep 17 00:00:00 2001 From: Zyronon Date: Sun, 12 Oct 2025 03:37:34 +0800 Subject: [PATCH] save --- public/list/dictionary.json | 14 +++++----- src/apis/index.ts | 25 +++++++++++++++--- src/components/list/BaseList.vue | 4 +-- src/config/env.ts | 2 ++ src/hooks/event.ts | 1 - src/pages/article/ArticlesPage.vue | 2 ++ src/pages/article/BookDetail.vue | 21 ++++++++++++--- src/pages/article/PracticeArticles.vue | 36 +++++++++++++++++++------- src/pages/word/DictList.vue | 5 ++-- src/stores/base.ts | 36 ++++++++++++++------------ src/types/func.ts | 2 +- src/types/types.ts | 3 ++- src/utils/http.ts | 29 ++++++++++++++------- 13 files changed, 123 insertions(+), 57 deletions(-) diff --git a/public/list/dictionary.json b/public/list/dictionary.json index adf73952..d7fef4dd 100644 --- a/public/list/dictionary.json +++ b/public/list/dictionary.json @@ -1,5 +1,4 @@ [ - [ { "id": "cet4", "name": "CET-4", @@ -675,9 +674,9 @@ "length": 1665, "language": "en", "translateLanguage": "zh-CN" - } - ], - [ + }, + + { "id": "pet-2024", "name": "PET-2024", @@ -1873,9 +1872,9 @@ "length": 438, "language": "en", "translateLanguage": "zh-CN" - } - ], - [ + }, + + { "id": "gaokao3500", "name": "高考 3500 词", @@ -3257,5 +3256,4 @@ "language": "en", "translateLanguage": "zh-CN" } - ] ] diff --git a/src/apis/index.ts b/src/apis/index.ts index be64a6f1..d216ed8b 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -1,9 +1,26 @@ import http from "@/utils/http.ts"; - -export function officialList() { - return http('dicts/officialList', null, null, 'get') -} +import { Dict } from "@/types/types.ts"; export function dictListVersion() { return http('dicts/dictListVersion', null, null, 'get') } + +export function myDictList() { + return http('dicts/myDictList', null, null, 'get') +} + +export function add2MyDict(data) { + return http('dicts/add2MyDict', null, data, 'get') +} + +export function addStat(data) { + return http('dicts/addStat', data, null, 'post') +} + +export function detail(params?, data?) { + return http('dicts/detail', data, params, 'get') +} + +export function setDictProp(params?, data?) { + return http('dicts/setDictProp', data, params, 'post') +} diff --git a/src/components/list/BaseList.vue b/src/components/list/BaseList.vue index d54d8f79..85c6e2de 100644 --- a/src/components/list/BaseList.vue +++ b/src/components/list/BaseList.vue @@ -5,13 +5,13 @@ import { nextTick, watch } from 'vue' const props = withDefaults(defineProps<{ list?: any[], activeIndex?: number, - activeId?: string, + activeId?: number, isActive?: boolean static?: boolean }>(), { list: [], activeIndex: -1, - activeId: '', + activeId: null, isActive: false, static: true }) diff --git a/src/config/env.ts b/src/config/env.ts index a868ec70..cef24200 100644 --- a/src/config/env.ts +++ b/src/config/env.ts @@ -17,6 +17,8 @@ const map = { export const ENV = Object.assign(map['DEV'], common) export const IS_OFFICIAL = import.meta.env.DEV +export const IS_LOGIN = true +export const CAN_REQUEST = IS_LOGIN && IS_OFFICIAL export const RESOURCE_PATH = ENV.API + 'static' export const DICT_LIST = { diff --git a/src/hooks/event.ts b/src/hooks/event.ts index e69ec8f7..67670a95 100644 --- a/src/hooks/event.ts +++ b/src/hooks/event.ts @@ -53,7 +53,6 @@ export function useEventListener(type: string, listener: EventListenerOrEventLis } }) const remove = () => { - console.log('onUnmounted') if (isMobile()) { let s = document.querySelector('#typing-listener') if (s) { diff --git a/src/pages/article/ArticlesPage.vue b/src/pages/article/ArticlesPage.vue index ee5bddd0..22d79f37 100644 --- a/src/pages/article/ArticlesPage.vue +++ b/src/pages/article/ArticlesPage.vue @@ -155,6 +155,8 @@ const weekList = $computed(() => { const {data: recommendBookList, isFetching} = useFetch(resourceWrap(DICT_LIST.ARTICLE.RECOMMENDED)).json() + +