@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,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useCommon - 通用功能集合
|
|
3
|
+
*
|
|
4
|
+
* 提供常用的页面操作功能,包括页面刷新、滚动控制、路径获取等。
|
|
5
|
+
* 这些功能在多个页面和组件中都会用到,统一封装便于复用。
|
|
6
|
+
*
|
|
7
|
+
* ## 主要功能
|
|
8
|
+
*
|
|
9
|
+
* 1. 首页路径 - 获取系统配置的首页路径
|
|
10
|
+
* 2. 页面刷新 - 刷新当前页面内容
|
|
11
|
+
* 3. 滚动控制 - 提供多种滚动到顶部和指定位置的方法
|
|
12
|
+
* 4. 平滑滚动 - 支持平滑滚动动画效果
|
|
13
|
+
*
|
|
14
|
+
* @module useCommon
|
|
15
|
+
* @author Art Design Pro Team
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { computed } from 'vue'
|
|
19
|
+
import { useMenuStore } from '@/store/modules/menu'
|
|
20
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
21
|
+
|
|
22
|
+
export function useCommon() {
|
|
23
|
+
const menuStore = useMenuStore()
|
|
24
|
+
const settingStore = useSettingStore()
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 首页路径
|
|
28
|
+
* 从菜单 store 中获取配置的首页路径
|
|
29
|
+
*/
|
|
30
|
+
const homePath = computed(() => menuStore.getHomePath())
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 刷新当前页面
|
|
34
|
+
* 通过切换 setting store 中的 refresh 状态触发页面重新渲染
|
|
35
|
+
*/
|
|
36
|
+
const refresh = () => {
|
|
37
|
+
settingStore.reload()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 滚动到页面顶部
|
|
42
|
+
* 查找主内容区域并将其滚动位置重置为顶部
|
|
43
|
+
*/
|
|
44
|
+
const scrollToTop = () => {
|
|
45
|
+
const scrollContainer = document.getElementById('app-main')
|
|
46
|
+
if (scrollContainer) {
|
|
47
|
+
scrollContainer.scrollTop = 0
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 平滑滚动到页面顶部
|
|
53
|
+
* 使用 smooth 行为实现平滑滚动效果
|
|
54
|
+
*/
|
|
55
|
+
const smoothScrollToTop = () => {
|
|
56
|
+
const scrollContainer = document.getElementById('app-main')
|
|
57
|
+
if (scrollContainer) {
|
|
58
|
+
scrollContainer.scrollTo({
|
|
59
|
+
top: 0,
|
|
60
|
+
behavior: 'smooth'
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 滚动到指定位置
|
|
67
|
+
* @param top 目标滚动位置(像素)
|
|
68
|
+
* @param smooth 是否使用平滑滚动
|
|
69
|
+
*/
|
|
70
|
+
const scrollTo = (top: number, smooth: boolean = false) => {
|
|
71
|
+
const scrollContainer = document.getElementById('app-main')
|
|
72
|
+
if (scrollContainer) {
|
|
73
|
+
scrollContainer.scrollTo({
|
|
74
|
+
top,
|
|
75
|
+
behavior: smooth ? 'smooth' : 'auto'
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
homePath,
|
|
82
|
+
refresh,
|
|
83
|
+
scrollTo,
|
|
84
|
+
scrollToTop,
|
|
85
|
+
smoothScrollToTop
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFastEnter - 快速入口管理
|
|
3
|
+
*
|
|
4
|
+
* 管理顶部栏的快速入口功能,提供应用列表和快速链接的配置和过滤。
|
|
5
|
+
* 支持动态启用/禁用、自定义排序、响应式宽度控制等功能。
|
|
6
|
+
*
|
|
7
|
+
* ## 主要功能
|
|
8
|
+
*
|
|
9
|
+
* 1. 应用列表管理 - 获取启用的应用列表,自动按排序权重排序
|
|
10
|
+
* 2. 快速链接管理 - 获取启用的快速链接,支持自定义排序
|
|
11
|
+
* 3. 响应式配置 - 所有配置自动响应变化,无需手动更新
|
|
12
|
+
* 4. 宽度控制 - 提供最小显示宽度配置,支持响应式布局
|
|
13
|
+
*
|
|
14
|
+
* @module useFastEnter
|
|
15
|
+
* @author Art Design Pro Team
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { computed } from 'vue'
|
|
19
|
+
import appConfig from '@/config'
|
|
20
|
+
import type { FastEnterApplication, FastEnterQuickLink } from '@/types/config'
|
|
21
|
+
|
|
22
|
+
export function useFastEnter() {
|
|
23
|
+
// 获取快速入口配置
|
|
24
|
+
const fastEnterConfig = computed(() => appConfig.fastEnter)
|
|
25
|
+
|
|
26
|
+
// 获取启用的应用列表(按排序权重排序)
|
|
27
|
+
const enabledApplications = computed<FastEnterApplication[]>(() => {
|
|
28
|
+
if (!fastEnterConfig.value?.applications) return []
|
|
29
|
+
|
|
30
|
+
return fastEnterConfig.value.applications
|
|
31
|
+
.filter((app) => app.enabled !== false)
|
|
32
|
+
.sort((a, b) => (a.order || 0) - (b.order || 0))
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// 获取启用的快速链接(按排序权重排序)
|
|
36
|
+
const enabledQuickLinks = computed<FastEnterQuickLink[]>(() => {
|
|
37
|
+
if (!fastEnterConfig.value?.quickLinks) return []
|
|
38
|
+
|
|
39
|
+
return fastEnterConfig.value.quickLinks
|
|
40
|
+
.filter((link) => link.enabled !== false)
|
|
41
|
+
.sort((a, b) => (a.order || 0) - (b.order || 0))
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
// 获取最小显示宽度
|
|
45
|
+
const minWidth = computed(() => {
|
|
46
|
+
return fastEnterConfig.value?.minWidth || 1200
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
fastEnterConfig,
|
|
51
|
+
enabledApplications,
|
|
52
|
+
enabledQuickLinks,
|
|
53
|
+
minWidth
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useHeaderBar - 顶部栏功能管理
|
|
3
|
+
*
|
|
4
|
+
* 统一管理顶部栏各个功能模块的显示状态和配置信息。
|
|
5
|
+
* 提供灵活的功能开关控制,支持动态显示/隐藏顶部栏的各个功能按钮。
|
|
6
|
+
*
|
|
7
|
+
* ## 主要功能
|
|
8
|
+
*
|
|
9
|
+
* 1. 功能开关控制 - 统一管理菜单按钮、刷新按钮、快速入口等功能的显示状态
|
|
10
|
+
* 2. 配置信息获取 - 获取各个功能模块的详细配置信息
|
|
11
|
+
* 3. 功能列表查询 - 快速获取所有启用或禁用的功能列表
|
|
12
|
+
* 4. 响应式状态 - 所有状态自动响应配置和 store 变化
|
|
13
|
+
*
|
|
14
|
+
* @module useHeaderBar
|
|
15
|
+
* @author Art Design Pro Team
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { computed } from 'vue'
|
|
19
|
+
import { storeToRefs } from 'pinia'
|
|
20
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
21
|
+
import { headerBarConfig } from '@/config/modules/headerBar'
|
|
22
|
+
import { HeaderBarFeatureConfig } from '@/types'
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 顶部栏功能管理
|
|
26
|
+
* @returns 顶部栏功能相关的状态和方法
|
|
27
|
+
*/
|
|
28
|
+
export function useHeaderBar() {
|
|
29
|
+
const settingStore = useSettingStore()
|
|
30
|
+
|
|
31
|
+
// 获取顶部栏配置
|
|
32
|
+
const headerBarConfigRef = computed<HeaderBarFeatureConfig>(() => headerBarConfig)
|
|
33
|
+
|
|
34
|
+
// 从store中获取相关状态
|
|
35
|
+
const { showMenuButton, showFastEnter, showRefreshButton, showCrumbs, showLanguage } =
|
|
36
|
+
storeToRefs(settingStore)
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 检查特定功能是否启用
|
|
40
|
+
* @param feature 功能名称
|
|
41
|
+
* @returns 是否启用
|
|
42
|
+
*/
|
|
43
|
+
const isFeatureEnabled = (feature: keyof HeaderBarFeatureConfig): boolean => {
|
|
44
|
+
return headerBarConfigRef.value[feature]?.enabled ?? false
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 获取功能配置信息
|
|
49
|
+
* @param feature 功能名称
|
|
50
|
+
* @returns 功能配置信息
|
|
51
|
+
*/
|
|
52
|
+
const getFeatureConfig = (feature: keyof HeaderBarFeatureConfig) => {
|
|
53
|
+
return headerBarConfigRef.value[feature]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 检查菜单按钮是否显示
|
|
57
|
+
const shouldShowMenuButton = computed(() => {
|
|
58
|
+
return isFeatureEnabled('menuButton') && showMenuButton.value
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// 检查刷新按钮是否显示
|
|
62
|
+
const shouldShowRefreshButton = computed(() => {
|
|
63
|
+
return isFeatureEnabled('refreshButton') && showRefreshButton.value
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
// 检查快速入口是否显示
|
|
67
|
+
const shouldShowFastEnter = computed(() => {
|
|
68
|
+
return isFeatureEnabled('fastEnter') && showFastEnter.value
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// 检查面包屑是否显示
|
|
72
|
+
const shouldShowBreadcrumb = computed(() => {
|
|
73
|
+
return isFeatureEnabled('breadcrumb') && showCrumbs.value
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// 检查全局搜索是否显示
|
|
77
|
+
const shouldShowGlobalSearch = computed(() => {
|
|
78
|
+
return isFeatureEnabled('globalSearch')
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// 检查全屏按钮是否显示
|
|
82
|
+
const shouldShowFullscreen = computed(() => {
|
|
83
|
+
return isFeatureEnabled('fullscreen')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// 检查通知中心是否显示
|
|
87
|
+
const shouldShowNotification = computed(() => {
|
|
88
|
+
return isFeatureEnabled('notification')
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
// 检查聊天功能是否显示
|
|
92
|
+
const shouldShowChat = computed(() => {
|
|
93
|
+
return isFeatureEnabled('chat')
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// 检查语言切换是否显示
|
|
97
|
+
const shouldShowLanguage = computed(() => {
|
|
98
|
+
return isFeatureEnabled('language') && showLanguage.value
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// 检查设置面板是否显示
|
|
102
|
+
const shouldShowSettings = computed(() => {
|
|
103
|
+
return isFeatureEnabled('settings')
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// 检查主题切换是否显示
|
|
107
|
+
const shouldShowThemeToggle = computed(() => {
|
|
108
|
+
return isFeatureEnabled('themeToggle')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
// 获取快速入口的最小宽度
|
|
112
|
+
const fastEnterMinWidth = computed(() => {
|
|
113
|
+
const config = getFeatureConfig('fastEnter')
|
|
114
|
+
return (config as any)?.minWidth || 1200
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 检查功能是否启用(别名)
|
|
119
|
+
* @param feature 功能名称
|
|
120
|
+
* @returns 是否启用
|
|
121
|
+
*/
|
|
122
|
+
const isFeatureActive = (feature: keyof HeaderBarFeatureConfig): boolean => {
|
|
123
|
+
return isFeatureEnabled(feature)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 获取功能配置(别名)
|
|
128
|
+
* @param feature 功能名称
|
|
129
|
+
* @returns 功能配置
|
|
130
|
+
*/
|
|
131
|
+
const getFeatureInfo = (feature: keyof HeaderBarFeatureConfig) => {
|
|
132
|
+
return getFeatureConfig(feature)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 获取所有启用的功能列表
|
|
137
|
+
* @returns 启用的功能名称数组
|
|
138
|
+
*/
|
|
139
|
+
const getEnabledFeatures = (): (keyof HeaderBarFeatureConfig)[] => {
|
|
140
|
+
return Object.keys(headerBarConfigRef.value).filter(
|
|
141
|
+
(key) => headerBarConfigRef.value[key as keyof HeaderBarFeatureConfig]?.enabled
|
|
142
|
+
) as (keyof HeaderBarFeatureConfig)[]
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 获取所有禁用的功能列表
|
|
147
|
+
* @returns 禁用的功能名称数组
|
|
148
|
+
*/
|
|
149
|
+
const getDisabledFeatures = (): (keyof HeaderBarFeatureConfig)[] => {
|
|
150
|
+
return Object.keys(headerBarConfigRef.value).filter(
|
|
151
|
+
(key) => !headerBarConfigRef.value[key as keyof HeaderBarFeatureConfig]?.enabled
|
|
152
|
+
) as (keyof HeaderBarFeatureConfig)[]
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 获取所有启用的功能(别名)
|
|
157
|
+
* @returns 启用的功能列表
|
|
158
|
+
*/
|
|
159
|
+
const getActiveFeatures = () => {
|
|
160
|
+
return getEnabledFeatures()
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 获取所有禁用的功能(别名)
|
|
165
|
+
* @returns 禁用的功能列表
|
|
166
|
+
*/
|
|
167
|
+
const getInactiveFeatures = () => {
|
|
168
|
+
return getDisabledFeatures()
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
// 配置
|
|
173
|
+
headerBarConfig: headerBarConfigRef,
|
|
174
|
+
|
|
175
|
+
// 显示状态计算属性
|
|
176
|
+
shouldShowMenuButton, // 是否显示菜单按钮
|
|
177
|
+
shouldShowRefreshButton, // 是否显示刷新按钮
|
|
178
|
+
shouldShowFastEnter, // 是否显示快速入口
|
|
179
|
+
shouldShowBreadcrumb, // 是否显示面包屑
|
|
180
|
+
shouldShowGlobalSearch, // 是否显示全局搜索
|
|
181
|
+
shouldShowFullscreen, // 是否显示全屏按钮
|
|
182
|
+
shouldShowNotification, // 是否显示通知中心
|
|
183
|
+
shouldShowChat, // 是否显示聊天功能
|
|
184
|
+
shouldShowLanguage, // 是否显示语言切换
|
|
185
|
+
shouldShowSettings, // 是否显示设置面板
|
|
186
|
+
shouldShowThemeToggle, // 是否显示主题切换
|
|
187
|
+
|
|
188
|
+
// 配置相关
|
|
189
|
+
fastEnterMinWidth, // 快速入口最小宽度
|
|
190
|
+
|
|
191
|
+
// 方法
|
|
192
|
+
isFeatureEnabled, // 检查功能是否启用
|
|
193
|
+
isFeatureActive, // 检查功能是否启用(别名)
|
|
194
|
+
getFeatureConfig, // 获取功能配置
|
|
195
|
+
getFeatureInfo, // 获取功能配置(别名)
|
|
196
|
+
getEnabledFeatures, // 获取所有启用的功能
|
|
197
|
+
getDisabledFeatures, // 获取所有禁用的功能
|
|
198
|
+
getActiveFeatures, // 获取所有启用的功能(别名)
|
|
199
|
+
getInactiveFeatures // 获取所有禁用的功能(别名)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useLayoutHeight - 页面布局高度管理
|
|
3
|
+
*
|
|
4
|
+
* 自动计算和管理页面内容区域的高度,确保内容区域能够正确填充剩余空间。
|
|
5
|
+
* 监听头部元素高度变化,动态调整内容区域高度,避免出现滚动条或布局错乱。
|
|
6
|
+
*
|
|
7
|
+
* ## 主要功能
|
|
8
|
+
*
|
|
9
|
+
* 1. 动态高度计算 - 根据头部元素高度自动计算内容区域高度
|
|
10
|
+
* 2. 响应式监听 - 自动监听元素尺寸变化并更新高度
|
|
11
|
+
* 3. CSS 变量同步 - 自动更新 CSS 变量,方便全局使用
|
|
12
|
+
* 4. 灵活配置 - 支持自定义间距、CSS 变量名等
|
|
13
|
+
* 5. 自动查找模式 - 提供通过 ID 自动查找元素的便捷方式
|
|
14
|
+
*
|
|
15
|
+
* @module useLayoutHeight
|
|
16
|
+
* @author Art Design Pro Team
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { ref, computed, watch, onMounted } from 'vue'
|
|
20
|
+
import { useElementSize } from '@vueuse/core'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 页面容器高度配置
|
|
24
|
+
*/
|
|
25
|
+
interface LayoutHeightOptions {
|
|
26
|
+
/** 额外的间距(默认 15px) */
|
|
27
|
+
extraSpacing?: number
|
|
28
|
+
/** 是否自动更新 CSS 变量(默认 true) */
|
|
29
|
+
updateCssVar?: boolean
|
|
30
|
+
/** CSS 变量名称(默认 '--art-full-height') */
|
|
31
|
+
cssVarName?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function useLayoutHeight(options: LayoutHeightOptions = {}) {
|
|
35
|
+
const { extraSpacing = 15, updateCssVar = true, cssVarName = '--art-full-height' } = options
|
|
36
|
+
|
|
37
|
+
// 元素引用
|
|
38
|
+
const headerRef = ref<HTMLElement>()
|
|
39
|
+
const contentHeaderRef = ref<HTMLElement>()
|
|
40
|
+
|
|
41
|
+
// 使用 VueUse 自动监听元素尺寸变化
|
|
42
|
+
const { height: headerHeight } = useElementSize(headerRef)
|
|
43
|
+
const { height: contentHeaderHeight } = useElementSize(contentHeaderRef)
|
|
44
|
+
|
|
45
|
+
// 计算容器最小高度(响应式)
|
|
46
|
+
const containerMinHeight = computed(() => {
|
|
47
|
+
const totalHeight = headerHeight.value + contentHeaderHeight.value + extraSpacing
|
|
48
|
+
return `calc(100vh - ${totalHeight}px)`
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
if (updateCssVar) {
|
|
52
|
+
watch(
|
|
53
|
+
containerMinHeight,
|
|
54
|
+
(newHeight) => {
|
|
55
|
+
requestAnimationFrame(() => {
|
|
56
|
+
document.documentElement.style.setProperty(cssVarName, newHeight)
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
{ immediate: true }
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
/** 容器最小高度(响应式) */
|
|
65
|
+
containerMinHeight,
|
|
66
|
+
/** 头部元素引用 */
|
|
67
|
+
headerRef,
|
|
68
|
+
/** 内容头部元素引用 */
|
|
69
|
+
contentHeaderRef,
|
|
70
|
+
/** 头部高度(响应式) */
|
|
71
|
+
headerHeight,
|
|
72
|
+
/** 内容头部高度(响应式) */
|
|
73
|
+
contentHeaderHeight
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 通过 ID 自动查找元素的布局高度管理
|
|
79
|
+
* 适用于无法直接获取元素引用的场景
|
|
80
|
+
*
|
|
81
|
+
* @param headerIds 头部元素的 ID 数组
|
|
82
|
+
* @param options 配置选项
|
|
83
|
+
*
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export function useAutoLayoutHeight(
|
|
87
|
+
headerIds: string[] = ['app-header', 'app-content-header'],
|
|
88
|
+
options: LayoutHeightOptions = {}
|
|
89
|
+
) {
|
|
90
|
+
const { extraSpacing = 15, updateCssVar = true, cssVarName = '--art-full-height' } = options
|
|
91
|
+
|
|
92
|
+
// 创建元素引用
|
|
93
|
+
const headerRef = ref<HTMLElement>()
|
|
94
|
+
const contentHeaderRef = ref<HTMLElement>()
|
|
95
|
+
|
|
96
|
+
// 使用 VueUse 自动监听元素尺寸变化
|
|
97
|
+
const { height: headerHeight } = useElementSize(headerRef)
|
|
98
|
+
const { height: contentHeaderHeight } = useElementSize(contentHeaderRef)
|
|
99
|
+
|
|
100
|
+
// 计算容器最小高度(响应式)
|
|
101
|
+
const containerMinHeight = computed(() => {
|
|
102
|
+
const totalHeight = headerHeight.value + contentHeaderHeight.value + extraSpacing
|
|
103
|
+
return `calc(100vh - ${totalHeight}px)`
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
if (updateCssVar) {
|
|
107
|
+
watch(
|
|
108
|
+
containerMinHeight,
|
|
109
|
+
(newHeight) => {
|
|
110
|
+
requestAnimationFrame(() => {
|
|
111
|
+
document.documentElement.style.setProperty(cssVarName, newHeight)
|
|
112
|
+
})
|
|
113
|
+
},
|
|
114
|
+
{ immediate: true }
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// 在 DOM 挂载后查找元素
|
|
119
|
+
onMounted(() => {
|
|
120
|
+
if (typeof document !== 'undefined') {
|
|
121
|
+
// 使用 nextTick 确保 DOM 完全渲染
|
|
122
|
+
requestAnimationFrame(() => {
|
|
123
|
+
const header = document.getElementById(headerIds[0])
|
|
124
|
+
const contentHeader = document.getElementById(headerIds[1])
|
|
125
|
+
|
|
126
|
+
if (header) {
|
|
127
|
+
headerRef.value = header
|
|
128
|
+
}
|
|
129
|
+
if (contentHeader) {
|
|
130
|
+
contentHeaderRef.value = contentHeader
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
/** 容器最小高度(响应式) */
|
|
138
|
+
containerMinHeight,
|
|
139
|
+
/** 头部元素引用 */
|
|
140
|
+
headerRef,
|
|
141
|
+
/** 内容头部元素引用 */
|
|
142
|
+
contentHeaderRef,
|
|
143
|
+
/** 头部高度(响应式) */
|
|
144
|
+
headerHeight,
|
|
145
|
+
/** 内容头部高度(响应式) */
|
|
146
|
+
contentHeaderHeight
|
|
147
|
+
}
|
|
148
|
+
}
|