@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,60 @@
|
|
|
1
|
+
import { AppRouteRecordRaw } from '@/utils/router'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 静态路由配置(不需要权限就能访问的路由)
|
|
5
|
+
*
|
|
6
|
+
* 属性说明:
|
|
7
|
+
* isHideTab: true 表示不在标签页中显示
|
|
8
|
+
*
|
|
9
|
+
* 注意事项:
|
|
10
|
+
* 1、path、name 不要和动态路由冲突,否则会导致路由冲突无法访问
|
|
11
|
+
* 2、静态路由不管是否登录都可以访问
|
|
12
|
+
*/
|
|
13
|
+
export const staticRoutes: AppRouteRecordRaw[] = [
|
|
14
|
+
// 不需要登录就能访问的路由示例
|
|
15
|
+
// {
|
|
16
|
+
// path: '/welcome',
|
|
17
|
+
// name: 'WelcomeStatic',
|
|
18
|
+
// component: () => import('@views/dashboard/console/index.vue'),
|
|
19
|
+
// meta: { title: 'menus.dashboard.title' }
|
|
20
|
+
// },
|
|
21
|
+
{
|
|
22
|
+
path: '/auth/login',
|
|
23
|
+
name: 'Login',
|
|
24
|
+
component: () => import('@views/auth/login/index.vue'),
|
|
25
|
+
meta: { title: 'menus.login.title', isHideTab: true }
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
path: '/403',
|
|
29
|
+
name: 'Exception403',
|
|
30
|
+
component: () => import('@views/exception/403/index.vue'),
|
|
31
|
+
meta: { title: '403', isHideTab: true }
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: '/:pathMatch(.*)*',
|
|
35
|
+
name: 'Exception404',
|
|
36
|
+
component: () => import('@views/exception/404/index.vue'),
|
|
37
|
+
meta: { title: '404', isHideTab: true }
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: '/500',
|
|
41
|
+
name: 'Exception500',
|
|
42
|
+
component: () => import('@views/exception/500/index.vue'),
|
|
43
|
+
meta: { title: '500', isHideTab: true }
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
path: '/outside',
|
|
47
|
+
component: () => import('@views/index/index.vue'),
|
|
48
|
+
name: 'Outside',
|
|
49
|
+
meta: { title: 'menus.outside.title' },
|
|
50
|
+
children: [
|
|
51
|
+
// iframe 内嵌页面
|
|
52
|
+
{
|
|
53
|
+
path: '/outside/iframe/:path',
|
|
54
|
+
name: 'Iframe',
|
|
55
|
+
component: () => import('@/views/outside/Iframe.vue'),
|
|
56
|
+
meta: { title: 'iframe' }
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fetchLogout } from '@/api/auth'
|
|
2
|
+
import { useUserStore } from '@/store/modules/user'
|
|
3
|
+
|
|
4
|
+
/** 执行退出流程,并始终清理本地认证状态。 */
|
|
5
|
+
export async function signOut(): Promise<void> {
|
|
6
|
+
const userStore = useUserStore()
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
await fetchLogout()
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.warn('[Auth] 退出处理失败,已继续清理本地会话', error)
|
|
12
|
+
} finally {
|
|
13
|
+
userStore.clearAuthState()
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pinia Store 配置模块
|
|
3
|
+
*
|
|
4
|
+
* 提供全局状态管理的初始化和配置
|
|
5
|
+
*
|
|
6
|
+
* ## 主要功能
|
|
7
|
+
*
|
|
8
|
+
* - Pinia Store 实例创建
|
|
9
|
+
* - 持久化插件配置(pinia-plugin-persistedstate)
|
|
10
|
+
* - 版本化存储键管理
|
|
11
|
+
* - 自动数据迁移(跨版本)
|
|
12
|
+
* - LocalStorage 序列化配置
|
|
13
|
+
* - Store 初始化函数
|
|
14
|
+
*
|
|
15
|
+
* ## 持久化策略
|
|
16
|
+
*
|
|
17
|
+
* - 使用 StorageKeyManager 生成版本化的存储键
|
|
18
|
+
* - 格式:sys-v{version}-{storeId}
|
|
19
|
+
* - 自动迁移旧版本数据到当前版本
|
|
20
|
+
* - 使用 localStorage 作为存储介质
|
|
21
|
+
*
|
|
22
|
+
* @module store/index
|
|
23
|
+
* @author Art Design Pro Team
|
|
24
|
+
*/
|
|
25
|
+
import type { App } from 'vue'
|
|
26
|
+
import { createPinia } from 'pinia'
|
|
27
|
+
import { createPersistedState } from 'pinia-plugin-persistedstate'
|
|
28
|
+
import { StorageKeyManager } from '@/utils/storage/storage-key-manager'
|
|
29
|
+
|
|
30
|
+
export const store = createPinia()
|
|
31
|
+
|
|
32
|
+
// 创建存储键管理器实例
|
|
33
|
+
const storageKeyManager = new StorageKeyManager()
|
|
34
|
+
|
|
35
|
+
// 配置持久化插件
|
|
36
|
+
store.use(
|
|
37
|
+
createPersistedState({
|
|
38
|
+
key: (storeId: string) => storageKeyManager.getStorageKey(storeId),
|
|
39
|
+
storage: localStorage,
|
|
40
|
+
serializer: {
|
|
41
|
+
serialize: JSON.stringify,
|
|
42
|
+
deserialize: JSON.parse
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 初始化 Store
|
|
49
|
+
*/
|
|
50
|
+
export function initStore(app: App<Element>): void {
|
|
51
|
+
app.use(store)
|
|
52
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 菜单状态管理模块
|
|
3
|
+
*
|
|
4
|
+
* 提供菜单数据和动态路由的状态管理
|
|
5
|
+
*
|
|
6
|
+
* ## 主要功能
|
|
7
|
+
*
|
|
8
|
+
* - 菜单列表存储和管理
|
|
9
|
+
* - 首页路径配置
|
|
10
|
+
* - 动态路由注册和移除
|
|
11
|
+
* - 路由移除函数管理
|
|
12
|
+
* - 菜单宽度配置
|
|
13
|
+
*
|
|
14
|
+
* ## 使用场景
|
|
15
|
+
*
|
|
16
|
+
* - 动态菜单加载和渲染
|
|
17
|
+
* - 路由权限控制
|
|
18
|
+
* - 首页路径动态设置
|
|
19
|
+
* - 登出时清理动态路由
|
|
20
|
+
*
|
|
21
|
+
* ## 工作流程
|
|
22
|
+
*
|
|
23
|
+
* 1. 获取菜单数据(前端/后端模式)
|
|
24
|
+
* 2. 设置菜单列表和首页路径
|
|
25
|
+
* 3. 注册动态路由并保存移除函数
|
|
26
|
+
* 4. 登出时调用移除函数清理路由
|
|
27
|
+
*
|
|
28
|
+
* @module store/modules/menu
|
|
29
|
+
* @author Art Design Pro Team
|
|
30
|
+
*/
|
|
31
|
+
import { defineStore } from 'pinia'
|
|
32
|
+
import { ref } from 'vue'
|
|
33
|
+
import { AppRouteRecord } from '@/types/router'
|
|
34
|
+
import { getFirstMenuPath } from '@/utils'
|
|
35
|
+
import { HOME_PAGE_PATH } from '@/router'
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 菜单状态管理
|
|
39
|
+
* 管理应用的菜单列表、首页路径、菜单宽度和动态路由移除函数
|
|
40
|
+
*/
|
|
41
|
+
export const useMenuStore = defineStore('menuStore', () => {
|
|
42
|
+
/** 首页路径 */
|
|
43
|
+
const homePath = ref(HOME_PAGE_PATH)
|
|
44
|
+
/** 菜单列表 */
|
|
45
|
+
const menuList = ref<AppRouteRecord[]>([])
|
|
46
|
+
/** 菜单宽度 */
|
|
47
|
+
const menuWidth = ref('')
|
|
48
|
+
/** 存储路由移除函数的数组 */
|
|
49
|
+
const removeRouteFns = ref<(() => void)[]>([])
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 设置菜单列表
|
|
53
|
+
* @param list 菜单路由记录数组
|
|
54
|
+
*/
|
|
55
|
+
const setMenuList = (list: AppRouteRecord[]) => {
|
|
56
|
+
menuList.value = list
|
|
57
|
+
setHomePath(HOME_PAGE_PATH || getFirstMenuPath(list))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 获取首页路径
|
|
62
|
+
* @returns 首页路径字符串
|
|
63
|
+
*/
|
|
64
|
+
const getHomePath = () => homePath.value
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 设置主页路径
|
|
68
|
+
* @param path 主页路径
|
|
69
|
+
*/
|
|
70
|
+
const setHomePath = (path: string) => {
|
|
71
|
+
homePath.value = path
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 添加路由移除函数
|
|
76
|
+
* @param fns 要添加的路由移除函数数组
|
|
77
|
+
*/
|
|
78
|
+
const addRemoveRouteFns = (fns: (() => void)[]) => {
|
|
79
|
+
removeRouteFns.value.push(...fns)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 移除所有动态路由
|
|
84
|
+
* 执行所有存储的路由移除函数并清空数组
|
|
85
|
+
*/
|
|
86
|
+
const removeAllDynamicRoutes = () => {
|
|
87
|
+
removeRouteFns.value.forEach((fn) => fn())
|
|
88
|
+
removeRouteFns.value = []
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 清空路由移除函数数组
|
|
93
|
+
*/
|
|
94
|
+
const clearRemoveRouteFns = () => {
|
|
95
|
+
removeRouteFns.value = []
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
menuList,
|
|
100
|
+
menuWidth,
|
|
101
|
+
removeRouteFns,
|
|
102
|
+
setMenuList,
|
|
103
|
+
getHomePath,
|
|
104
|
+
setHomePath,
|
|
105
|
+
addRemoveRouteFns,
|
|
106
|
+
removeAllDynamicRoutes,
|
|
107
|
+
clearRemoveRouteFns
|
|
108
|
+
}
|
|
109
|
+
})
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 系统设置状态管理模块
|
|
3
|
+
*
|
|
4
|
+
* 提供完整的系统设置状态管理
|
|
5
|
+
*
|
|
6
|
+
* ## 主要功能
|
|
7
|
+
*
|
|
8
|
+
* - 菜单布局配置(左侧、顶部、混合、双栏)
|
|
9
|
+
* - 主题管理(亮色、暗色、自动)
|
|
10
|
+
* - 菜单主题样式配置
|
|
11
|
+
* - 界面显示开关(面包屑、标签页、语言切换等)
|
|
12
|
+
* - 功能开关(手风琴模式、色弱模式、水印等)
|
|
13
|
+
* - 样式配置(边框、圆角、容器宽度、页面过渡)
|
|
14
|
+
* - 节日功能配置
|
|
15
|
+
* - Element Plus 主题色动态设置
|
|
16
|
+
*
|
|
17
|
+
* ## 使用场景
|
|
18
|
+
*
|
|
19
|
+
* - 设置面板配置管理
|
|
20
|
+
* - 主题切换和样式定制
|
|
21
|
+
* - 界面功能开关控制
|
|
22
|
+
* - 用户偏好设置持久化
|
|
23
|
+
*
|
|
24
|
+
* ## 持久化
|
|
25
|
+
*
|
|
26
|
+
* - 使用 localStorage 存储
|
|
27
|
+
* - 存储键:sys-v{version}-setting
|
|
28
|
+
* - 支持跨版本数据迁移
|
|
29
|
+
*
|
|
30
|
+
* @module store/modules/setting
|
|
31
|
+
* @author Art Design Pro Team
|
|
32
|
+
*/
|
|
33
|
+
import { defineStore } from 'pinia'
|
|
34
|
+
import { ref, computed } from 'vue'
|
|
35
|
+
import { MenuThemeType } from '@/types/store'
|
|
36
|
+
import AppConfig from '@/config'
|
|
37
|
+
import { SystemThemeEnum, MenuThemeEnum, MenuTypeEnum, ContainerWidthEnum } from '@/enums/appEnum'
|
|
38
|
+
import { setElementThemeColor } from '@/utils/ui'
|
|
39
|
+
import { useCeremony } from '@/hooks/core/useCeremony'
|
|
40
|
+
import { StorageConfig } from '@/utils'
|
|
41
|
+
import { SETTING_DEFAULT_CONFIG } from '@/config/setting'
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 系统设置状态管理
|
|
45
|
+
* 管理应用的菜单、主题、界面显示等各项设置
|
|
46
|
+
*/
|
|
47
|
+
export const useSettingStore = defineStore(
|
|
48
|
+
'settingStore',
|
|
49
|
+
() => {
|
|
50
|
+
// 菜单相关设置
|
|
51
|
+
/** 菜单类型 */
|
|
52
|
+
const menuType = ref(SETTING_DEFAULT_CONFIG.menuType)
|
|
53
|
+
/** 菜单展开宽度 */
|
|
54
|
+
const menuOpenWidth = ref(SETTING_DEFAULT_CONFIG.menuOpenWidth)
|
|
55
|
+
/** 菜单是否展开 */
|
|
56
|
+
const menuOpen = ref(SETTING_DEFAULT_CONFIG.menuOpen)
|
|
57
|
+
/** 双菜单是否显示文本 */
|
|
58
|
+
const dualMenuShowText = ref(SETTING_DEFAULT_CONFIG.dualMenuShowText)
|
|
59
|
+
|
|
60
|
+
// 主题相关设置
|
|
61
|
+
/** 系统主题类型 */
|
|
62
|
+
const systemThemeType = ref(SETTING_DEFAULT_CONFIG.systemThemeType)
|
|
63
|
+
/** 系统主题模式 */
|
|
64
|
+
const systemThemeMode = ref(SETTING_DEFAULT_CONFIG.systemThemeMode)
|
|
65
|
+
/** 菜单主题类型 */
|
|
66
|
+
const menuThemeType = ref(SETTING_DEFAULT_CONFIG.menuThemeType)
|
|
67
|
+
/** 系统主题颜色 */
|
|
68
|
+
const systemThemeColor = ref(SETTING_DEFAULT_CONFIG.systemThemeColor)
|
|
69
|
+
|
|
70
|
+
// 界面显示设置
|
|
71
|
+
/** 是否显示菜单按钮 */
|
|
72
|
+
const showMenuButton = ref(SETTING_DEFAULT_CONFIG.showMenuButton)
|
|
73
|
+
/** 是否显示快速入口 */
|
|
74
|
+
const showFastEnter = ref(SETTING_DEFAULT_CONFIG.showFastEnter)
|
|
75
|
+
/** 是否显示刷新按钮 */
|
|
76
|
+
const showRefreshButton = ref(SETTING_DEFAULT_CONFIG.showRefreshButton)
|
|
77
|
+
/** 是否显示面包屑 */
|
|
78
|
+
const showCrumbs = ref(SETTING_DEFAULT_CONFIG.showCrumbs)
|
|
79
|
+
/** 是否显示工作台标签 */
|
|
80
|
+
const showWorkTab = ref(SETTING_DEFAULT_CONFIG.showWorkTab)
|
|
81
|
+
/** 是否显示语言切换 */
|
|
82
|
+
const showLanguage = ref(SETTING_DEFAULT_CONFIG.showLanguage)
|
|
83
|
+
/** 是否显示进度条 */
|
|
84
|
+
const showNprogress = ref(SETTING_DEFAULT_CONFIG.showNprogress)
|
|
85
|
+
/** 是否显示设置引导 */
|
|
86
|
+
const showSettingGuide = ref(SETTING_DEFAULT_CONFIG.showSettingGuide)
|
|
87
|
+
/** 是否显示节日文本 */
|
|
88
|
+
const showFestivalText = ref(SETTING_DEFAULT_CONFIG.showFestivalText)
|
|
89
|
+
/** 是否显示水印 */
|
|
90
|
+
const watermarkVisible = ref(SETTING_DEFAULT_CONFIG.watermarkVisible)
|
|
91
|
+
|
|
92
|
+
// 功能设置
|
|
93
|
+
/** 是否自动关闭 */
|
|
94
|
+
const autoClose = ref(SETTING_DEFAULT_CONFIG.autoClose)
|
|
95
|
+
/** 是否唯一展开 */
|
|
96
|
+
const uniqueOpened = ref(SETTING_DEFAULT_CONFIG.uniqueOpened)
|
|
97
|
+
/** 是否色弱模式 */
|
|
98
|
+
const colorWeak = ref(SETTING_DEFAULT_CONFIG.colorWeak)
|
|
99
|
+
/** 是否刷新 */
|
|
100
|
+
const refresh = ref(SETTING_DEFAULT_CONFIG.refresh)
|
|
101
|
+
/** 是否加载节日烟花 */
|
|
102
|
+
const holidayFireworksLoaded = ref(SETTING_DEFAULT_CONFIG.holidayFireworksLoaded)
|
|
103
|
+
|
|
104
|
+
// 样式设置
|
|
105
|
+
/** 边框模式 */
|
|
106
|
+
const boxBorderMode = ref(SETTING_DEFAULT_CONFIG.boxBorderMode)
|
|
107
|
+
/** 页面过渡效果 */
|
|
108
|
+
const pageTransition = ref(SETTING_DEFAULT_CONFIG.pageTransition)
|
|
109
|
+
/** 标签页样式 */
|
|
110
|
+
const tabStyle = ref(SETTING_DEFAULT_CONFIG.tabStyle)
|
|
111
|
+
/** 自定义圆角 */
|
|
112
|
+
const customRadius = ref(SETTING_DEFAULT_CONFIG.customRadius)
|
|
113
|
+
/** 容器宽度 */
|
|
114
|
+
const containerWidth = ref(SETTING_DEFAULT_CONFIG.containerWidth)
|
|
115
|
+
|
|
116
|
+
// 节日相关
|
|
117
|
+
/** 节日日期 */
|
|
118
|
+
const festivalDate = ref('')
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 获取菜单主题
|
|
122
|
+
* 根据当前主题类型和暗色模式返回对应的主题配置
|
|
123
|
+
*/
|
|
124
|
+
const getMenuTheme = computed((): MenuThemeType => {
|
|
125
|
+
const list = AppConfig.themeList.filter((item) => item.theme === menuThemeType.value)
|
|
126
|
+
if (isDark.value) {
|
|
127
|
+
return AppConfig.darkMenuStyles[0]
|
|
128
|
+
} else {
|
|
129
|
+
return list[0]
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 判断是否为暗色模式
|
|
135
|
+
*/
|
|
136
|
+
const isDark = computed((): boolean => {
|
|
137
|
+
return systemThemeType.value === SystemThemeEnum.DARK
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 获取菜单展开宽度
|
|
142
|
+
*/
|
|
143
|
+
const getMenuOpenWidth = computed((): string => {
|
|
144
|
+
return menuOpenWidth.value + 'px' || SETTING_DEFAULT_CONFIG.menuOpenWidth + 'px'
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 获取自定义圆角
|
|
149
|
+
*/
|
|
150
|
+
const getCustomRadius = computed((): string => {
|
|
151
|
+
return customRadius.value + 'rem' || SETTING_DEFAULT_CONFIG.customRadius + 'rem'
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 是否显示烟花
|
|
156
|
+
* 根据当前日期和节日日期判断是否显示烟花效果
|
|
157
|
+
*/
|
|
158
|
+
const isShowFireworks = computed((): boolean => {
|
|
159
|
+
return festivalDate.value === useCeremony().currentFestivalData.value?.date ? false : true
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 切换菜单布局
|
|
164
|
+
* @param type 菜单类型
|
|
165
|
+
*/
|
|
166
|
+
const switchMenuLayouts = (type: MenuTypeEnum) => {
|
|
167
|
+
menuType.value = type
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 设置菜单展开宽度
|
|
172
|
+
* @param width 宽度值
|
|
173
|
+
*/
|
|
174
|
+
const setMenuOpenWidth = (width: number) => {
|
|
175
|
+
menuOpenWidth.value = width
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 设置全局主题
|
|
180
|
+
* @param theme 主题类型
|
|
181
|
+
* @param themeMode 主题模式
|
|
182
|
+
*/
|
|
183
|
+
const setGlopTheme = (theme: SystemThemeEnum, themeMode: SystemThemeEnum) => {
|
|
184
|
+
systemThemeType.value = theme
|
|
185
|
+
systemThemeMode.value = themeMode
|
|
186
|
+
localStorage.setItem(StorageConfig.THEME_KEY, theme)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 切换菜单样式
|
|
191
|
+
* @param theme 菜单主题
|
|
192
|
+
*/
|
|
193
|
+
const switchMenuStyles = (theme: MenuThemeEnum) => {
|
|
194
|
+
menuThemeType.value = theme
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* 设置Element Plus主题颜色
|
|
199
|
+
* @param theme 主题颜色
|
|
200
|
+
*/
|
|
201
|
+
const setElementTheme = (theme: string) => {
|
|
202
|
+
systemThemeColor.value = theme
|
|
203
|
+
setElementThemeColor(theme)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 切换边框模式
|
|
208
|
+
*/
|
|
209
|
+
const setBorderMode = () => {
|
|
210
|
+
boxBorderMode.value = !boxBorderMode.value
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 设置容器宽度
|
|
215
|
+
* @param width 容器宽度枚举值
|
|
216
|
+
*/
|
|
217
|
+
const setContainerWidth = (width: ContainerWidthEnum) => {
|
|
218
|
+
containerWidth.value = width
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* 切换唯一展开模式
|
|
223
|
+
*/
|
|
224
|
+
const setUniqueOpened = () => {
|
|
225
|
+
uniqueOpened.value = !uniqueOpened.value
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 切换菜单按钮显示
|
|
230
|
+
*/
|
|
231
|
+
const setButton = () => {
|
|
232
|
+
showMenuButton.value = !showMenuButton.value
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 切换快速入口显示
|
|
237
|
+
*/
|
|
238
|
+
const setFastEnter = () => {
|
|
239
|
+
showFastEnter.value = !showFastEnter.value
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 切换自动关闭
|
|
244
|
+
*/
|
|
245
|
+
const setAutoClose = () => {
|
|
246
|
+
autoClose.value = !autoClose.value
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* 切换刷新按钮显示
|
|
251
|
+
*/
|
|
252
|
+
const setShowRefreshButton = () => {
|
|
253
|
+
showRefreshButton.value = !showRefreshButton.value
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* 切换面包屑显示
|
|
258
|
+
*/
|
|
259
|
+
const setCrumbs = () => {
|
|
260
|
+
showCrumbs.value = !showCrumbs.value
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* 设置工作台标签显示
|
|
265
|
+
* @param show 是否显示
|
|
266
|
+
*/
|
|
267
|
+
const setWorkTab = (show: boolean) => {
|
|
268
|
+
showWorkTab.value = show
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* 切换语言切换显示
|
|
273
|
+
*/
|
|
274
|
+
const setLanguage = () => {
|
|
275
|
+
showLanguage.value = !showLanguage.value
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* 切换进度条显示
|
|
280
|
+
*/
|
|
281
|
+
const setNprogress = () => {
|
|
282
|
+
showNprogress.value = !showNprogress.value
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* 切换色弱模式
|
|
287
|
+
*/
|
|
288
|
+
const setColorWeak = () => {
|
|
289
|
+
colorWeak.value = !colorWeak.value
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* 隐藏设置引导
|
|
294
|
+
*/
|
|
295
|
+
const hideSettingGuide = () => {
|
|
296
|
+
showSettingGuide.value = false
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* 显示设置引导
|
|
301
|
+
*/
|
|
302
|
+
const openSettingGuide = () => {
|
|
303
|
+
showSettingGuide.value = true
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* 设置页面过渡效果
|
|
308
|
+
* @param transition 过渡效果名称
|
|
309
|
+
*/
|
|
310
|
+
const setPageTransition = (transition: string) => {
|
|
311
|
+
pageTransition.value = transition
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* 设置标签页样式
|
|
316
|
+
* @param style 样式名称
|
|
317
|
+
*/
|
|
318
|
+
const setTabStyle = (style: string) => {
|
|
319
|
+
tabStyle.value = style
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* 设置菜单展开状态
|
|
324
|
+
* @param open 是否展开
|
|
325
|
+
*/
|
|
326
|
+
const setMenuOpen = (open: boolean) => {
|
|
327
|
+
menuOpen.value = open
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* 刷新页面
|
|
332
|
+
*/
|
|
333
|
+
const reload = () => {
|
|
334
|
+
refresh.value = !refresh.value
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* 设置水印显示
|
|
339
|
+
* @param visible 是否显示
|
|
340
|
+
*/
|
|
341
|
+
const setWatermarkVisible = (visible: boolean) => {
|
|
342
|
+
watermarkVisible.value = visible
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* 设置自定义圆角
|
|
347
|
+
* @param radius 圆角值
|
|
348
|
+
*/
|
|
349
|
+
const setCustomRadius = (radius: string) => {
|
|
350
|
+
customRadius.value = radius
|
|
351
|
+
document.documentElement.style.setProperty('--custom-radius', `${radius}rem`)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* 设置节日烟花加载状态
|
|
356
|
+
* @param isLoad 是否已加载
|
|
357
|
+
*/
|
|
358
|
+
const setholidayFireworksLoaded = (isLoad: boolean) => {
|
|
359
|
+
holidayFireworksLoaded.value = isLoad
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* 设置节日文本显示
|
|
364
|
+
* @param show 是否显示
|
|
365
|
+
*/
|
|
366
|
+
const setShowFestivalText = (show: boolean) => {
|
|
367
|
+
showFestivalText.value = show
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const setFestivalDate = (date: string) => {
|
|
371
|
+
festivalDate.value = date
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const setDualMenuShowText = (show: boolean) => {
|
|
375
|
+
dualMenuShowText.value = show
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return {
|
|
379
|
+
menuType,
|
|
380
|
+
menuOpenWidth,
|
|
381
|
+
systemThemeType,
|
|
382
|
+
systemThemeMode,
|
|
383
|
+
menuThemeType,
|
|
384
|
+
systemThemeColor,
|
|
385
|
+
boxBorderMode,
|
|
386
|
+
uniqueOpened,
|
|
387
|
+
showMenuButton,
|
|
388
|
+
showFastEnter,
|
|
389
|
+
showRefreshButton,
|
|
390
|
+
showCrumbs,
|
|
391
|
+
autoClose,
|
|
392
|
+
showWorkTab,
|
|
393
|
+
showLanguage,
|
|
394
|
+
showNprogress,
|
|
395
|
+
colorWeak,
|
|
396
|
+
showSettingGuide,
|
|
397
|
+
pageTransition,
|
|
398
|
+
tabStyle,
|
|
399
|
+
menuOpen,
|
|
400
|
+
refresh,
|
|
401
|
+
watermarkVisible,
|
|
402
|
+
customRadius,
|
|
403
|
+
holidayFireworksLoaded,
|
|
404
|
+
showFestivalText,
|
|
405
|
+
festivalDate,
|
|
406
|
+
dualMenuShowText,
|
|
407
|
+
containerWidth,
|
|
408
|
+
getMenuTheme,
|
|
409
|
+
isDark,
|
|
410
|
+
getMenuOpenWidth,
|
|
411
|
+
getCustomRadius,
|
|
412
|
+
isShowFireworks,
|
|
413
|
+
switchMenuLayouts,
|
|
414
|
+
setMenuOpenWidth,
|
|
415
|
+
setGlopTheme,
|
|
416
|
+
switchMenuStyles,
|
|
417
|
+
setElementTheme,
|
|
418
|
+
setBorderMode,
|
|
419
|
+
setContainerWidth,
|
|
420
|
+
setUniqueOpened,
|
|
421
|
+
setButton,
|
|
422
|
+
setFastEnter,
|
|
423
|
+
setAutoClose,
|
|
424
|
+
setShowRefreshButton,
|
|
425
|
+
setCrumbs,
|
|
426
|
+
setWorkTab,
|
|
427
|
+
setLanguage,
|
|
428
|
+
setNprogress,
|
|
429
|
+
setColorWeak,
|
|
430
|
+
hideSettingGuide,
|
|
431
|
+
openSettingGuide,
|
|
432
|
+
setPageTransition,
|
|
433
|
+
setTabStyle,
|
|
434
|
+
setMenuOpen,
|
|
435
|
+
reload,
|
|
436
|
+
setWatermarkVisible,
|
|
437
|
+
setCustomRadius,
|
|
438
|
+
setholidayFireworksLoaded,
|
|
439
|
+
setShowFestivalText,
|
|
440
|
+
setFestivalDate,
|
|
441
|
+
setDualMenuShowText
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
persist: {
|
|
446
|
+
key: 'setting',
|
|
447
|
+
storage: localStorage
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
)
|