@kevairy/template 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +14 -0
- package/package.json +37 -0
- package/template/.env +22 -0
- package/template/.env.development +13 -0
- package/template/.env.production +10 -0
- package/template/.prettierignore +3 -0
- package/template/.prettierrc +20 -0
- package/template/.stylelintignore +9 -0
- package/template/.stylelintrc.cjs +84 -0
- package/template/LICENSE +21 -0
- package/template/README.md +22 -0
- package/template/_gitignore +19 -0
- package/template/eslint-auto-import.json +324 -0
- package/template/eslint.config.mjs +83 -0
- package/template/index.html +25 -0
- package/template/package.json +79 -0
- package/template/playwright.config.ts +25 -0
- package/template/public/favicon.ico +0 -0
- package/template/src/App.vue +39 -0
- package/template/src/adapters/auth/index.ts +9 -0
- package/template/src/adapters/auth/mock.ts +10 -0
- package/template/src/adapters/auth/types.ts +11 -0
- package/template/src/adapters/navigation/index.ts +13 -0
- package/template/src/adapters/navigation/types.ts +6 -0
- package/template/src/api/auth.ts +23 -0
- package/template/src/assets/images/avatar/avatar.webp +0 -0
- package/template/src/assets/images/avatar/avatar1.webp +0 -0
- package/template/src/assets/images/avatar/avatar10.webp +0 -0
- package/template/src/assets/images/avatar/avatar2.webp +0 -0
- package/template/src/assets/images/avatar/avatar3.webp +0 -0
- package/template/src/assets/images/avatar/avatar4.webp +0 -0
- package/template/src/assets/images/avatar/avatar5.webp +0 -0
- package/template/src/assets/images/avatar/avatar6.webp +0 -0
- package/template/src/assets/images/avatar/avatar7.webp +0 -0
- package/template/src/assets/images/avatar/avatar8.webp +0 -0
- package/template/src/assets/images/avatar/avatar9.webp +0 -0
- package/template/src/assets/images/ceremony/hb.png +0 -0
- package/template/src/assets/images/ceremony/sd.png +0 -0
- package/template/src/assets/images/ceremony/xc.png +0 -0
- package/template/src/assets/images/ceremony/yd.png +0 -0
- package/template/src/assets/images/common/logo.webp +0 -0
- package/template/src/assets/images/draw/draw1.png +0 -0
- package/template/src/assets/images/favicon.ico +0 -0
- package/template/src/assets/images/lock/bg_dark.webp +0 -0
- package/template/src/assets/images/lock/bg_light.webp +0 -0
- package/template/src/assets/images/login/kylin-hero-source.png +0 -0
- package/template/src/assets/images/login/lf_icon2.webp +0 -0
- package/template/src/assets/images/settings/menu_layouts/dual_column.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/horizontal.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/mixed.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/vertical.png +0 -0
- package/template/src/assets/images/settings/menu_styles/dark.png +0 -0
- package/template/src/assets/images/settings/menu_styles/design.png +0 -0
- package/template/src/assets/images/settings/menu_styles/light.png +0 -0
- package/template/src/assets/images/settings/theme_styles/dark.png +0 -0
- package/template/src/assets/images/settings/theme_styles/light.png +0 -0
- package/template/src/assets/images/settings/theme_styles/system.png +0 -0
- package/template/src/assets/images/svg/403.svg +1 -0
- package/template/src/assets/images/svg/404.svg +1 -0
- package/template/src/assets/images/svg/500.svg +5 -0
- package/template/src/assets/images/svg/login_icon.svg +1 -0
- package/template/src/assets/images/user/avatar.webp +0 -0
- package/template/src/assets/images/user/bg.webp +0 -0
- package/template/src/assets/styles/core/app.scss +227 -0
- package/template/src/assets/styles/core/dark.scss +93 -0
- package/template/src/assets/styles/core/el-dark.scss +2 -0
- package/template/src/assets/styles/core/el-light.scss +34 -0
- package/template/src/assets/styles/core/el-ui.scss +519 -0
- package/template/src/assets/styles/core/md.scss +1036 -0
- package/template/src/assets/styles/core/mixin.scss +157 -0
- package/template/src/assets/styles/core/reset.scss +41 -0
- package/template/src/assets/styles/core/router-transition.scss +104 -0
- package/template/src/assets/styles/core/tailwind.css +219 -0
- package/template/src/assets/styles/core/theme-animation.scss +63 -0
- package/template/src/assets/styles/core/theme-change.scss +11 -0
- package/template/src/assets/styles/custom/one-dark-pro.scss +98 -0
- package/template/src/assets/styles/index.scss +23 -0
- package/template/src/assets/svg/loading.ts +32 -0
- package/template/src/bootstrap/initializeApp.ts +30 -0
- package/template/src/components/core/banners/art-basic-banner/index.vue +343 -0
- package/template/src/components/core/banners/art-card-banner/index.vue +114 -0
- package/template/src/components/core/base/art-back-to-top/index.vue +40 -0
- package/template/src/components/core/base/art-logo/index.vue +34 -0
- package/template/src/components/core/base/art-svg-icon/index.vue +24 -0
- package/template/src/components/core/cards/art-bar-chart-card/index.vue +103 -0
- package/template/src/components/core/cards/art-data-list-card/index.vue +74 -0
- package/template/src/components/core/cards/art-donut-chart-card/index.vue +124 -0
- package/template/src/components/core/cards/art-image-card/index.vue +89 -0
- package/template/src/components/core/cards/art-line-chart-card/index.vue +126 -0
- package/template/src/components/core/cards/art-progress-card/index.vue +86 -0
- package/template/src/components/core/cards/art-stats-card/index.vue +67 -0
- package/template/src/components/core/cards/art-timeline-list-card/index.vue +69 -0
- package/template/src/components/core/charts/art-bar-chart/index.vue +203 -0
- package/template/src/components/core/charts/art-dual-bar-compare-chart/index.vue +195 -0
- package/template/src/components/core/charts/art-h-bar-chart/index.vue +208 -0
- package/template/src/components/core/charts/art-k-line-chart/index.vue +152 -0
- package/template/src/components/core/charts/art-line-chart/index.vue +371 -0
- package/template/src/components/core/charts/art-radar-chart/index.vue +105 -0
- package/template/src/components/core/charts/art-ring-chart/index.vue +133 -0
- package/template/src/components/core/charts/art-scatter-chart/index.vue +115 -0
- package/template/src/components/core/feedback/art-page-loading/index.vue +281 -0
- package/template/src/components/core/forms/art-button-more/index.vue +71 -0
- package/template/src/components/core/forms/art-button-table/index.vue +59 -0
- package/template/src/components/core/forms/art-drag-verify/index.vue +430 -0
- package/template/src/components/core/forms/art-excel-export/index.vue +390 -0
- package/template/src/components/core/forms/art-excel-import/index.vue +62 -0
- package/template/src/components/core/forms/art-form/index.vue +507 -0
- package/template/src/components/core/forms/art-wang-editor/index.vue +261 -0
- package/template/src/components/core/forms/art-wang-editor/style.scss +273 -0
- package/template/src/components/core/layouts/art-breadcrumb/index.vue +142 -0
- package/template/src/components/core/layouts/art-chat-window/index.vue +262 -0
- package/template/src/components/core/layouts/art-fast-enter/index.vue +113 -0
- package/template/src/components/core/layouts/art-fireworks-effect/index.vue +633 -0
- package/template/src/components/core/layouts/art-global-component/index.vue +14 -0
- package/template/src/components/core/layouts/art-global-search/index.vue +431 -0
- package/template/src/components/core/layouts/art-header-bar/index.vue +485 -0
- package/template/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue +118 -0
- package/template/src/components/core/layouts/art-menus/art-horizontal-menu/index.vue +110 -0
- package/template/src/components/core/layouts/art-menus/art-horizontal-menu/widget/HorizontalSubmenu.vue +106 -0
- package/template/src/components/core/layouts/art-menus/art-mixed-menu/index.vue +279 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/index.vue +354 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/style.scss +251 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/theme.scss +258 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/widget/SidebarSubmenu.vue +190 -0
- package/template/src/components/core/layouts/art-notification/index.vue +456 -0
- package/template/src/components/core/layouts/art-page-content/index.vue +137 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsConfig.ts +248 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsHandlers.ts +167 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsPanel.ts +233 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsState.ts +37 -0
- package/template/src/components/core/layouts/art-settings-panel/index.vue +72 -0
- package/template/src/components/core/layouts/art-settings-panel/style.scss +92 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/BasicSettings.vue +77 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/BoxStyleSettings.vue +38 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ColorSettings.vue +35 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ContainerSettings.vue +33 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/MenuLayoutSettings.vue +31 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/MenuStyleSettings.vue +44 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SectionTitle.vue +17 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingActions.vue +236 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingDrawer.vue +51 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingHeader.vue +18 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingItem.vue +101 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ThemeSettings.vue +28 -0
- package/template/src/components/core/layouts/art-work-tab/index.vue +584 -0
- package/template/src/components/core/media/art-cutter-img/index.vue +350 -0
- package/template/src/components/core/media/art-video-player/index.vue +111 -0
- package/template/src/components/core/others/art-menu-right/index.vue +415 -0
- package/template/src/components/core/others/art-watermark/index.vue +64 -0
- package/template/src/components/core/text-effect/art-count-to/index.vue +310 -0
- package/template/src/components/core/text-effect/art-festival-text-scroll/index.vue +32 -0
- package/template/src/components/core/text-effect/art-text-scroll/index.vue +285 -0
- package/template/src/components/core/theme/theme-svg/index.vue +100 -0
- package/template/src/components/core/views/exception/ArtException.vue +55 -0
- package/template/src/components/core/views/login/AuthTopBar.vue +149 -0
- package/template/src/components/core/views/login/LoginLeftView.vue +602 -0
- package/template/src/components/core/views/result/ArtResultPage.vue +43 -0
- package/template/src/components/core/widget/art-icon-button/index.vue +23 -0
- package/template/src/config/assets/images.ts +61 -0
- package/template/src/config/index.ts +170 -0
- package/template/src/config/modules/component.ts +98 -0
- package/template/src/config/modules/fastEnter.ts +16 -0
- package/template/src/config/modules/festival.ts +51 -0
- package/template/src/config/modules/headerBar.ts +64 -0
- package/template/src/config/setting.ts +109 -0
- package/template/src/directives/core/auth.ts +66 -0
- package/template/src/directives/core/highlight-loader.ts +37 -0
- package/template/src/directives/core/highlight.ts +253 -0
- package/template/src/directives/core/ripple.ts +116 -0
- package/template/src/directives/core/roles.ts +87 -0
- package/template/src/directives/index.ts +14 -0
- package/template/src/enums/appEnum.ts +81 -0
- package/template/src/enums/formEnum.ts +17 -0
- package/template/src/env.d.ts +32 -0
- package/template/src/hooks/core/useAppMode.ts +45 -0
- package/template/src/hooks/core/useAuth.ts +74 -0
- package/template/src/hooks/core/useCeremony.ts +184 -0
- package/template/src/hooks/core/useChart.ts +745 -0
- package/template/src/hooks/core/useCommon.ts +87 -0
- package/template/src/hooks/core/useFastEnter.ts +55 -0
- package/template/src/hooks/core/useHeaderBar.ts +201 -0
- package/template/src/hooks/core/useLayoutHeight.ts +148 -0
- package/template/src/hooks/core/useTableColumns.ts +313 -0
- package/template/src/hooks/core/useTheme.ts +174 -0
- package/template/src/hooks/index.ts +29 -0
- package/template/src/locales/index.ts +123 -0
- package/template/src/locales/langs/en.json +283 -0
- package/template/src/locales/langs/zh.json +283 -0
- package/template/src/main.ts +29 -0
- package/template/src/mock/auth.ts +46 -0
- package/template/src/plugins/echarts.ts +76 -0
- package/template/src/plugins/index.ts +6 -0
- package/template/src/router/core/ComponentLoader.ts +82 -0
- package/template/src/router/core/IframeRouteManager.ts +78 -0
- package/template/src/router/core/MenuProcessor.ts +280 -0
- package/template/src/router/core/RoutePermissionValidator.ts +161 -0
- package/template/src/router/core/RouteRegistry.ts +90 -0
- package/template/src/router/core/RouteTransformer.ts +132 -0
- package/template/src/router/core/RouteValidator.ts +187 -0
- package/template/src/router/core/index.ts +14 -0
- package/template/src/router/guards/afterEach.ts +34 -0
- package/template/src/router/guards/beforeEach.ts +442 -0
- package/template/src/router/index.ts +24 -0
- package/template/src/router/modules/dashboard.ts +23 -0
- package/template/src/router/modules/examples.ts +109 -0
- package/template/src/router/modules/exception.ts +46 -0
- package/template/src/router/modules/index.ts +12 -0
- package/template/src/router/modules/result.ts +32 -0
- package/template/src/router/routes/asyncRoutes.ts +9 -0
- package/template/src/router/routes/staticRoutes.ts +60 -0
- package/template/src/router/routesAlias.ts +8 -0
- package/template/src/services/auth.ts +15 -0
- package/template/src/store/index.ts +52 -0
- package/template/src/store/modules/menu.ts +109 -0
- package/template/src/store/modules/setting.ts +450 -0
- package/template/src/store/modules/user.ts +218 -0
- package/template/src/store/modules/worktab.ts +568 -0
- package/template/src/types/api/api.d.ts +86 -0
- package/template/src/types/common/index.ts +95 -0
- package/template/src/types/common/response.ts +32 -0
- package/template/src/types/component/chart.ts +324 -0
- package/template/src/types/component/index.ts +86 -0
- package/template/src/types/config/index.ts +253 -0
- package/template/src/types/directive/directive.d.ts +15 -0
- package/template/src/types/import/auto-imports.d.ts +319 -0
- package/template/src/types/import/components.d.ts +126 -0
- package/template/src/types/index.ts +22 -0
- package/template/src/types/router/index.ts +80 -0
- package/template/src/types/store/index.ts +157 -0
- package/template/src/utils/form/index.ts +9 -0
- package/template/src/utils/form/validator.ts +316 -0
- package/template/src/utils/http/contract.ts +39 -0
- package/template/src/utils/http/error.ts +182 -0
- package/template/src/utils/http/index.ts +226 -0
- package/template/src/utils/http/status.ts +18 -0
- package/template/src/utils/index.ts +31 -0
- package/template/src/utils/navigation/index.ts +10 -0
- package/template/src/utils/navigation/jump.ts +68 -0
- package/template/src/utils/navigation/route.ts +85 -0
- package/template/src/utils/navigation/worktab.ts +67 -0
- package/template/src/utils/router.ts +63 -0
- package/template/src/utils/socket/index.ts +423 -0
- package/template/src/utils/storage/index.ts +7 -0
- package/template/src/utils/storage/storage-config.ts +127 -0
- package/template/src/utils/storage/storage-key-manager.ts +97 -0
- package/template/src/utils/storage/storage.ts +250 -0
- package/template/src/utils/sys/console.ts +9 -0
- package/template/src/utils/sys/error-handle.ts +143 -0
- package/template/src/utils/sys/index.ts +2 -0
- package/template/src/utils/sys/mittBus.ts +61 -0
- package/template/src/utils/ui/animation.ts +80 -0
- package/template/src/utils/ui/colors.ts +273 -0
- package/template/src/utils/ui/emojo.ts +24 -0
- package/template/src/utils/ui/iconify-loader.ts +31 -0
- package/template/src/utils/ui/index.ts +11 -0
- package/template/src/utils/ui/loading.ts +158 -0
- package/template/src/utils/ui/tabs.ts +60 -0
- package/template/src/views/auth/forget-password/index.vue +62 -0
- package/template/src/views/auth/login/index.vue +166 -0
- package/template/src/views/auth/login/style.css +38 -0
- package/template/src/views/auth/register/index.vue +240 -0
- package/template/src/views/dashboard/console/index.vue +173 -0
- package/template/src/views/examples/analytics/index.vue +389 -0
- package/template/src/views/examples/complex-form/index.vue +395 -0
- package/template/src/views/examples/crud-workspace/index.vue +412 -0
- package/template/src/views/examples/navigation/detail/index.vue +151 -0
- package/template/src/views/examples/navigation/state/index.vue +226 -0
- package/template/src/views/examples/overview/index.vue +309 -0
- package/template/src/views/examples/permissions/index.vue +303 -0
- package/template/src/views/examples/search-table/index.vue +182 -0
- package/template/src/views/examples/search-table/search.config.ts +81 -0
- package/template/src/views/examples/search-table/service.ts +116 -0
- package/template/src/views/examples/search-table/table.config.ts +37 -0
- package/template/src/views/exception/403/index.vue +16 -0
- package/template/src/views/exception/404/index.vue +16 -0
- package/template/src/views/exception/500/index.vue +16 -0
- package/template/src/views/index/index.vue +29 -0
- package/template/src/views/index/style.scss +93 -0
- package/template/src/views/outside/Iframe.vue +42 -0
- package/template/src/views/result/fail/index.vue +28 -0
- package/template/src/views/result/success/index.vue +21 -0
- package/template/tests/e2e/auth.spec.ts +14 -0
- package/template/tests/e2e/search-table.spec.ts +154 -0
- package/template/tests/unit/adapters/auth.spec.ts +38 -0
- package/template/tests/unit/config/app-config.spec.ts +17 -0
- package/template/tests/unit/directives/highlight.spec.ts +20 -0
- package/template/tests/unit/http/contract.spec.ts +47 -0
- package/template/tests/unit/mock/search-table.spec.ts +62 -0
- package/template/tests/unit/router/examples.spec.ts +52 -0
- package/template/tsconfig.json +28 -0
- package/template/vite.config.ts +181 -0
- package/template/vitest.config.ts +27 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!-- 设置面板 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="layout-settings">
|
|
4
|
+
<SettingDrawer v-model="showDrawer" @open="handleOpen" @close="handleClose">
|
|
5
|
+
<!-- 头部关闭按钮 -->
|
|
6
|
+
<SettingHeader @close="closeDrawer" />
|
|
7
|
+
<!-- 主题风格 -->
|
|
8
|
+
<ThemeSettings />
|
|
9
|
+
<!-- 菜单布局 -->
|
|
10
|
+
<MenuLayoutSettings />
|
|
11
|
+
<!-- 菜单风格 -->
|
|
12
|
+
<MenuStyleSettings />
|
|
13
|
+
<!-- 系统主题色 -->
|
|
14
|
+
<ColorSettings />
|
|
15
|
+
<!-- 盒子样式 -->
|
|
16
|
+
<BoxStyleSettings />
|
|
17
|
+
<!-- 容器宽度 -->
|
|
18
|
+
<ContainerSettings />
|
|
19
|
+
<!-- 基础配置 -->
|
|
20
|
+
<BasicSettings />
|
|
21
|
+
<!-- 操作按钮 -->
|
|
22
|
+
<SettingActions />
|
|
23
|
+
</SettingDrawer>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import { useSettingsPanel } from './composables/useSettingsPanel'
|
|
29
|
+
|
|
30
|
+
import SettingDrawer from './widget/SettingDrawer.vue'
|
|
31
|
+
import SettingHeader from './widget/SettingHeader.vue'
|
|
32
|
+
import ThemeSettings from './widget/ThemeSettings.vue'
|
|
33
|
+
import MenuLayoutSettings from './widget/MenuLayoutSettings.vue'
|
|
34
|
+
import MenuStyleSettings from './widget/MenuStyleSettings.vue'
|
|
35
|
+
import ColorSettings from './widget/ColorSettings.vue'
|
|
36
|
+
import BoxStyleSettings from './widget/BoxStyleSettings.vue'
|
|
37
|
+
import ContainerSettings from './widget/ContainerSettings.vue'
|
|
38
|
+
import BasicSettings from './widget/BasicSettings.vue'
|
|
39
|
+
import SettingActions from './widget/SettingActions.vue'
|
|
40
|
+
|
|
41
|
+
defineOptions({ name: 'ArtSettingsPanel' })
|
|
42
|
+
|
|
43
|
+
interface Props {
|
|
44
|
+
/** 是否打开 */
|
|
45
|
+
open?: boolean
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const props = defineProps<Props>()
|
|
49
|
+
|
|
50
|
+
// 使用设置面板逻辑
|
|
51
|
+
const settingsPanel = useSettingsPanel()
|
|
52
|
+
const { showDrawer } = settingsPanel
|
|
53
|
+
|
|
54
|
+
// 获取各种处理器
|
|
55
|
+
const { handleOpen, handleClose, closeDrawer } = settingsPanel.useDrawerControl()
|
|
56
|
+
const { initializeSettings, cleanupSettings } = settingsPanel.useSettingsInitializer()
|
|
57
|
+
|
|
58
|
+
// 监听 props 变化
|
|
59
|
+
settingsPanel.usePropsWatcher(props)
|
|
60
|
+
|
|
61
|
+
onMounted(() => {
|
|
62
|
+
initializeSettings()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
onUnmounted(() => {
|
|
66
|
+
cleanupSettings()
|
|
67
|
+
})
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style lang="scss">
|
|
71
|
+
@use './style';
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
@use '@styles/core/mixin.scss' as *;
|
|
2
|
+
|
|
3
|
+
// 设置抽屉模态框样式
|
|
4
|
+
.setting-modal {
|
|
5
|
+
background: transparent !important;
|
|
6
|
+
|
|
7
|
+
.el-drawer {
|
|
8
|
+
// 背景滤镜效果
|
|
9
|
+
background: rgba($color: #fff, $alpha: 50%) !important;
|
|
10
|
+
box-shadow: 0 0 30px rgb(0 0 0 / 10%) !important;
|
|
11
|
+
|
|
12
|
+
@include backdropBlur();
|
|
13
|
+
|
|
14
|
+
.setting-box-wrap {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
align-items: center;
|
|
18
|
+
width: calc(100% + 15px);
|
|
19
|
+
margin-bottom: 10px;
|
|
20
|
+
|
|
21
|
+
.setting-item {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
width: calc(33.333% - 15px);
|
|
24
|
+
margin-right: 15px;
|
|
25
|
+
text-align: center;
|
|
26
|
+
|
|
27
|
+
.box {
|
|
28
|
+
position: relative;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
display: flex;
|
|
31
|
+
height: 52px;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
border: 2px solid var(--default-border);
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
box-shadow: 0 0 8px 0 rgb(0 0 0 / 10%);
|
|
37
|
+
transition: box-shadow 0.1s;
|
|
38
|
+
|
|
39
|
+
&.mt-16 {
|
|
40
|
+
margin-top: 16px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.is-active {
|
|
44
|
+
border: 2px solid var(--theme-color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
img {
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.name {
|
|
54
|
+
margin-top: 6px;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
text-align: center;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 去除滚动条
|
|
63
|
+
.el-drawer__body::-webkit-scrollbar {
|
|
64
|
+
width: 0 !important;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dark {
|
|
69
|
+
.setting-modal {
|
|
70
|
+
.el-drawer {
|
|
71
|
+
background: rgba($color: #000, $alpha: 50%) !important;
|
|
72
|
+
|
|
73
|
+
.setting-item {
|
|
74
|
+
.box {
|
|
75
|
+
border: 2px solid transparent;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 去除火狐浏览器滚动条
|
|
83
|
+
:deep(.el-drawer__body) {
|
|
84
|
+
scrollbar-width: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 移动端隐藏
|
|
88
|
+
@media screen and (width <= 800px) {
|
|
89
|
+
.mobile-hide {
|
|
90
|
+
display: none !important;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<SectionTitle :title="$t('setting.basics.title')" class="mt-10" />
|
|
4
|
+
<SettingItem
|
|
5
|
+
v-for="config in basicSettingsConfig"
|
|
6
|
+
:key="config.key"
|
|
7
|
+
:config="config"
|
|
8
|
+
:model-value="getSettingValue(config.key)"
|
|
9
|
+
@change="handleSettingChange(config.handler, $event)"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import SectionTitle from './SectionTitle.vue'
|
|
16
|
+
import SettingItem from './SettingItem.vue'
|
|
17
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
18
|
+
import { useSettingsConfig } from '../composables/useSettingsConfig'
|
|
19
|
+
import { useSettingsHandlers } from '../composables/useSettingsHandlers'
|
|
20
|
+
import { storeToRefs } from 'pinia'
|
|
21
|
+
|
|
22
|
+
const settingStore = useSettingStore()
|
|
23
|
+
const { basicSettingsConfig } = useSettingsConfig()
|
|
24
|
+
const { basicHandlers } = useSettingsHandlers()
|
|
25
|
+
|
|
26
|
+
// 获取store的响应式状态
|
|
27
|
+
const {
|
|
28
|
+
uniqueOpened,
|
|
29
|
+
showMenuButton,
|
|
30
|
+
showFastEnter,
|
|
31
|
+
showRefreshButton,
|
|
32
|
+
showCrumbs,
|
|
33
|
+
showWorkTab,
|
|
34
|
+
showLanguage,
|
|
35
|
+
showNprogress,
|
|
36
|
+
colorWeak,
|
|
37
|
+
watermarkVisible,
|
|
38
|
+
menuOpenWidth,
|
|
39
|
+
tabStyle,
|
|
40
|
+
pageTransition,
|
|
41
|
+
customRadius
|
|
42
|
+
} = storeToRefs(settingStore)
|
|
43
|
+
|
|
44
|
+
// 创建设置值映射
|
|
45
|
+
const settingValueMap = {
|
|
46
|
+
uniqueOpened,
|
|
47
|
+
showMenuButton,
|
|
48
|
+
showFastEnter,
|
|
49
|
+
showRefreshButton,
|
|
50
|
+
showCrumbs,
|
|
51
|
+
showWorkTab,
|
|
52
|
+
showLanguage,
|
|
53
|
+
showNprogress,
|
|
54
|
+
colorWeak,
|
|
55
|
+
watermarkVisible,
|
|
56
|
+
menuOpenWidth,
|
|
57
|
+
tabStyle,
|
|
58
|
+
pageTransition,
|
|
59
|
+
customRadius
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 获取设置值的方法
|
|
63
|
+
const getSettingValue = (key: string) => {
|
|
64
|
+
const settingRef = settingValueMap[key as keyof typeof settingValueMap]
|
|
65
|
+
return settingRef?.value ?? null
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 统一的设置变更处理
|
|
69
|
+
const handleSettingChange = (handlerName: string, value: any) => {
|
|
70
|
+
const handler = (basicHandlers as any)[handlerName]
|
|
71
|
+
if (typeof handler === 'function') {
|
|
72
|
+
handler(value)
|
|
73
|
+
} else {
|
|
74
|
+
console.warn(`Handler "${handlerName}" not found in basicHandlers`)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<SectionTitle :title="$t('setting.box.title')" class="mt-10" />
|
|
4
|
+
<div class="box-border flex-cb p-1 mt-5 rounded-lg bg-g-200">
|
|
5
|
+
<div
|
|
6
|
+
v-for="option in boxStyleOptions"
|
|
7
|
+
:key="option.value"
|
|
8
|
+
class="w-[calc(50%-3px)] h-8.5 leading-8.5 text-sm text-center c-p select-none rounded-md transition-all duration-200"
|
|
9
|
+
:class="
|
|
10
|
+
isActive(option.type)
|
|
11
|
+
? 'text-g-800 bg-[var(--default-box-color)] dark:!text-white dark:bg-g-300'
|
|
12
|
+
: 'hover:text-g-800 hover:bg-black/[0.04] dark:hover:bg-black/20'
|
|
13
|
+
"
|
|
14
|
+
@click="boxStyleHandlers.setBoxMode(option.type)"
|
|
15
|
+
>
|
|
16
|
+
{{ option.label }}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import SectionTitle from './SectionTitle.vue'
|
|
24
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
25
|
+
import { useSettingsConfig } from '../composables/useSettingsConfig'
|
|
26
|
+
import { useSettingsHandlers } from '../composables/useSettingsHandlers'
|
|
27
|
+
import { storeToRefs } from 'pinia'
|
|
28
|
+
|
|
29
|
+
const settingStore = useSettingStore()
|
|
30
|
+
const { boxBorderMode } = storeToRefs(settingStore)
|
|
31
|
+
const { boxStyleOptions } = useSettingsConfig()
|
|
32
|
+
const { boxStyleHandlers } = useSettingsHandlers()
|
|
33
|
+
|
|
34
|
+
// 判断当前选项是否激活
|
|
35
|
+
const isActive = (type: 'border-mode' | 'shadow-mode') => {
|
|
36
|
+
return type === 'border-mode' ? boxBorderMode.value : !boxBorderMode.value
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<SectionTitle :title="$t('setting.color.title')" class="mt-10" />
|
|
4
|
+
<div class="-mr-4">
|
|
5
|
+
<div class="flex flex-wrap">
|
|
6
|
+
<div
|
|
7
|
+
v-for="color in configOptions.mainColors"
|
|
8
|
+
:key="color"
|
|
9
|
+
class="flex items-center justify-center size-[23px] mr-4 mb-2.5 cursor-pointer rounded-full transition-all duration-200 hover:opacity-85"
|
|
10
|
+
:style="{ background: `${color} !important` }"
|
|
11
|
+
@click="colorHandlers.selectColor(color)"
|
|
12
|
+
>
|
|
13
|
+
<ArtSvgIcon
|
|
14
|
+
icon="ri:check-fill"
|
|
15
|
+
class="text-base !text-white"
|
|
16
|
+
v-show="color === systemThemeColor"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import SectionTitle from './SectionTitle.vue'
|
|
26
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
27
|
+
import { useSettingsConfig } from '../composables/useSettingsConfig'
|
|
28
|
+
import { useSettingsHandlers } from '../composables/useSettingsHandlers'
|
|
29
|
+
import { storeToRefs } from 'pinia'
|
|
30
|
+
|
|
31
|
+
const settingStore = useSettingStore()
|
|
32
|
+
const { systemThemeColor } = storeToRefs(settingStore)
|
|
33
|
+
const { configOptions } = useSettingsConfig()
|
|
34
|
+
const { colorHandlers } = useSettingsHandlers()
|
|
35
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<SectionTitle :title="$t('setting.container.title')" class="mt-12.5" />
|
|
4
|
+
<div class="flex">
|
|
5
|
+
<div
|
|
6
|
+
v-for="option in containerWidthOptions"
|
|
7
|
+
:key="option.value"
|
|
8
|
+
class="flex-cc flex-1 h-16 mt-5 mr-3.5 mb-3.5 cursor-pointer !border-2 rounded-lg !text-g-800 last:mr-0"
|
|
9
|
+
:class="{
|
|
10
|
+
'border-theme [&_i]:!text-theme': containerWidth === option.value,
|
|
11
|
+
'border-full-d': containerWidth !== option.value
|
|
12
|
+
}"
|
|
13
|
+
@click="containerHandlers.setWidth(option.value)"
|
|
14
|
+
>
|
|
15
|
+
<ArtSvgIcon :icon="option.icon" class="mr-2 text-lg" />
|
|
16
|
+
<span class="text-sm">{{ option.label }}</span>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import SectionTitle from './SectionTitle.vue'
|
|
24
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
25
|
+
import { useSettingsConfig } from '../composables/useSettingsConfig'
|
|
26
|
+
import { useSettingsHandlers } from '../composables/useSettingsHandlers'
|
|
27
|
+
import { storeToRefs } from 'pinia'
|
|
28
|
+
|
|
29
|
+
const settingStore = useSettingStore()
|
|
30
|
+
const { containerWidth } = storeToRefs(settingStore)
|
|
31
|
+
const { containerWidthOptions } = useSettingsConfig()
|
|
32
|
+
const { containerHandlers } = useSettingsHandlers()
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="width > 1000">
|
|
3
|
+
<SectionTitle :title="$t('setting.menuType.title')" />
|
|
4
|
+
<div class="setting-box-wrap">
|
|
5
|
+
<div
|
|
6
|
+
class="setting-item"
|
|
7
|
+
v-for="(item, index) in configOptions.menuLayoutList"
|
|
8
|
+
:key="item.value"
|
|
9
|
+
@click="switchMenuLayouts(item.value)"
|
|
10
|
+
>
|
|
11
|
+
<div class="box" :class="{ 'is-active': item.value === menuType, 'mt-16': index > 2 }">
|
|
12
|
+
<img :src="item.img" />
|
|
13
|
+
</div>
|
|
14
|
+
<p class="name">{{ $t(`setting.menuType.list[${index}]`) }}</p>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import SectionTitle from './SectionTitle.vue'
|
|
22
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
23
|
+
import { useSettingsConfig } from '../composables/useSettingsConfig'
|
|
24
|
+
import { useSettingsState } from '../composables/useSettingsState'
|
|
25
|
+
|
|
26
|
+
const { width } = useWindowSize()
|
|
27
|
+
const settingStore = useSettingStore()
|
|
28
|
+
const { menuType } = storeToRefs(settingStore)
|
|
29
|
+
const { configOptions } = useSettingsConfig()
|
|
30
|
+
const { switchMenuLayouts } = useSettingsState()
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<SectionTitle :title="$t('setting.menu.title')" />
|
|
3
|
+
<div class="setting-box-wrap">
|
|
4
|
+
<div
|
|
5
|
+
class="setting-item"
|
|
6
|
+
v-for="item in menuThemeList"
|
|
7
|
+
:key="item.theme"
|
|
8
|
+
@click="switchMenuStyles(item.theme)"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="box"
|
|
12
|
+
:class="{ 'is-active': item.theme === menuThemeType }"
|
|
13
|
+
:style="{
|
|
14
|
+
cursor: disabled ? 'no-drop' : 'pointer'
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<img :src="item.img" />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import AppConfig from '@/config'
|
|
25
|
+
import SectionTitle from './SectionTitle.vue'
|
|
26
|
+
import { MenuTypeEnum, type MenuThemeEnum } from '@/enums/appEnum'
|
|
27
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
28
|
+
|
|
29
|
+
const menuThemeList = AppConfig.themeList
|
|
30
|
+
const settingStore = useSettingStore()
|
|
31
|
+
const { menuThemeType, menuType, isDark } = storeToRefs(settingStore)
|
|
32
|
+
const isTopMenu = computed(() => menuType.value === MenuTypeEnum.TOP)
|
|
33
|
+
const isDualMenu = computed(() => menuType.value === MenuTypeEnum.DUAL_MENU)
|
|
34
|
+
|
|
35
|
+
const disabled = computed(() => isTopMenu.value || isDualMenu.value || isDark.value)
|
|
36
|
+
|
|
37
|
+
// 菜单样式切换
|
|
38
|
+
const switchMenuStyles = (theme: MenuThemeEnum) => {
|
|
39
|
+
if (isDualMenu.value || isTopMenu.value || isDark.value) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
settingStore.switchMenuStyles(theme)
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<p
|
|
3
|
+
class="relative mt-7.5 mb-5.5 text-sm text-center text-g-800 before:absolute before:top-[10px] before:left-0 before:w-[50px] before:m-auto before:content-[''] before:border-b before:border-[var(--art-gray-300)] after:absolute after:top-[10px] after:right-0 after:w-[50px] after:m-auto after:content-[''] after:border-b after:border-g-300"
|
|
4
|
+
:style="style"
|
|
5
|
+
>
|
|
6
|
+
{{ title }}
|
|
7
|
+
</p>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
interface Props {
|
|
12
|
+
title: string
|
|
13
|
+
style?: Record<string, any>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
defineProps<Props>()
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<!-- 设置操作按钮 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
class="mt-10 flex gap-8 border-t border-[var(--default-border)] bg-[var(--art-bg-color)] pt-5"
|
|
5
|
+
>
|
|
6
|
+
<ElButton type="primary" class="flex-1 !h-8" @click="handleCopyConfig">
|
|
7
|
+
{{ $t('setting.actions.copyConfig') }}
|
|
8
|
+
</ElButton>
|
|
9
|
+
<ElButton type="danger" plain class="flex-1 !h-8" @click="handleResetConfig">
|
|
10
|
+
{{ $t('setting.actions.resetConfig') }}
|
|
11
|
+
</ElButton>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { nextTick } from 'vue'
|
|
17
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
18
|
+
import { SETTING_DEFAULT_CONFIG } from '@/config/setting'
|
|
19
|
+
import { useClipboard } from '@vueuse/core'
|
|
20
|
+
import { useI18n } from 'vue-i18n'
|
|
21
|
+
import { MenuThemeEnum } from '@/enums/appEnum'
|
|
22
|
+
import { useTheme } from '@/hooks/core/useTheme'
|
|
23
|
+
import { ElMessage } from 'element-plus'
|
|
24
|
+
|
|
25
|
+
defineOptions({ name: 'SettingActions' })
|
|
26
|
+
|
|
27
|
+
const { t } = useI18n()
|
|
28
|
+
const settingStore = useSettingStore()
|
|
29
|
+
const { copy, copied } = useClipboard()
|
|
30
|
+
const { switchThemeStyles } = useTheme()
|
|
31
|
+
|
|
32
|
+
/** 枚举映射表 */
|
|
33
|
+
const ENUM_MAPS = {
|
|
34
|
+
menuType: {
|
|
35
|
+
left: 'MenuTypeEnum.LEFT',
|
|
36
|
+
top: 'MenuTypeEnum.TOP',
|
|
37
|
+
'top-left': 'MenuTypeEnum.TOP_LEFT',
|
|
38
|
+
'dual-menu': 'MenuTypeEnum.DUAL_MENU'
|
|
39
|
+
},
|
|
40
|
+
systemTheme: {
|
|
41
|
+
auto: 'SystemThemeEnum.AUTO',
|
|
42
|
+
light: 'SystemThemeEnum.LIGHT',
|
|
43
|
+
dark: 'SystemThemeEnum.DARK'
|
|
44
|
+
},
|
|
45
|
+
menuTheme: {
|
|
46
|
+
design: 'MenuThemeEnum.DESIGN',
|
|
47
|
+
light: 'MenuThemeEnum.LIGHT',
|
|
48
|
+
dark: 'MenuThemeEnum.DARK'
|
|
49
|
+
},
|
|
50
|
+
containerWidth: {
|
|
51
|
+
'100%': 'ContainerWidthEnum.FULL',
|
|
52
|
+
'1200px': 'ContainerWidthEnum.BOXED'
|
|
53
|
+
}
|
|
54
|
+
} as const
|
|
55
|
+
|
|
56
|
+
/** 配置项定义 */
|
|
57
|
+
interface ConfigItem {
|
|
58
|
+
comment: string
|
|
59
|
+
key: keyof typeof settingStore
|
|
60
|
+
enumMap?: Record<string, string>
|
|
61
|
+
forceValue?: any
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const CONFIG_ITEMS: ConfigItem[] = [
|
|
65
|
+
{ comment: '菜单类型', key: 'menuType', enumMap: ENUM_MAPS.menuType },
|
|
66
|
+
{ comment: '菜单展开宽度', key: 'menuOpenWidth' },
|
|
67
|
+
{ comment: '菜单是否展开', key: 'menuOpen' },
|
|
68
|
+
{ comment: '双菜单是否显示文本', key: 'dualMenuShowText' },
|
|
69
|
+
{ comment: '系统主题类型', key: 'systemThemeType', enumMap: ENUM_MAPS.systemTheme },
|
|
70
|
+
{ comment: '系统主题模式', key: 'systemThemeMode', enumMap: ENUM_MAPS.systemTheme },
|
|
71
|
+
{ comment: '菜单风格', key: 'menuThemeType', enumMap: ENUM_MAPS.menuTheme },
|
|
72
|
+
{ comment: '系统主题颜色', key: 'systemThemeColor' },
|
|
73
|
+
{ comment: '是否显示菜单按钮', key: 'showMenuButton' },
|
|
74
|
+
{ comment: '是否显示快速入口', key: 'showFastEnter' },
|
|
75
|
+
{ comment: '是否显示刷新按钮', key: 'showRefreshButton' },
|
|
76
|
+
{ comment: '是否显示面包屑', key: 'showCrumbs' },
|
|
77
|
+
{ comment: '是否显示工作台标签', key: 'showWorkTab' },
|
|
78
|
+
{ comment: '是否显示语言切换', key: 'showLanguage' },
|
|
79
|
+
{ comment: '是否显示进度条', key: 'showNprogress' },
|
|
80
|
+
{ comment: '是否显示设置引导', key: 'showSettingGuide' },
|
|
81
|
+
{ comment: '是否显示节日文本', key: 'showFestivalText' },
|
|
82
|
+
{ comment: '是否显示水印', key: 'watermarkVisible' },
|
|
83
|
+
{ comment: '是否自动关闭', key: 'autoClose' },
|
|
84
|
+
{ comment: '是否唯一展开', key: 'uniqueOpened' },
|
|
85
|
+
{ comment: '是否色弱模式', key: 'colorWeak' },
|
|
86
|
+
{ comment: '是否刷新', key: 'refresh' },
|
|
87
|
+
{ comment: '是否加载节日烟花', key: 'holidayFireworksLoaded' },
|
|
88
|
+
{ comment: '边框模式', key: 'boxBorderMode' },
|
|
89
|
+
{ comment: '页面过渡效果', key: 'pageTransition' },
|
|
90
|
+
{ comment: '标签页样式', key: 'tabStyle' },
|
|
91
|
+
{ comment: '自定义圆角', key: 'customRadius' },
|
|
92
|
+
{ comment: '容器宽度', key: 'containerWidth', enumMap: ENUM_MAPS.containerWidth },
|
|
93
|
+
{ comment: '节日日期', key: 'festivalDate', forceValue: '' }
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 将值转换为代码字符串
|
|
98
|
+
*/
|
|
99
|
+
const valueToCode = (value: any, enumMap?: Record<string, string>): string => {
|
|
100
|
+
if (value === null) return 'null'
|
|
101
|
+
if (value === undefined) return 'undefined'
|
|
102
|
+
|
|
103
|
+
// 优先查找枚举映射
|
|
104
|
+
if (enumMap && typeof value === 'string' && enumMap[value]) {
|
|
105
|
+
return enumMap[value]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 其他类型处理
|
|
109
|
+
if (typeof value === 'string') return `'${value}'`
|
|
110
|
+
if (typeof value === 'boolean' || typeof value === 'number') return String(value)
|
|
111
|
+
|
|
112
|
+
return JSON.stringify(value)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 生成配置代码
|
|
117
|
+
*/
|
|
118
|
+
const generateConfigCode = (): string => {
|
|
119
|
+
const lines = ['export const SETTING_DEFAULT_CONFIG = {']
|
|
120
|
+
|
|
121
|
+
CONFIG_ITEMS.forEach((item) => {
|
|
122
|
+
lines.push(` /** ${item.comment} */`)
|
|
123
|
+
const value = item.forceValue !== undefined ? item.forceValue : settingStore[item.key]
|
|
124
|
+
lines.push(` ${String(item.key)}: ${valueToCode(value, item.enumMap)},`)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
lines.push('}')
|
|
128
|
+
return lines.join('\n')
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 复制配置到剪贴板
|
|
133
|
+
*/
|
|
134
|
+
const handleCopyConfig = async () => {
|
|
135
|
+
try {
|
|
136
|
+
const configText = generateConfigCode()
|
|
137
|
+
await copy(configText)
|
|
138
|
+
|
|
139
|
+
if (copied.value) {
|
|
140
|
+
ElMessage.success({
|
|
141
|
+
message: t('setting.actions.copySuccess'),
|
|
142
|
+
duration: 3000
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error('复制配置失败:', error)
|
|
147
|
+
ElMessage.error(t('setting.actions.copyFailed'))
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 切换布尔值配置(如果当前值与默认值不同)
|
|
153
|
+
*/
|
|
154
|
+
const toggleIfDifferent = (
|
|
155
|
+
currentValue: boolean,
|
|
156
|
+
defaultValue: boolean,
|
|
157
|
+
toggleFn: () => void
|
|
158
|
+
) => {
|
|
159
|
+
if (currentValue !== defaultValue) {
|
|
160
|
+
toggleFn()
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 重置配置为默认值
|
|
166
|
+
*/
|
|
167
|
+
const handleResetConfig = async () => {
|
|
168
|
+
try {
|
|
169
|
+
const config = SETTING_DEFAULT_CONFIG
|
|
170
|
+
|
|
171
|
+
// 菜单相关
|
|
172
|
+
settingStore.switchMenuLayouts(config.menuType)
|
|
173
|
+
settingStore.setMenuOpenWidth(config.menuOpenWidth)
|
|
174
|
+
settingStore.setMenuOpen(config.menuOpen)
|
|
175
|
+
settingStore.setDualMenuShowText(config.dualMenuShowText)
|
|
176
|
+
|
|
177
|
+
// 主题相关 - 使用 switchThemeStyles 确保正确处理 AUTO 模式
|
|
178
|
+
switchThemeStyles(config.systemThemeMode)
|
|
179
|
+
|
|
180
|
+
// 等待主题切换完成后,根据实际应用的主题设置菜单主题
|
|
181
|
+
await nextTick()
|
|
182
|
+
const menuTheme = settingStore.isDark ? MenuThemeEnum.DARK : config.menuThemeType
|
|
183
|
+
settingStore.switchMenuStyles(menuTheme)
|
|
184
|
+
|
|
185
|
+
settingStore.setElementTheme(config.systemThemeColor)
|
|
186
|
+
|
|
187
|
+
// 界面显示(切换类方法)
|
|
188
|
+
toggleIfDifferent(settingStore.showMenuButton, config.showMenuButton, () =>
|
|
189
|
+
settingStore.setButton()
|
|
190
|
+
)
|
|
191
|
+
toggleIfDifferent(settingStore.showFastEnter, config.showFastEnter, () =>
|
|
192
|
+
settingStore.setFastEnter()
|
|
193
|
+
)
|
|
194
|
+
toggleIfDifferent(settingStore.showRefreshButton, config.showRefreshButton, () =>
|
|
195
|
+
settingStore.setShowRefreshButton()
|
|
196
|
+
)
|
|
197
|
+
toggleIfDifferent(settingStore.showCrumbs, config.showCrumbs, () => settingStore.setCrumbs())
|
|
198
|
+
toggleIfDifferent(settingStore.showLanguage, config.showLanguage, () =>
|
|
199
|
+
settingStore.setLanguage()
|
|
200
|
+
)
|
|
201
|
+
toggleIfDifferent(settingStore.showNprogress, config.showNprogress, () =>
|
|
202
|
+
settingStore.setNprogress()
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
// 界面显示(直接设置类方法)
|
|
206
|
+
settingStore.setWorkTab(config.showWorkTab)
|
|
207
|
+
settingStore.setShowFestivalText(config.showFestivalText)
|
|
208
|
+
settingStore.setWatermarkVisible(config.watermarkVisible)
|
|
209
|
+
|
|
210
|
+
// 功能设置
|
|
211
|
+
toggleIfDifferent(settingStore.autoClose, config.autoClose, () => settingStore.setAutoClose())
|
|
212
|
+
toggleIfDifferent(settingStore.uniqueOpened, config.uniqueOpened, () =>
|
|
213
|
+
settingStore.setUniqueOpened()
|
|
214
|
+
)
|
|
215
|
+
toggleIfDifferent(settingStore.colorWeak, config.colorWeak, () => settingStore.setColorWeak())
|
|
216
|
+
|
|
217
|
+
// 样式设置
|
|
218
|
+
toggleIfDifferent(settingStore.boxBorderMode, config.boxBorderMode, () =>
|
|
219
|
+
settingStore.setBorderMode()
|
|
220
|
+
)
|
|
221
|
+
settingStore.setPageTransition(config.pageTransition)
|
|
222
|
+
settingStore.setTabStyle(config.tabStyle)
|
|
223
|
+
settingStore.setCustomRadius(config.customRadius)
|
|
224
|
+
settingStore.setContainerWidth(config.containerWidth)
|
|
225
|
+
|
|
226
|
+
// 节日相关
|
|
227
|
+
settingStore.setFestivalDate(config.festivalDate)
|
|
228
|
+
settingStore.setholidayFireworksLoaded(config.holidayFireworksLoaded)
|
|
229
|
+
|
|
230
|
+
location.reload()
|
|
231
|
+
} catch (error) {
|
|
232
|
+
console.error('重置配置失败:', error)
|
|
233
|
+
ElMessage.error(t('setting.actions.resetFailed'))
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
</script>
|