From f64a7163e5f40da0e838f1ff0659042f874183a0 Mon Sep 17 00:00:00 2001 From: KAI <1373639299@qq.com> Date: Tue, 10 Dec 2024 14:01:34 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=BC=80=E5=85=B3=E5=B1=9E=E6=80=A7=EF=BC=8C?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E4=B8=BB=E9=A2=98=E9=85=8D=E7=BD=AE=E8=87=B3?= =?UTF-8?q?=20`src/config/setting.ts`=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=89=B2?= =?UTF-8?q?=E5=BC=B1=E6=A8=A1=E5=BC=8F=E4=B8=8E=E5=93=80=E6=82=BC=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 5 +- .env.production | 5 +- .env.test | 5 +- src/config/setting.json | 13 ---- src/config/setting.ts | 19 ++++++ .../HeaderRightBar/SettingDrawer.vue | 65 +++++++++++++++++-- .../components/HeaderRightBar/index.vue | 1 - src/stores/modules/app.ts | 25 ++++++- src/types/app.d.ts | 30 +++++---- src/types/env.d.ts | 1 + 10 files changed, 130 insertions(+), 39 deletions(-) delete mode 100644 src/config/setting.json create mode 100644 src/config/setting.ts diff --git a/.env.development b/.env.development index e9224a1..24a66be 100644 --- a/.env.development +++ b/.env.development @@ -12,4 +12,7 @@ VITE_API_WS_URL = 'ws://localhost:8000' VITE_BASE = '/' # 是否开启开发者工具 -VITE_OPEN_DEVTOOLS = false \ No newline at end of file +VITE_OPEN_DEVTOOLS = false + +# 应用配置面板 +VITE_APP_SETTING = true \ No newline at end of file diff --git a/.env.production b/.env.production index 7236d2e..1c5abb9 100644 --- a/.env.production +++ b/.env.production @@ -8,4 +8,7 @@ VITE_API_BASE_URL = 'https://api.continew.top' VITE_API_WS_URL = 'wss://api.continew.top' # 地址前缀 -VITE_BASE = '/' \ No newline at end of file +VITE_BASE = '/' + +# 应用配置面板 +VITE_APP_SETTING = false \ No newline at end of file diff --git a/.env.test b/.env.test index 3660da1..68c14e1 100644 --- a/.env.test +++ b/.env.test @@ -13,4 +13,7 @@ VITE_API_BASE_URL = 'http://localhost:8000' VITE_BASE = '/test' # 是否开启开发者工具 -VITE_OPEN_DEVTOOLS = true \ No newline at end of file +VITE_OPEN_DEVTOOLS = true + +# 应用配置面板 +VITE_APP_SETTING = false \ No newline at end of file diff --git a/src/config/setting.json b/src/config/setting.json deleted file mode 100644 index 77c77d3..0000000 --- a/src/config/setting.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "theme": "light", - "themeColor": "#165DFF", - "tab": true, - "tabMode": "card-gutter", - "animate": false, - "animateMode": "zoom-fade", - "menuCollapse": true, - "menuAccordion": true, - "menuDark": false, - "copyrightDisplay": true, - "layout": "left" -} diff --git a/src/config/setting.ts b/src/config/setting.ts new file mode 100644 index 0000000..a9f81ee --- /dev/null +++ b/src/config/setting.ts @@ -0,0 +1,19 @@ +export const defaultSettings: App.AppSettings = { + theme: 'light', + themeColor: '#165DFF', + tab: true, + tabMode: 'card-gutter', + animate: false, + animateMode: 'zoom-fade', + menuCollapse: true, + menuAccordion: true, + menuDark: false, + copyrightDisplay: true, + layout: 'left', + enableColorWeaknessMode: false, + enableMourningMode: false, +} +// 根据环境返回配置 +export const getSettings = (): App.AppSettings => { + return defaultSettings +} diff --git a/src/layout/components/HeaderRightBar/SettingDrawer.vue b/src/layout/components/HeaderRightBar/SettingDrawer.vue index 3ed98e8..df7a8fc 100644 --- a/src/layout/components/HeaderRightBar/SettingDrawer.vue +++ b/src/layout/components/HeaderRightBar/SettingDrawer.vue @@ -1,8 +1,11 @@