@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,485 @@
|
|
|
1
|
+
<!-- 顶部栏 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
class="w-full bg-[var(--default-bg-color)]"
|
|
5
|
+
:class="[
|
|
6
|
+
tabStyle === 'tab-card' || tabStyle === 'tab-google' ? 'mb-5 max-sm:mb-3 !bg-box' : ''
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
class="relative box-border flex-b h-15 leading-15 select-none"
|
|
11
|
+
:class="[
|
|
12
|
+
tabStyle === 'tab-card' || tabStyle === 'tab-google'
|
|
13
|
+
? 'border-b border-[var(--art-card-border)]'
|
|
14
|
+
: ''
|
|
15
|
+
]"
|
|
16
|
+
>
|
|
17
|
+
<div class="flex-c flex-1 min-w-0 leading-15" style="display: flex">
|
|
18
|
+
<!-- 系统信息 -->
|
|
19
|
+
<div class="flex-c c-p" @click="toHome" v-if="isTopMenu">
|
|
20
|
+
<ArtLogo class="pl-4.5" />
|
|
21
|
+
<p v-if="width >= 1400" class="my-0 mx-2 ml-2 text-lg">{{ AppConfig.systemInfo.name }}</p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<ArtLogo
|
|
25
|
+
class="!hidden pl-3.5 overflow-hidden align-[-0.15em] fill-current"
|
|
26
|
+
@click="toHome"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<!-- 菜单按钮 -->
|
|
30
|
+
<ArtIconButton
|
|
31
|
+
v-if="isLeftMenu && shouldShowMenuButton"
|
|
32
|
+
icon="ri:menu-2-fill"
|
|
33
|
+
class="ml-3 max-sm:ml-[7px]"
|
|
34
|
+
@click="visibleMenu"
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<!-- 刷新按钮 -->
|
|
38
|
+
<ArtIconButton
|
|
39
|
+
v-if="shouldShowRefreshButton"
|
|
40
|
+
icon="ri:refresh-line"
|
|
41
|
+
class="!ml-3 refresh-btn max-sm:!hidden"
|
|
42
|
+
:style="{ marginLeft: !isLeftMenu ? '10px' : '0' }"
|
|
43
|
+
@click="reload"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<!-- 快速入口 -->
|
|
47
|
+
<ArtFastEnter v-if="shouldShowFastEnter && width >= headerBarFastEnterMinWidth">
|
|
48
|
+
<ArtIconButton icon="ri:function-line" class="ml-3" />
|
|
49
|
+
</ArtFastEnter>
|
|
50
|
+
|
|
51
|
+
<!-- 面包屑 -->
|
|
52
|
+
<ArtBreadcrumb
|
|
53
|
+
v-if="(shouldShowBreadcrumb && isLeftMenu) || (shouldShowBreadcrumb && isDualMenu)"
|
|
54
|
+
/>
|
|
55
|
+
|
|
56
|
+
<!-- 顶部菜单 -->
|
|
57
|
+
<ArtHorizontalMenu v-if="isTopMenu" :list="menuList" />
|
|
58
|
+
|
|
59
|
+
<!-- 混合菜单-顶部 -->
|
|
60
|
+
<ArtMixedMenu v-if="isTopLeftMenu" :list="menuList" />
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div class="flex-c gap-2.5">
|
|
64
|
+
<!-- 搜索 -->
|
|
65
|
+
<div
|
|
66
|
+
v-if="shouldShowGlobalSearch"
|
|
67
|
+
class="flex-cb w-40 h-9 px-2.5 c-p border border-g-400 rounded-custom-sm max-md:!hidden"
|
|
68
|
+
@click="openSearchDialog"
|
|
69
|
+
>
|
|
70
|
+
<div class="flex-c">
|
|
71
|
+
<ArtSvgIcon icon="ri:search-line" class="text-sm text-g-500" />
|
|
72
|
+
<span class="ml-1 text-xs font-normal text-g-500">{{ $t('topBar.search.title') }}</span>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="flex-c h-5 px-1.5 text-g-500/80 border border-g-400 rounded">
|
|
75
|
+
<ArtSvgIcon v-if="isWindows" icon="vaadin:ctrl-a" class="text-sm" />
|
|
76
|
+
<ArtSvgIcon v-else icon="ri:command-fill" class="text-xs" />
|
|
77
|
+
<span class="ml-0.5 text-xs">k</span>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<!-- 全屏按钮 -->
|
|
82
|
+
<ArtIconButton
|
|
83
|
+
v-if="shouldShowFullscreen"
|
|
84
|
+
:icon="isFullscreen ? 'ri:fullscreen-exit-line' : 'ri:fullscreen-fill'"
|
|
85
|
+
:class="[!isFullscreen ? 'full-screen-btn' : 'exit-full-screen-btn', 'ml-3']"
|
|
86
|
+
class="max-md:!hidden"
|
|
87
|
+
@click="toggleFullScreen"
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<!-- 国际化按钮 -->
|
|
91
|
+
<ElDropdown
|
|
92
|
+
@command="changeLanguage"
|
|
93
|
+
popper-class="langDropDownStyle"
|
|
94
|
+
v-if="shouldShowLanguage"
|
|
95
|
+
>
|
|
96
|
+
<ArtIconButton icon="ri:translate-2" class="language-btn text-[19px]" />
|
|
97
|
+
<template #dropdown>
|
|
98
|
+
<ElDropdownMenu>
|
|
99
|
+
<div v-for="item in languageOptions" :key="item.value" class="lang-btn-item">
|
|
100
|
+
<ElDropdownItem
|
|
101
|
+
:command="item.value"
|
|
102
|
+
:class="{ 'is-selected': locale === item.value }"
|
|
103
|
+
>
|
|
104
|
+
<span class="menu-txt">{{ item.label }}</span>
|
|
105
|
+
<ArtSvgIcon icon="ri:check-fill" v-if="locale === item.value" />
|
|
106
|
+
</ElDropdownItem>
|
|
107
|
+
</div>
|
|
108
|
+
</ElDropdownMenu>
|
|
109
|
+
</template>
|
|
110
|
+
</ElDropdown>
|
|
111
|
+
|
|
112
|
+
<!-- 通知按钮 -->
|
|
113
|
+
<ArtIconButton
|
|
114
|
+
v-if="shouldShowNotification"
|
|
115
|
+
icon="ri:notification-2-line"
|
|
116
|
+
class="notice-button relative"
|
|
117
|
+
@click="visibleNotice"
|
|
118
|
+
>
|
|
119
|
+
<div class="absolute top-2 right-2 size-1.5 !bg-danger rounded-full"></div>
|
|
120
|
+
</ArtIconButton>
|
|
121
|
+
|
|
122
|
+
<!-- 聊天按钮 -->
|
|
123
|
+
<ArtIconButton
|
|
124
|
+
v-if="shouldShowChat"
|
|
125
|
+
icon="ri:message-3-line"
|
|
126
|
+
class="chat-button relative"
|
|
127
|
+
@click="openChat"
|
|
128
|
+
>
|
|
129
|
+
<div class="breathing-dot absolute top-2 right-2 size-1.5 !bg-success rounded-full"></div>
|
|
130
|
+
</ArtIconButton>
|
|
131
|
+
|
|
132
|
+
<!-- 设置按钮 -->
|
|
133
|
+
<div v-if="shouldShowSettings">
|
|
134
|
+
<ElPopover :visible="showSettingGuide" placement="bottom-start" :width="190" :offset="0">
|
|
135
|
+
<template #reference>
|
|
136
|
+
<div class="flex-cc">
|
|
137
|
+
<ArtIconButton icon="ri:settings-line" class="setting-btn" @click="openSetting" />
|
|
138
|
+
</div>
|
|
139
|
+
</template>
|
|
140
|
+
<template #default>
|
|
141
|
+
<p
|
|
142
|
+
>{{ $t('topBar.guide.title')
|
|
143
|
+
}}<span :style="{ color: systemThemeColor }"> {{ $t('topBar.guide.theme') }} </span
|
|
144
|
+
>、 <span :style="{ color: systemThemeColor }"> {{ $t('topBar.guide.menu') }} </span
|
|
145
|
+
>{{ $t('topBar.guide.description') }}
|
|
146
|
+
</p>
|
|
147
|
+
</template>
|
|
148
|
+
</ElPopover>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<!-- 主题切换按钮 -->
|
|
152
|
+
<ArtIconButton
|
|
153
|
+
v-if="shouldShowThemeToggle"
|
|
154
|
+
@click="themeAnimation"
|
|
155
|
+
:icon="isDark ? 'ri:sun-fill' : 'ri:moon-line'"
|
|
156
|
+
/>
|
|
157
|
+
|
|
158
|
+
<!-- 用户头像、菜单 -->
|
|
159
|
+
<ArtUserMenu />
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<!-- 标签页 -->
|
|
164
|
+
<ArtWorkTab v-if="AppConfig.features.workTabs" />
|
|
165
|
+
|
|
166
|
+
<!-- 通知 -->
|
|
167
|
+
<ArtNotification v-model:value="showNotice" ref="notice" />
|
|
168
|
+
</div>
|
|
169
|
+
</template>
|
|
170
|
+
|
|
171
|
+
<script setup lang="ts">
|
|
172
|
+
import { useI18n } from 'vue-i18n'
|
|
173
|
+
import { useRouter } from 'vue-router'
|
|
174
|
+
import { useFullscreen, useWindowSize } from '@vueuse/core'
|
|
175
|
+
import { LanguageEnum, MenuTypeEnum } from '@/enums/appEnum'
|
|
176
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
177
|
+
import { useUserStore } from '@/store/modules/user'
|
|
178
|
+
import { useMenuStore } from '@/store/modules/menu'
|
|
179
|
+
import AppConfig from '@/config'
|
|
180
|
+
import { languageOptions } from '@/locales'
|
|
181
|
+
import { mittBus } from '@/utils/sys'
|
|
182
|
+
import { themeAnimation } from '@/utils/ui/animation'
|
|
183
|
+
import { useCommon } from '@/hooks/core/useCommon'
|
|
184
|
+
import { useHeaderBar } from '@/hooks/core/useHeaderBar'
|
|
185
|
+
import ArtUserMenu from './widget/ArtUserMenu.vue'
|
|
186
|
+
|
|
187
|
+
defineOptions({ name: 'ArtHeaderBar' })
|
|
188
|
+
|
|
189
|
+
// 检测操作系统类型
|
|
190
|
+
const isWindows = navigator.userAgent.includes('Windows')
|
|
191
|
+
|
|
192
|
+
const router = useRouter()
|
|
193
|
+
const { locale } = useI18n()
|
|
194
|
+
const { width } = useWindowSize()
|
|
195
|
+
|
|
196
|
+
const settingStore = useSettingStore()
|
|
197
|
+
const userStore = useUserStore()
|
|
198
|
+
const menuStore = useMenuStore()
|
|
199
|
+
|
|
200
|
+
// 顶部栏功能配置
|
|
201
|
+
const {
|
|
202
|
+
shouldShowMenuButton,
|
|
203
|
+
shouldShowRefreshButton,
|
|
204
|
+
shouldShowFastEnter,
|
|
205
|
+
shouldShowBreadcrumb,
|
|
206
|
+
shouldShowGlobalSearch,
|
|
207
|
+
shouldShowFullscreen,
|
|
208
|
+
shouldShowNotification,
|
|
209
|
+
shouldShowChat,
|
|
210
|
+
shouldShowLanguage,
|
|
211
|
+
shouldShowSettings,
|
|
212
|
+
shouldShowThemeToggle,
|
|
213
|
+
fastEnterMinWidth: headerBarFastEnterMinWidth
|
|
214
|
+
} = useHeaderBar()
|
|
215
|
+
|
|
216
|
+
const { menuOpen, systemThemeColor, showSettingGuide, menuType, isDark, tabStyle } =
|
|
217
|
+
storeToRefs(settingStore)
|
|
218
|
+
|
|
219
|
+
const { language } = storeToRefs(userStore)
|
|
220
|
+
const { menuList } = storeToRefs(menuStore)
|
|
221
|
+
|
|
222
|
+
const showNotice = ref(false)
|
|
223
|
+
const notice = ref(null)
|
|
224
|
+
|
|
225
|
+
// 菜单类型判断
|
|
226
|
+
const isLeftMenu = computed(() => menuType.value === MenuTypeEnum.LEFT)
|
|
227
|
+
const isDualMenu = computed(() => menuType.value === MenuTypeEnum.DUAL_MENU)
|
|
228
|
+
const isTopMenu = computed(() => menuType.value === MenuTypeEnum.TOP)
|
|
229
|
+
const isTopLeftMenu = computed(() => menuType.value === MenuTypeEnum.TOP_LEFT)
|
|
230
|
+
|
|
231
|
+
const { isFullscreen, toggle: toggleFullscreen } = useFullscreen()
|
|
232
|
+
|
|
233
|
+
onMounted(() => {
|
|
234
|
+
initLanguage()
|
|
235
|
+
document.addEventListener('click', bodyCloseNotice)
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
onUnmounted(() => {
|
|
239
|
+
document.removeEventListener('click', bodyCloseNotice)
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 切换全屏状态
|
|
244
|
+
*/
|
|
245
|
+
const toggleFullScreen = (): void => {
|
|
246
|
+
toggleFullscreen()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* 切换菜单显示/隐藏状态
|
|
251
|
+
*/
|
|
252
|
+
const visibleMenu = (): void => {
|
|
253
|
+
settingStore.setMenuOpen(!menuOpen.value)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const { homePath } = useCommon()
|
|
257
|
+
const { refresh } = useCommon()
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* 跳转到首页
|
|
261
|
+
*/
|
|
262
|
+
const toHome = (): void => {
|
|
263
|
+
router.push(homePath.value)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* 刷新页面
|
|
268
|
+
* @param {number} time - 延迟时间,默认为0毫秒
|
|
269
|
+
*/
|
|
270
|
+
const reload = (time: number = 0): void => {
|
|
271
|
+
setTimeout(() => {
|
|
272
|
+
refresh()
|
|
273
|
+
}, time)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 初始化语言设置
|
|
278
|
+
*/
|
|
279
|
+
const initLanguage = (): void => {
|
|
280
|
+
locale.value = language.value
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* 切换系统语言
|
|
285
|
+
* @param {LanguageEnum} lang - 目标语言类型
|
|
286
|
+
*/
|
|
287
|
+
const changeLanguage = (lang: LanguageEnum): void => {
|
|
288
|
+
if (locale.value === lang) return
|
|
289
|
+
locale.value = lang
|
|
290
|
+
userStore.setLanguage(lang)
|
|
291
|
+
reload(50)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 打开设置面板
|
|
296
|
+
*/
|
|
297
|
+
const openSetting = (): void => {
|
|
298
|
+
mittBus.emit('openSetting')
|
|
299
|
+
|
|
300
|
+
// 隐藏设置引导提示
|
|
301
|
+
if (showSettingGuide.value) {
|
|
302
|
+
settingStore.hideSettingGuide()
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* 打开全局搜索对话框
|
|
308
|
+
*/
|
|
309
|
+
const openSearchDialog = (): void => {
|
|
310
|
+
mittBus.emit('openSearchDialog')
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* 点击页面其他区域关闭通知面板
|
|
315
|
+
* @param {Event} e - 点击事件对象
|
|
316
|
+
*/
|
|
317
|
+
const bodyCloseNotice = (e: any): void => {
|
|
318
|
+
if (!showNotice.value) return
|
|
319
|
+
|
|
320
|
+
const target = e.target as HTMLElement
|
|
321
|
+
|
|
322
|
+
// 检查是否点击了通知按钮或通知面板内部
|
|
323
|
+
const isNoticeButton = target.closest('.notice-button')
|
|
324
|
+
const isNoticePanel = target.closest('.art-notification-panel')
|
|
325
|
+
|
|
326
|
+
if (!isNoticeButton && !isNoticePanel) {
|
|
327
|
+
showNotice.value = false
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* 切换通知面板显示状态
|
|
333
|
+
*/
|
|
334
|
+
const visibleNotice = (): void => {
|
|
335
|
+
showNotice.value = !showNotice.value
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* 打开聊天窗口
|
|
340
|
+
*/
|
|
341
|
+
const openChat = (): void => {
|
|
342
|
+
mittBus.emit('openChat')
|
|
343
|
+
}
|
|
344
|
+
</script>
|
|
345
|
+
|
|
346
|
+
<style lang="scss" scoped>
|
|
347
|
+
/* Custom animations */
|
|
348
|
+
@keyframes rotate180 {
|
|
349
|
+
0% {
|
|
350
|
+
transform: rotate(0);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
100% {
|
|
354
|
+
transform: rotate(180deg);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@keyframes shake {
|
|
359
|
+
0% {
|
|
360
|
+
transform: rotate(0);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
25% {
|
|
364
|
+
transform: rotate(-5deg);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
50% {
|
|
368
|
+
transform: rotate(5deg);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
75% {
|
|
372
|
+
transform: rotate(-5deg);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
100% {
|
|
376
|
+
transform: rotate(0);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
@keyframes expand {
|
|
381
|
+
0% {
|
|
382
|
+
transform: scale(1);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
50% {
|
|
386
|
+
transform: scale(1.1);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
100% {
|
|
390
|
+
transform: scale(1);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@keyframes shrink {
|
|
395
|
+
0% {
|
|
396
|
+
transform: scale(1);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
50% {
|
|
400
|
+
transform: scale(0.9);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
100% {
|
|
404
|
+
transform: scale(1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
@keyframes moveUp {
|
|
409
|
+
0% {
|
|
410
|
+
transform: translateY(0);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
50% {
|
|
414
|
+
transform: translateY(-3px);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
100% {
|
|
418
|
+
transform: translateY(0);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
@keyframes breathing {
|
|
423
|
+
0% {
|
|
424
|
+
opacity: 0.4;
|
|
425
|
+
transform: scale(0.9);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
50% {
|
|
429
|
+
opacity: 1;
|
|
430
|
+
transform: scale(1.1);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
100% {
|
|
434
|
+
opacity: 0.4;
|
|
435
|
+
transform: scale(0.9);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* Hover animation classes */
|
|
440
|
+
.refresh-btn:hover :deep(.art-svg-icon) {
|
|
441
|
+
animation: rotate180 0.5s;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.language-btn:hover :deep(.art-svg-icon) {
|
|
445
|
+
animation: moveUp 0.4s;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.setting-btn:hover :deep(.art-svg-icon) {
|
|
449
|
+
animation: rotate180 0.5s;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.full-screen-btn:hover :deep(.art-svg-icon) {
|
|
453
|
+
animation: expand 0.6s forwards;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.exit-full-screen-btn:hover :deep(.art-svg-icon) {
|
|
457
|
+
animation: shrink 0.6s forwards;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.notice-button:hover :deep(.art-svg-icon) {
|
|
461
|
+
animation: shake 0.5s ease-in-out;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.chat-button:hover :deep(.art-svg-icon) {
|
|
465
|
+
animation: shake 0.5s ease-in-out;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/* Breathing animation for chat dot */
|
|
469
|
+
.breathing-dot {
|
|
470
|
+
animation: breathing 1.5s ease-in-out infinite;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/* iPad breakpoint adjustments */
|
|
474
|
+
@media screen and (width <= 768px) {
|
|
475
|
+
.logo2 {
|
|
476
|
+
display: block !important;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
@media screen and (width <= 640px) {
|
|
481
|
+
.btn-box {
|
|
482
|
+
width: 40px;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
</style>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<!-- 用户菜单 -->
|
|
2
|
+
<template>
|
|
3
|
+
<ElPopover
|
|
4
|
+
ref="userMenuPopover"
|
|
5
|
+
placement="bottom-end"
|
|
6
|
+
:width="240"
|
|
7
|
+
:hide-after="0"
|
|
8
|
+
:offset="10"
|
|
9
|
+
trigger="hover"
|
|
10
|
+
:show-arrow="false"
|
|
11
|
+
popper-class="user-menu-popover"
|
|
12
|
+
popper-style="padding: 5px 16px;"
|
|
13
|
+
>
|
|
14
|
+
<template #reference>
|
|
15
|
+
<img
|
|
16
|
+
class="size-8.5 mr-5 c-p rounded-full max-sm:w-6.5 max-sm:h-6.5 max-sm:mr-[16px]"
|
|
17
|
+
:src="userInfo.avatar || AppConfig.assets.defaultAvatar"
|
|
18
|
+
:alt="userInfo.userName || '用户头像'"
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
21
|
+
<template #default>
|
|
22
|
+
<div class="pt-3">
|
|
23
|
+
<div class="flex-c pb-1 px-0">
|
|
24
|
+
<img
|
|
25
|
+
class="w-10 h-10 mr-3 ml-0 overflow-hidden rounded-full float-left"
|
|
26
|
+
:src="userInfo.avatar || AppConfig.assets.defaultAvatar"
|
|
27
|
+
:alt="userInfo.userName || '用户头像'"
|
|
28
|
+
/>
|
|
29
|
+
<div class="w-[calc(100%-60px)] h-full">
|
|
30
|
+
<span class="block text-sm font-medium text-g-800 truncate">{{
|
|
31
|
+
userInfo.userName
|
|
32
|
+
}}</span>
|
|
33
|
+
<span class="block mt-0.5 text-xs text-g-500 truncate">{{ userInfo.email }}</span>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<ul class="py-4 mt-3 border-t border-g-300/80">
|
|
37
|
+
<div class="log-out c-p" @click="loginOut">
|
|
38
|
+
{{ $t('topBar.user.logout') }}
|
|
39
|
+
</div>
|
|
40
|
+
</ul>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
</ElPopover>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { useI18n } from 'vue-i18n'
|
|
48
|
+
import { ElMessageBox } from 'element-plus'
|
|
49
|
+
import { useUserStore } from '@/store/modules/user'
|
|
50
|
+
import { signOut } from '@/services/auth'
|
|
51
|
+
import AppConfig from '@/config'
|
|
52
|
+
|
|
53
|
+
defineOptions({ name: 'ArtUserMenu' })
|
|
54
|
+
|
|
55
|
+
const { t } = useI18n()
|
|
56
|
+
const userStore = useUserStore()
|
|
57
|
+
|
|
58
|
+
const { getUserInfo: userInfo } = storeToRefs(userStore)
|
|
59
|
+
const userMenuPopover = ref()
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 用户登出确认
|
|
63
|
+
*/
|
|
64
|
+
const loginOut = (): void => {
|
|
65
|
+
closeUserMenu()
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
ElMessageBox.confirm(t('common.logOutTips'), t('common.tips'), {
|
|
68
|
+
confirmButtonText: t('common.confirm'),
|
|
69
|
+
cancelButtonText: t('common.cancel'),
|
|
70
|
+
customClass: 'login-out-dialog'
|
|
71
|
+
}).then(signOut)
|
|
72
|
+
}, 200)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 关闭用户菜单弹出层
|
|
77
|
+
*/
|
|
78
|
+
const closeUserMenu = (): void => {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
userMenuPopover.value.hide()
|
|
81
|
+
}, 100)
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style scoped>
|
|
86
|
+
@reference '@styles/core/tailwind.css';
|
|
87
|
+
|
|
88
|
+
@layer components {
|
|
89
|
+
.btn-item {
|
|
90
|
+
@apply flex items-center p-2 mb-3 select-none rounded-md cursor-pointer last:mb-0;
|
|
91
|
+
|
|
92
|
+
span {
|
|
93
|
+
@apply text-sm;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.art-svg-icon {
|
|
97
|
+
@apply mr-2 text-base;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&:hover {
|
|
101
|
+
background-color: var(--art-gray-200);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.log-out {
|
|
107
|
+
@apply py-1.5
|
|
108
|
+
mt-5
|
|
109
|
+
text-xs
|
|
110
|
+
text-center
|
|
111
|
+
border
|
|
112
|
+
border-g-400
|
|
113
|
+
rounded-md
|
|
114
|
+
transition-all
|
|
115
|
+
duration-200
|
|
116
|
+
hover:shadow-xl;
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<!-- 水平菜单 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="flex-1 overflow-hidden">
|
|
4
|
+
<ElMenu
|
|
5
|
+
:ellipsis="true"
|
|
6
|
+
mode="horizontal"
|
|
7
|
+
:default-active="routerPath"
|
|
8
|
+
:text-color="isDark ? 'var(--art-gray-800)' : 'var(--art-gray-700)'"
|
|
9
|
+
:popper-offset="-6"
|
|
10
|
+
background-color="transparent"
|
|
11
|
+
:show-timeout="50"
|
|
12
|
+
:hide-timeout="50"
|
|
13
|
+
popper-class="horizontal-menu-popper"
|
|
14
|
+
class="w-full border-none"
|
|
15
|
+
>
|
|
16
|
+
<HorizontalSubmenu
|
|
17
|
+
v-for="item in filteredMenuItems"
|
|
18
|
+
:key="item.path"
|
|
19
|
+
:item="item"
|
|
20
|
+
:isMobile="false"
|
|
21
|
+
:level="0"
|
|
22
|
+
/>
|
|
23
|
+
</ElMenu>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import type { AppRouteRecord } from '@/types/router'
|
|
29
|
+
import HorizontalSubmenu from './widget/HorizontalSubmenu.vue'
|
|
30
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
31
|
+
|
|
32
|
+
defineOptions({ name: 'ArtHorizontalMenu' })
|
|
33
|
+
|
|
34
|
+
const settingStore = useSettingStore()
|
|
35
|
+
const { isDark } = storeToRefs(settingStore)
|
|
36
|
+
|
|
37
|
+
interface Props {
|
|
38
|
+
/** 菜单列表数据 */
|
|
39
|
+
list: AppRouteRecord[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const route = useRoute()
|
|
43
|
+
|
|
44
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
45
|
+
list: () => []
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 过滤后的菜单项列表
|
|
50
|
+
* 只显示未隐藏的菜单项
|
|
51
|
+
*/
|
|
52
|
+
const filteredMenuItems = computed(() => {
|
|
53
|
+
return filterMenuItems(props.list)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 当前激活的路由路径
|
|
58
|
+
* 用于菜单高亮显示
|
|
59
|
+
*/
|
|
60
|
+
const routerPath = computed(() => String(route.meta.activePath || route.path))
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 递归过滤菜单项,移除隐藏的菜单
|
|
64
|
+
* 如果一个父菜单的所有子菜单都被隐藏,则父菜单也会被隐藏
|
|
65
|
+
* @param items 菜单项数组
|
|
66
|
+
* @returns 过滤后的菜单项数组
|
|
67
|
+
*/
|
|
68
|
+
const filterMenuItems = (items: AppRouteRecord[]): AppRouteRecord[] => {
|
|
69
|
+
return items
|
|
70
|
+
.filter((item) => {
|
|
71
|
+
// 如果当前项被隐藏,直接过滤掉
|
|
72
|
+
if (item.meta.isHide) {
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 如果有子菜单,递归过滤子菜单
|
|
77
|
+
if (item.children && item.children.length > 0) {
|
|
78
|
+
const filteredChildren = filterMenuItems(item.children)
|
|
79
|
+
// 如果所有子菜单都被过滤掉了,则隐藏父菜单
|
|
80
|
+
return filteredChildren.length > 0
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 叶子节点且未被隐藏,保留
|
|
84
|
+
return true
|
|
85
|
+
})
|
|
86
|
+
.map((item) => ({
|
|
87
|
+
...item,
|
|
88
|
+
children: item.children ? filterMenuItems(item.children) : undefined
|
|
89
|
+
}))
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style scoped>
|
|
94
|
+
/* Remove el-menu bottom border */
|
|
95
|
+
:deep(.el-menu) {
|
|
96
|
+
border-bottom: none !important;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Remove default styles for first-level menu items */
|
|
100
|
+
:deep(.el-menu-item[tabindex='0']) {
|
|
101
|
+
background-color: transparent !important;
|
|
102
|
+
border: none !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Remove bottom border from submenu titles */
|
|
106
|
+
:deep(.el-menu--horizontal .el-sub-menu__title) {
|
|
107
|
+
padding: 0 30px 0 10px !important;
|
|
108
|
+
border: 0 !important;
|
|
109
|
+
}
|
|
110
|
+
</style>
|