From 8ba71a08573c9cd4694f6fb69f927f8324cdbd74 Mon Sep 17 00:00:00 2001 From: Azir <2075125282@qq.com> Date: Sat, 14 Jun 2025 19:54:43 +0800 Subject: [PATCH] feat(projects): refactor theme drawer with tabbed layout for better UX. --- src/constants/app.ts | 40 ++-- .../components/layout-mode-card.vue | 4 +- src/layouts/modules/theme-drawer/index.vue | 41 +++- .../theme-drawer/modules/appearance/index.vue | 17 ++ .../{ => appearance/modules}/theme-color.vue | 16 +- .../modules/theme-schema.vue} | 12 +- .../theme-drawer/modules/general/index.vue | 15 ++ .../general/modules/global-settings.vue | 59 ++++++ .../theme-drawer/modules/layout/index.vue | 25 +++ .../layout/modules/content-settings.vue | 61 ++++++ .../layout/modules/footer-settings.vue | 58 ++++++ .../layout/modules/header-settings.vue | 47 +++++ .../{ => layout/modules}/layout-mode.vue | 8 +- .../modules/layout/modules/sider-settings.vue | 53 +++++ .../modules/layout/modules/tab-settings.vue | 61 ++++++ .../modules/theme-drawer/modules/page-fun.vue | 157 --------------- src/locales/langs/en-us.ts | 185 ++++++++++-------- src/locales/langs/zh-cn.ts | 185 ++++++++++-------- src/typings/app.d.ts | 113 ++++++----- 19 files changed, 739 insertions(+), 418 deletions(-) create mode 100644 src/layouts/modules/theme-drawer/modules/appearance/index.vue rename src/layouts/modules/theme-drawer/modules/{ => appearance/modules}/theme-color.vue (75%) rename src/layouts/modules/theme-drawer/modules/{dark-mode.vue => appearance/modules/theme-schema.vue} (84%) create mode 100644 src/layouts/modules/theme-drawer/modules/general/index.vue create mode 100644 src/layouts/modules/theme-drawer/modules/general/modules/global-settings.vue create mode 100644 src/layouts/modules/theme-drawer/modules/layout/index.vue create mode 100644 src/layouts/modules/theme-drawer/modules/layout/modules/content-settings.vue create mode 100644 src/layouts/modules/theme-drawer/modules/layout/modules/footer-settings.vue create mode 100644 src/layouts/modules/theme-drawer/modules/layout/modules/header-settings.vue rename src/layouts/modules/theme-drawer/modules/{ => layout/modules}/layout-mode.vue (88%) create mode 100644 src/layouts/modules/theme-drawer/modules/layout/modules/sider-settings.vue create mode 100644 src/layouts/modules/theme-drawer/modules/layout/modules/tab-settings.vue delete mode 100644 src/layouts/modules/theme-drawer/modules/page-fun.vue diff --git a/src/constants/app.ts b/src/constants/app.ts index 4767c479..ed468c59 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -5,9 +5,9 @@ export const GLOBAL_HEADER_MENU_ID = '__GLOBAL_HEADER_MENU__'; export const GLOBAL_SIDER_MENU_ID = '__GLOBAL_SIDER_MENU__'; export const themeSchemaRecord: Record = { - light: 'theme.themeSchema.light', - dark: 'theme.themeSchema.dark', - auto: 'theme.themeSchema.auto' + light: 'theme.appearance.themeSchema.light', + dark: 'theme.appearance.themeSchema.dark', + auto: 'theme.appearance.themeSchema.auto' }; export const themeSchemaOptions = transformRecordToOption(themeSchemaRecord); @@ -21,43 +21,43 @@ export const loginModuleRecord: Record = }; export const themeLayoutModeRecord: Record = { - vertical: 'theme.layoutMode.vertical', - 'vertical-mix': 'theme.layoutMode.vertical-mix', - horizontal: 'theme.layoutMode.horizontal', - 'horizontal-mix': 'theme.layoutMode.horizontal-mix' + vertical: 'theme.layout.layoutMode.vertical', + 'vertical-mix': 'theme.layout.layoutMode.vertical-mix', + horizontal: 'theme.layout.layoutMode.horizontal', + 'horizontal-mix': 'theme.layout.layoutMode.horizontal-mix' }; export const themeLayoutModeOptions = transformRecordToOption(themeLayoutModeRecord); export const themeScrollModeRecord: Record = { - wrapper: 'theme.scrollMode.wrapper', - content: 'theme.scrollMode.content' + wrapper: 'theme.layout.content.scrollMode.wrapper', + content: 'theme.layout.content.scrollMode.content' }; export const themeScrollModeOptions = transformRecordToOption(themeScrollModeRecord); export const themeTabModeRecord: Record = { - chrome: 'theme.tab.mode.chrome', - button: 'theme.tab.mode.button' + chrome: 'theme.layout.tab.mode.chrome', + button: 'theme.layout.tab.mode.button' }; export const themeTabModeOptions = transformRecordToOption(themeTabModeRecord); export const themePageAnimationModeRecord: Record = { - 'fade-slide': 'theme.page.mode.fade-slide', - fade: 'theme.page.mode.fade', - 'fade-bottom': 'theme.page.mode.fade-bottom', - 'fade-scale': 'theme.page.mode.fade-scale', - 'zoom-fade': 'theme.page.mode.zoom-fade', - 'zoom-out': 'theme.page.mode.zoom-out', - none: 'theme.page.mode.none' + 'fade-slide': 'theme.layout.content.page.mode.fade-slide', + fade: 'theme.layout.content.page.mode.fade', + 'fade-bottom': 'theme.layout.content.page.mode.fade-bottom', + 'fade-scale': 'theme.layout.content.page.mode.fade-scale', + 'zoom-fade': 'theme.layout.content.page.mode.zoom-fade', + 'zoom-out': 'theme.layout.content.page.mode.zoom-out', + none: 'theme.layout.content.page.mode.none' }; export const themePageAnimationModeOptions = transformRecordToOption(themePageAnimationModeRecord); export const resetCacheStrategyRecord: Record = { - close: 'theme.resetCacheStrategy.close', - refresh: 'theme.resetCacheStrategy.refresh' + close: 'theme.layout.resetCacheStrategy.close', + refresh: 'theme.layout.resetCacheStrategy.refresh' }; export const resetCacheStrategyOptions = transformRecordToOption(resetCacheStrategyRecord); diff --git a/src/layouts/modules/theme-drawer/components/layout-mode-card.vue b/src/layouts/modules/theme-drawer/components/layout-mode-card.vue index ae396048..b430fd01 100644 --- a/src/layouts/modules/theme-drawer/components/layout-mode-card.vue +++ b/src/layouts/modules/theme-drawer/components/layout-mode-card.vue @@ -68,11 +68,11 @@ function handleChangeMode(mode: UnionKey.ThemeLayoutMode) {