@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,258 @@
|
|
|
1
|
+
@use '@styles/core/mixin.scss' as *;
|
|
2
|
+
|
|
3
|
+
// 菜单样式变量
|
|
4
|
+
$menu-height: 42px;
|
|
5
|
+
$menu-icon-size: 20px;
|
|
6
|
+
$menu-font-size: 14px;
|
|
7
|
+
$hover-bg-color: var(--art-gray-200);
|
|
8
|
+
$popup-menu-height: 40px;
|
|
9
|
+
$popup-menu-padding: 8px;
|
|
10
|
+
$popup-menu-margin: 5px;
|
|
11
|
+
$popup-menu-radius: 6px;
|
|
12
|
+
|
|
13
|
+
// 通用菜单项样式
|
|
14
|
+
@mixin menu-item-base {
|
|
15
|
+
width: calc(100% - 16px);
|
|
16
|
+
margin-left: 8px;
|
|
17
|
+
border-radius: 6px;
|
|
18
|
+
|
|
19
|
+
.menu-icon {
|
|
20
|
+
margin-left: -7px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 通用 hover 样式
|
|
25
|
+
@mixin menu-hover($bg-color) {
|
|
26
|
+
.el-sub-menu__title:hover,
|
|
27
|
+
.el-menu-item:not(.is-active):hover {
|
|
28
|
+
background: $bg-color !important;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 通用选中样式
|
|
33
|
+
@mixin menu-active($color, $bg-color, $icon-color: var(--theme-color)) {
|
|
34
|
+
.el-menu-item.is-active {
|
|
35
|
+
color: $color !important;
|
|
36
|
+
background-color: $bg-color;
|
|
37
|
+
|
|
38
|
+
.menu-icon {
|
|
39
|
+
.art-svg-icon {
|
|
40
|
+
color: $icon-color !important;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 弹窗菜单项样式
|
|
47
|
+
@mixin popup-menu-item {
|
|
48
|
+
height: $popup-menu-height;
|
|
49
|
+
margin-bottom: $popup-menu-margin;
|
|
50
|
+
border-radius: $popup-menu-radius;
|
|
51
|
+
|
|
52
|
+
.menu-icon {
|
|
53
|
+
margin-right: 5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:last-of-type {
|
|
57
|
+
margin-bottom: 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 主题菜单通用样式(合并 design 和 dark 主题的共同逻辑)
|
|
62
|
+
@mixin theme-menu-base {
|
|
63
|
+
.el-sub-menu__title,
|
|
64
|
+
.el-menu-item {
|
|
65
|
+
@include menu-item-base;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 弹窗菜单通用样式
|
|
70
|
+
@mixin popup-menu-base($hover-bg, $active-color, $active-bg) {
|
|
71
|
+
.el-menu--popup {
|
|
72
|
+
padding: $popup-menu-padding;
|
|
73
|
+
|
|
74
|
+
.el-sub-menu__title:hover,
|
|
75
|
+
.el-menu-item:hover {
|
|
76
|
+
background-color: $hover-bg !important;
|
|
77
|
+
border-radius: $popup-menu-radius;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.el-menu-item {
|
|
81
|
+
@include popup-menu-item;
|
|
82
|
+
|
|
83
|
+
&.is-active {
|
|
84
|
+
color: $active-color !important;
|
|
85
|
+
background-color: $active-bg !important;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.el-sub-menu {
|
|
90
|
+
@include popup-menu-item;
|
|
91
|
+
|
|
92
|
+
height: $popup-menu-height !important;
|
|
93
|
+
|
|
94
|
+
.el-sub-menu__title {
|
|
95
|
+
height: $popup-menu-height !important;
|
|
96
|
+
border-radius: $popup-menu-radius;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.layout-sidebar {
|
|
103
|
+
// ---------------------- Modify default style ----------------------
|
|
104
|
+
|
|
105
|
+
// 菜单折叠样式
|
|
106
|
+
.menu-left-close {
|
|
107
|
+
.header {
|
|
108
|
+
.logo {
|
|
109
|
+
margin: 0 auto;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 菜单图标
|
|
115
|
+
.menu-icon {
|
|
116
|
+
margin-right: 8px;
|
|
117
|
+
font-size: $menu-icon-size;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 菜单高度
|
|
121
|
+
.el-sub-menu__title,
|
|
122
|
+
.el-menu-item {
|
|
123
|
+
height: $menu-height !important;
|
|
124
|
+
margin-bottom: 4px;
|
|
125
|
+
line-height: $menu-height !important;
|
|
126
|
+
|
|
127
|
+
span {
|
|
128
|
+
font-size: $menu-font-size !important;
|
|
129
|
+
|
|
130
|
+
@include ellipsis();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 右侧箭头
|
|
135
|
+
.el-sub-menu__icon-arrow {
|
|
136
|
+
width: 13px !important;
|
|
137
|
+
font-size: 13px !important;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 菜单折叠
|
|
141
|
+
.el-menu--collapse {
|
|
142
|
+
.el-sub-menu.is-active {
|
|
143
|
+
.el-sub-menu__title {
|
|
144
|
+
.menu-icon {
|
|
145
|
+
.art-svg-icon {
|
|
146
|
+
// 选中菜单图标颜色
|
|
147
|
+
color: var(--theme-color) !important;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ---------------------- Design theme menu ----------------------
|
|
155
|
+
.el-menu-design {
|
|
156
|
+
@include theme-menu-base;
|
|
157
|
+
@include menu-active(var(--theme-color), var(--el-color-primary-light-9));
|
|
158
|
+
@include menu-hover($hover-bg-color);
|
|
159
|
+
|
|
160
|
+
.el-sub-menu__icon-arrow {
|
|
161
|
+
color: var(--art-gray-600);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ---------------------- Dark theme menu ----------------------
|
|
166
|
+
.el-menu-dark {
|
|
167
|
+
@include theme-menu-base;
|
|
168
|
+
@include menu-active(#fff, #27282d, #fff);
|
|
169
|
+
@include menu-hover(#0f1015);
|
|
170
|
+
|
|
171
|
+
.el-sub-menu__icon-arrow {
|
|
172
|
+
color: var(--art-gray-400);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ---------------------- Light theme menu ----------------------
|
|
177
|
+
.el-menu-light {
|
|
178
|
+
.el-sub-menu__title,
|
|
179
|
+
.el-menu-item {
|
|
180
|
+
.menu-icon {
|
|
181
|
+
margin-left: 1px;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.el-menu-item.is-active {
|
|
186
|
+
background-color: var(--el-color-primary-light-9);
|
|
187
|
+
|
|
188
|
+
.art-svg-icon {
|
|
189
|
+
color: var(--theme-color) !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&::before {
|
|
193
|
+
position: absolute;
|
|
194
|
+
top: 0;
|
|
195
|
+
left: 0;
|
|
196
|
+
width: 4px;
|
|
197
|
+
height: 100%;
|
|
198
|
+
content: '';
|
|
199
|
+
background: var(--theme-color);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@include menu-hover($hover-bg-color);
|
|
204
|
+
|
|
205
|
+
.el-sub-menu__icon-arrow {
|
|
206
|
+
color: var(--art-gray-600);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@media only screen and (width <= 640px) {
|
|
212
|
+
.layout-sidebar {
|
|
213
|
+
.el-menu-design {
|
|
214
|
+
> .el-sub-menu {
|
|
215
|
+
margin-left: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.el-sub-menu {
|
|
219
|
+
width: 100% !important;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// 菜单折叠 hover 弹窗样式(浅色主题)
|
|
226
|
+
.el-menu--vertical,
|
|
227
|
+
.el-menu--popup-container {
|
|
228
|
+
@include popup-menu-base(var(--art-gray-200), var(--art-gray-900), var(--art-gray-200));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 暗黑模式菜单样式
|
|
232
|
+
.dark {
|
|
233
|
+
.el-menu--vertical,
|
|
234
|
+
.el-menu--popup-container {
|
|
235
|
+
@include popup-menu-base(var(--art-gray-200), var(--art-gray-900), #292a2e);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.layout-sidebar {
|
|
239
|
+
// 图标颜色、文字颜色
|
|
240
|
+
.menu-icon .art-svg-icon,
|
|
241
|
+
.menu-name {
|
|
242
|
+
color: var(--art-gray-800) !important;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 选中的文字颜色跟图标颜色
|
|
246
|
+
.el-menu-item.is-active {
|
|
247
|
+
span,
|
|
248
|
+
.menu-icon .art-svg-icon {
|
|
249
|
+
color: var(--theme-color) !important;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// 右侧箭头颜色
|
|
254
|
+
.el-sub-menu__icon-arrow {
|
|
255
|
+
color: #fff;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
package/template/src/components/core/layouts/art-menus/art-sidebar-menu/widget/SidebarSubmenu.vue
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-for="(item, index) in filteredMenuItems" :key="getUniqueKey(item, index)">
|
|
3
|
+
<ElSubMenu v-if="hasChildren(item)" :index="item.path || item.meta.title" :level="level">
|
|
4
|
+
<template #title>
|
|
5
|
+
<div class="menu-icon flex-cc">
|
|
6
|
+
<ArtSvgIcon
|
|
7
|
+
:icon="item.meta.icon"
|
|
8
|
+
:color="theme?.iconColor"
|
|
9
|
+
:style="{ color: theme.iconColor }"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
<span class="menu-name">
|
|
13
|
+
{{ formatMenuTitle(item.meta.title) }}
|
|
14
|
+
</span>
|
|
15
|
+
<div v-if="item.meta.showBadge" class="art-badge" style="right: 10px" />
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<SidebarSubmenu
|
|
19
|
+
:list="item.children"
|
|
20
|
+
:is-mobile="isMobile"
|
|
21
|
+
:level="level + 1"
|
|
22
|
+
:theme="theme"
|
|
23
|
+
@close="closeMenu"
|
|
24
|
+
/>
|
|
25
|
+
</ElSubMenu>
|
|
26
|
+
|
|
27
|
+
<ElMenuItem
|
|
28
|
+
v-else
|
|
29
|
+
:index="item.path || item.meta.title"
|
|
30
|
+
:level-item="level + 1"
|
|
31
|
+
@click="goPage(item)"
|
|
32
|
+
>
|
|
33
|
+
<div class="menu-icon flex-cc">
|
|
34
|
+
<ArtSvgIcon
|
|
35
|
+
:icon="item.meta.icon"
|
|
36
|
+
:color="theme?.iconColor"
|
|
37
|
+
:style="{ color: theme.iconColor }"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
<div
|
|
41
|
+
v-show="item.meta.showBadge && level === 0 && !menuOpen"
|
|
42
|
+
class="art-badge"
|
|
43
|
+
style="right: 5px"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<template #title>
|
|
47
|
+
<span class="menu-name">
|
|
48
|
+
{{ formatMenuTitle(item.meta.title) }}
|
|
49
|
+
</span>
|
|
50
|
+
<div v-if="item.meta.showBadge" class="art-badge" />
|
|
51
|
+
<div v-if="item.meta.showTextBadge && (level > 0 || menuOpen)" class="art-text-badge">
|
|
52
|
+
{{ item.meta.showTextBadge }}
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
</ElMenuItem>
|
|
56
|
+
</template>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { computed } from 'vue'
|
|
61
|
+
import type { AppRouteRecord } from '@/types/router'
|
|
62
|
+
import { formatMenuTitle } from '@/utils/router'
|
|
63
|
+
import { handleMenuJump } from '@/utils/navigation'
|
|
64
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
65
|
+
|
|
66
|
+
interface MenuTheme {
|
|
67
|
+
iconColor?: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface Props {
|
|
71
|
+
/** 菜单标题 */
|
|
72
|
+
title?: string
|
|
73
|
+
/** 菜单列表 */
|
|
74
|
+
list?: AppRouteRecord[]
|
|
75
|
+
/** 主题配置 */
|
|
76
|
+
theme?: MenuTheme
|
|
77
|
+
/** 是否为移动端模式 */
|
|
78
|
+
isMobile?: boolean
|
|
79
|
+
/** 菜单层级 */
|
|
80
|
+
level?: number
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface Emits {
|
|
84
|
+
/** 关闭菜单事件 */
|
|
85
|
+
(e: 'close'): void
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
89
|
+
title: '',
|
|
90
|
+
list: () => [],
|
|
91
|
+
theme: () => ({}),
|
|
92
|
+
isMobile: false,
|
|
93
|
+
level: 0
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const emit = defineEmits<Emits>()
|
|
97
|
+
|
|
98
|
+
const settingStore = useSettingStore()
|
|
99
|
+
|
|
100
|
+
const { menuOpen } = storeToRefs(settingStore)
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 过滤后的菜单项列表
|
|
104
|
+
* 只显示未隐藏的菜单项
|
|
105
|
+
*/
|
|
106
|
+
const filteredMenuItems = computed(() => filterRoutes(props.list))
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 跳转到指定页面
|
|
110
|
+
* @param item 菜单项数据
|
|
111
|
+
*/
|
|
112
|
+
const goPage = (item: AppRouteRecord): void => {
|
|
113
|
+
closeMenu()
|
|
114
|
+
handleMenuJump(item)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 关闭菜单
|
|
119
|
+
* 触发父组件的关闭事件
|
|
120
|
+
*/
|
|
121
|
+
const closeMenu = (): void => {
|
|
122
|
+
emit('close')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 判断菜单项本身是否可以作为可点击页面保留在菜单中
|
|
127
|
+
*/
|
|
128
|
+
const isNavigableRoute = (item: AppRouteRecord): boolean => {
|
|
129
|
+
return !!(
|
|
130
|
+
!item.meta.isHide &&
|
|
131
|
+
((item.path && item.path.trim()) || item.meta.link || item.meta.isIframe === true) &&
|
|
132
|
+
(item.component || item.meta.link || item.meta.isIframe === true)
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 递归过滤菜单路由,移除隐藏的菜单项
|
|
138
|
+
* 但如果父菜单本身就是可访问页面,则即使子菜单都被隐藏也应该保留
|
|
139
|
+
* @param items 菜单项数组
|
|
140
|
+
* @returns 过滤后的菜单项数组
|
|
141
|
+
*/
|
|
142
|
+
const filterRoutes = (items: AppRouteRecord[]): AppRouteRecord[] => {
|
|
143
|
+
return items
|
|
144
|
+
.filter((item) => {
|
|
145
|
+
// 如果当前项被隐藏,直接过滤掉
|
|
146
|
+
if (item.meta.isHide) {
|
|
147
|
+
return false
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 如果有子菜单,递归过滤子菜单
|
|
151
|
+
if (item.children && item.children.length > 0) {
|
|
152
|
+
const filteredChildren = filterRoutes(item.children)
|
|
153
|
+
// 目录菜单要求有可见子菜单;页面菜单则允许仅保留自身
|
|
154
|
+
return filteredChildren.length > 0 || isNavigableRoute(item)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 叶子节点且未被隐藏,保留
|
|
158
|
+
return isNavigableRoute(item)
|
|
159
|
+
})
|
|
160
|
+
.map((item) => ({
|
|
161
|
+
...item,
|
|
162
|
+
children: item.children ? filterRoutes(item.children) : undefined
|
|
163
|
+
}))
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 判断菜单项是否包含可见的子菜单
|
|
168
|
+
* @param item 菜单项数据
|
|
169
|
+
* @returns 是否包含可见的子菜单
|
|
170
|
+
*/
|
|
171
|
+
const hasChildren = (item: AppRouteRecord): boolean => {
|
|
172
|
+
if (!item.children || item.children.length === 0) {
|
|
173
|
+
return false
|
|
174
|
+
}
|
|
175
|
+
// 递归检查是否有可见的子菜单
|
|
176
|
+
const filteredChildren = filterRoutes(item.children)
|
|
177
|
+
return filteredChildren.length > 0
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 生成唯一的 key
|
|
182
|
+
* 使用 path、title 和 index 组合确保唯一性
|
|
183
|
+
* @param item 菜单项数据
|
|
184
|
+
* @param index 索引
|
|
185
|
+
* @returns 唯一的 key
|
|
186
|
+
*/
|
|
187
|
+
const getUniqueKey = (item: AppRouteRecord, index: number): string => {
|
|
188
|
+
return `${item.path || item.meta.title || 'menu'}-${props.level}-${index}`
|
|
189
|
+
}
|
|
190
|
+
</script>
|