From 9483bba032352f277319244c3d46be317dc79be8 Mon Sep 17 00:00:00 2001 From: SuperCuteXiaoSi <1531733886@qq.com> Date: Sat, 5 Nov 2022 19:39:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(layouts):=20=E2=9C=A8=20add=20=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E8=AE=BE=E7=BD=AE=EF=BC=8C=E4=BF=AE=E6=94=B9appstore?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/serverConfig.json | 3 +- src/assets/icons/full_screen.svg | 1 + src/assets/icons/full_screen_close.svg | 1 + src/assets/icons/full_screen_page.svg | 1 + src/components/Application/AppLocale.vue | 7 +- src/components/Application/AppTheme.vue | 8 +- src/hooks/setting/useRootSetting.ts | 15 ++ src/hooks/useTransformTheme.ts | 10 +- .../pageLayouts/components/AppTabs/index.vue | 24 ++-- .../components/Breadcrumb/index.vue | 15 +- .../pageLayouts/components/Navbart/index.vue | 132 +++++++++++------- .../components/Seting/ThemeSettings/index.vue | 11 +- .../pageLayouts/components/Seting/index.vue | 11 +- .../components/Seting/pageSettings/index.vue | 29 ++-- .../components/SideNavigationBar/index.vue | 20 ++- .../pageLayouts/components/Sidebar/index.vue | 15 +- .../components/VerticalSidebar/index.vue | 16 +-- src/locales/en/modules/layout.ts | 5 + src/locales/zh-ch/modules/layout.ts | 5 + src/store/modules/app.ts | 4 +- src/store/types.ts | 16 +++ src/views/login/index.vue | 6 +- 22 files changed, 215 insertions(+), 140 deletions(-) create mode 100644 src/assets/icons/full_screen.svg create mode 100644 src/assets/icons/full_screen_close.svg create mode 100644 src/assets/icons/full_screen_page.svg create mode 100644 src/hooks/setting/useRootSetting.ts diff --git a/public/serverConfig.json b/public/serverConfig.json index 187f5357..0a73b8d5 100644 --- a/public/serverConfig.json +++ b/public/serverConfig.json @@ -1,5 +1,5 @@ { - "title":"xiaosiAdmin", + "title": "xiaosiAdmin", "collapseMenu": false, "sidebarMode": "vertical", "themeMode": "dark", @@ -7,6 +7,7 @@ "primaryColor": "#409eff", "greyMode": false, "colorWeaknessMode":false, + "hideNavbart": false, "hideTabs": false, "labelPersistent": true, "StorageConfig":{ diff --git a/src/assets/icons/full_screen.svg b/src/assets/icons/full_screen.svg new file mode 100644 index 00000000..5f6c8a42 --- /dev/null +++ b/src/assets/icons/full_screen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/full_screen_close.svg b/src/assets/icons/full_screen_close.svg new file mode 100644 index 00000000..ba7a85ad --- /dev/null +++ b/src/assets/icons/full_screen_close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/full_screen_page.svg b/src/assets/icons/full_screen_page.svg new file mode 100644 index 00000000..5dd83b80 --- /dev/null +++ b/src/assets/icons/full_screen_page.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Application/AppLocale.vue b/src/components/Application/AppLocale.vue index 1fd5b930..622c899f 100644 --- a/src/components/Application/AppLocale.vue +++ b/src/components/Application/AppLocale.vue @@ -1,14 +1,13 @@ diff --git a/src/components/Application/AppTheme.vue b/src/components/Application/AppTheme.vue index 6a6e5fb2..6118649c 100644 --- a/src/components/Application/AppTheme.vue +++ b/src/components/Application/AppTheme.vue @@ -2,17 +2,17 @@ import { useColorMode } from '@vueuse/core'; import { watch } from 'vue'; import SvgIcon from '../SvgIcon/index.vue'; - import { useAppStoreHook } from '@/store/modules/app'; import { useTransformTheme } from '@/hooks/useTransformTheme'; + import { useRootSetting } from '@/hooks/setting/useRootSetting'; - const appStore = useAppStoreHook(); const color = useColorMode(); + const { setAppConfigMode } = useRootSetting(); + const { updateColor } = useTransformTheme(); const toggleDarkMode = () => { - appStore.appConfigMode.themeMode = color.value; - appStore.setAppConfigMode(appStore.appConfigMode); + setAppConfigMode({ themeMode: color.value }); }; watch( diff --git a/src/hooks/setting/useRootSetting.ts b/src/hooks/setting/useRootSetting.ts new file mode 100644 index 00000000..c69ed230 --- /dev/null +++ b/src/hooks/setting/useRootSetting.ts @@ -0,0 +1,15 @@ +import { storeToRefs } from 'pinia'; +import { merge } from 'lodash-es'; +import { useAppStoreHook } from '@/store/modules/app'; +import type { AppConfig } from '@/store/types'; + +export function useRootSetting() { + const appStore = useAppStoreHook(); + const { appConfigMode } = storeToRefs(appStore); + + function setAppConfigMode(config: Partial) { + appStore.setAppConfigMode(merge(appStore.appConfigMode, config)); + } + + return { appConfig: appConfigMode, setAppConfigMode }; +} diff --git a/src/hooks/useTransformTheme.ts b/src/hooks/useTransformTheme.ts index 5ee8bd7e..70077678 100644 --- a/src/hooks/useTransformTheme.ts +++ b/src/hooks/useTransformTheme.ts @@ -1,7 +1,7 @@ -import { useAppStoreHook } from '@/store/modules/app'; +import { useRootSetting } from './setting/useRootSetting'; -export const useTransformTheme = () => { - const appStore = useAppStoreHook(); +export function useTransformTheme() { + const { appConfig } = useRootSetting(); const body = document.documentElement as HTMLElement; @@ -34,7 +34,7 @@ export const useTransformTheme = () => { } function updateColor() { - const { primaryColor, themeMode } = appStore.appConfigMode; + const { primaryColor, themeMode } = appConfig.value; if (!primaryColor) return; const style = document.getElementById('admin-style-root-color'); @@ -63,4 +63,4 @@ export const useTransformTheme = () => { } return { updateColor, themeHtmlClassName }; -}; +} diff --git a/src/layouts/pageLayouts/components/AppTabs/index.vue b/src/layouts/pageLayouts/components/AppTabs/index.vue index 1f49dc4f..e4a91152 100644 --- a/src/layouts/pageLayouts/components/AppTabs/index.vue +++ b/src/layouts/pageLayouts/components/AppTabs/index.vue @@ -1,16 +1,15 @@