@liujitcn/kratos-admin-core 0.0.1
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/README.md +168 -0
- package/build/getEnv.ts +46 -0
- package/build/plugins.ts +206 -0
- package/build/proxy.ts +29 -0
- package/dist/package/declarations/build/getEnv.d.ts +13 -0
- package/dist/package/declarations/build/plugins.d.ts +20 -0
- package/dist/package/declarations/build/proxy.d.ts +10 -0
- package/dist/package/declarations/index.d.ts +7 -0
- package/dist/package/declarations/src/App.vue.d.ts +3 -0
- package/dist/package/declarations/src/api/base/config.d.ts +7 -0
- package/dist/package/declarations/src/api/base/file.d.ts +11 -0
- package/dist/package/declarations/src/api/base/login.d.ts +18 -0
- package/dist/package/declarations/src/api/base/oauth.d.ts +12 -0
- package/dist/package/declarations/src/api/system/auth.d.ts +13 -0
- package/dist/package/declarations/src/api/system/base_dict.d.ts +8 -0
- package/dist/package/declarations/src/api/system/base_tenant.d.ts +9 -0
- package/dist/package/declarations/src/auth.d.ts +1 -0
- package/dist/package/declarations/src/bootstrap.d.ts +23 -0
- package/dist/package/declarations/src/components/Card/DataPanelCard.vue.d.ts +23 -0
- package/dist/package/declarations/src/components/CronExpression/index.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/Dialog/FormDialog.vue.d.ts +74 -0
- package/dist/package/declarations/src/components/Dialog/ProDialog.vue.d.ts +58 -0
- package/dist/package/declarations/src/components/Dict/DictLabel.vue.d.ts +11 -0
- package/dist/package/declarations/src/components/Dict/index.vue.d.ts +30 -0
- package/dist/package/declarations/src/components/ECharts/config/index.d.ts +7 -0
- package/dist/package/declarations/src/components/ECharts/index.vue.d.ts +22 -0
- package/dist/package/declarations/src/components/ErrorMessage/index.vue.d.ts +12 -0
- package/dist/package/declarations/src/components/Grid/components/GridItem.vue.d.ts +34 -0
- package/dist/package/declarations/src/components/Grid/index.vue.d.ts +28 -0
- package/dist/package/declarations/src/components/Grid/interface/index.d.ts +7 -0
- package/dist/package/declarations/src/components/ImportExcel/index.vue.d.ts +26 -0
- package/dist/package/declarations/src/components/Loading/fullScreen.d.ts +5 -0
- package/dist/package/declarations/src/components/Loading/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/components/PasswordStrength/index.vue.d.ts +13 -0
- package/dist/package/declarations/src/components/ProForm/components/DynamicList.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/ProForm/components/KvList.vue.d.ts +26 -0
- package/dist/package/declarations/src/components/ProForm/components/ProFormItem.vue.d.ts +28 -0
- package/dist/package/declarations/src/components/ProForm/index.vue.d.ts +36 -0
- package/dist/package/declarations/src/components/ProForm/interface/index.d.ts +47 -0
- package/dist/package/declarations/src/components/ProTable/components/ColSetting.vue.d.ts +9 -0
- package/dist/package/declarations/src/components/ProTable/components/Pagination.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/ProTable/components/TableColumn.vue.d.ts +9 -0
- package/dist/package/declarations/src/components/ProTable/interface/index.d.ts +187 -0
- package/dist/package/declarations/src/components/ProTable.d.ts +5 -0
- package/dist/package/declarations/src/components/SearchForm/components/SearchFormItem.vue.d.ts +21 -0
- package/dist/package/declarations/src/components/SearchForm/index.vue.d.ts +22 -0
- package/dist/package/declarations/src/components/SelectFilter/index.vue.d.ts +44 -0
- package/dist/package/declarations/src/components/SelectIcon/index.vue.d.ts +19 -0
- package/dist/package/declarations/src/components/SvgIcon/index.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/SwitchDark/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/components/TreeFilter/index.vue.d.ts +5866 -0
- package/dist/package/declarations/src/components/Upload/File.vue.d.ts +24 -0
- package/dist/package/declarations/src/components/Upload/Files.vue.d.ts +26 -0
- package/dist/package/declarations/src/components/Upload/Img.vue.d.ts +43 -0
- package/dist/package/declarations/src/components/Upload/Imgs.vue.d.ts +46 -0
- package/dist/package/declarations/src/components/WangEditor/index.vue.d.ts +29 -0
- package/dist/package/declarations/src/config/index.d.ts +6 -0
- package/dist/package/declarations/src/config/nprogress.d.ts +3 -0
- package/dist/package/declarations/src/directives/index.d.ts +5 -0
- package/dist/package/declarations/src/directives/modules/auth.d.ts +3 -0
- package/dist/package/declarations/src/directives/modules/copy.d.ts +8 -0
- package/dist/package/declarations/src/directives/modules/debounce.d.ts +8 -0
- package/dist/package/declarations/src/directives/modules/draggable.d.ts +3 -0
- package/dist/package/declarations/src/directives/modules/longpress.d.ts +7 -0
- package/dist/package/declarations/src/directives/modules/throttle.d.ts +3 -0
- package/dist/package/declarations/src/directives/modules/waterMarker.d.ts +5 -0
- package/dist/package/declarations/src/enums/httpEnum.d.ts +29 -0
- package/dist/package/declarations/src/format.d.ts +1 -0
- package/dist/package/declarations/src/hooks/interface/index.d.ts +36 -0
- package/dist/package/declarations/src/hooks/useAuthButtons.d.ts +8 -0
- package/dist/package/declarations/src/hooks/useDownload.d.ts +9 -0
- package/dist/package/declarations/src/hooks/useHandleData.d.ts +10 -0
- package/dist/package/declarations/src/hooks/useOnline.d.ts +6 -0
- package/dist/package/declarations/src/hooks/useSelection.d.ts +10 -0
- package/dist/package/declarations/src/hooks/useTable.d.ts +46 -0
- package/dist/package/declarations/src/hooks/useTheme.d.ts +12 -0
- package/dist/package/declarations/src/hooks/useTime.d.ts +13 -0
- package/dist/package/declarations/src/index.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutClassic/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutColumns/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutTransverse/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutVertical/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Footer/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/ToolBarLeft.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/ToolBarRight.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/AssemblySize.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/Avatar.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/Breadcrumb.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/CollapseIcon.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/Fullscreen.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/InfoDialog.vue.d.ts +5 -0
- package/dist/package/declarations/src/layouts/components/Header/components/PasswordDialog.vue.d.ts +5 -0
- package/dist/package/declarations/src/layouts/components/Header/components/SearchMenu.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/ThemeSetting.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Main/components/Maximize.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Main/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Menu/SubMenu.vue.d.ts +7 -0
- package/dist/package/declarations/src/layouts/components/Tabs/components/MoreButton.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Tabs/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/ThemeDrawer/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/indexAsync.vue.d.ts +3 -0
- package/dist/package/declarations/src/modules/index.d.ts +117 -0
- package/dist/package/declarations/src/modules/kratosAdmin.d.ts +4 -0
- package/dist/package/declarations/src/navigation.d.ts +2 -0
- package/dist/package/declarations/src/request.d.ts +2 -0
- package/dist/package/declarations/src/routers/index.d.ts +21 -0
- package/dist/package/declarations/src/routers/modules/dynamicRouter.d.ts +4 -0
- package/dist/package/declarations/src/routers/modules/staticRouter.d.ts +25 -0
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +23 -0
- package/dist/package/declarations/src/rpc/base/v1/file.d.ts +52 -0
- package/dist/package/declarations/src/rpc/base/v1/login.d.ts +107 -0
- package/dist/package/declarations/src/rpc/base/v1/oauth.d.ts +167 -0
- package/dist/package/declarations/src/rpc/common/v1/common.d.ts +57 -0
- package/dist/package/declarations/src/rpc/common/v1/enum.d.ts +58 -0
- package/dist/package/declarations/src/rpc/common/v1/types.d.ts +60 -0
- package/dist/package/declarations/src/rpc/google/protobuf/empty.d.ts +11 -0
- package/dist/package/declarations/src/rpc/google/protobuf/wrappers.d.ts +108 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +156 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +215 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant.d.ts +112 -0
- package/dist/package/declarations/src/rpc/system/common/v1/enum.d.ts +67 -0
- package/dist/package/declarations/src/security.d.ts +3 -0
- package/dist/package/declarations/src/stores/helper/persist.d.ts +9 -0
- package/dist/package/declarations/src/stores/index.d.ts +2 -0
- package/dist/package/declarations/src/stores/interface/index.d.ts +90 -0
- package/dist/package/declarations/src/stores/modules/auth.d.ts +168 -0
- package/dist/package/declarations/src/stores/modules/config.d.ts +26 -0
- package/dist/package/declarations/src/stores/modules/dict.d.ts +32 -0
- package/dist/package/declarations/src/stores/modules/global.d.ts +4 -0
- package/dist/package/declarations/src/stores/modules/keepAlive.d.ts +6 -0
- package/dist/package/declarations/src/stores/modules/tabs.d.ts +13 -0
- package/dist/package/declarations/src/stores/modules/user.d.ts +29 -0
- package/dist/package/declarations/src/stores/runtime.d.ts +4 -0
- package/dist/package/declarations/src/styles/theme/aside.d.ts +4 -0
- package/dist/package/declarations/src/styles/theme/header.d.ts +4 -0
- package/dist/package/declarations/src/styles/theme/menu.d.ts +4 -0
- package/dist/package/declarations/src/table.d.ts +1 -0
- package/dist/package/declarations/src/tenant.d.ts +1 -0
- package/dist/package/declarations/src/utils/color.d.ts +28 -0
- package/dist/package/declarations/src/utils/dict.d.ts +15 -0
- package/dist/package/declarations/src/utils/eleValidate.d.ts +4 -0
- package/dist/package/declarations/src/utils/errorHandler.d.ts +5 -0
- package/dist/package/declarations/src/utils/index.d.ts +192 -0
- package/dist/package/declarations/src/utils/is/index.d.ts +72 -0
- package/dist/package/declarations/src/utils/mittBus.d.ts +2 -0
- package/dist/package/declarations/src/utils/oauthProvider.d.ts +19 -0
- package/dist/package/declarations/src/utils/passwordCrypto.d.ts +6 -0
- package/dist/package/declarations/src/utils/passwordStrength.d.ts +36 -0
- package/dist/package/declarations/src/utils/proTable.d.ts +44 -0
- package/dist/package/declarations/src/utils/request.d.ts +11 -0
- package/dist/package/declarations/src/utils/router.d.ts +14 -0
- package/dist/package/declarations/src/utils/svg.d.ts +4 -0
- package/dist/package/declarations/src/utils/tenant.d.ts +6 -0
- package/dist/package/declarations/src/utils/utils.d.ts +12 -0
- package/dist/package/declarations/src/views/error/403.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/error/404.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/error/500.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/error/pending.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/login/components/LoginForm.vue.d.ts +4 -0
- package/dist/package/declarations/src/views/login/index.vue.d.ts +3 -0
- package/dist/package/declarations/vite.config.d.ts +13 -0
- package/dist/package/src/App.vue +25 -0
- package/dist/package/src/api/base/config.ts +19 -0
- package/dist/package/src/api/base/file.ts +75 -0
- package/dist/package/src/api/base/login.ts +81 -0
- package/dist/package/src/api/base/oauth.ts +50 -0
- package/dist/package/src/api/system/auth.ts +45 -0
- package/dist/package/src/api/system/base_dict.ts +19 -0
- package/dist/package/src/api/system/base_tenant.ts +20 -0
- package/dist/package/src/assets/fonts/DIN.otf +0 -0
- package/dist/package/src/assets/fonts/MetroDF.ttf +0 -0
- package/dist/package/src/assets/fonts/YouSheBiaoTiHei.ttf +0 -0
- package/dist/package/src/assets/fonts/font.scss +14 -0
- package/dist/package/src/assets/iconfont/iconfont.scss +47 -0
- package/dist/package/src/assets/iconfont/iconfont.ttf +0 -0
- package/dist/package/src/assets/images/403.png +0 -0
- package/dist/package/src/assets/images/404.png +0 -0
- package/dist/package/src/assets/images/500.png +0 -0
- package/dist/package/src/assets/images/avatar.png +0 -0
- package/dist/package/src/assets/images/login_bg.svg +33 -0
- package/dist/package/src/assets/images/login_left.png +0 -0
- package/dist/package/src/assets/images/logo.svg +1 -0
- package/dist/package/src/assets/images/notData.png +0 -0
- package/dist/package/src/assets/images/oauth/dingtalk.png +0 -0
- package/dist/package/src/assets/images/oauth/feishu.png +0 -0
- package/dist/package/src/assets/images/oauth/gitee.png +0 -0
- package/dist/package/src/assets/images/oauth/github.png +0 -0
- package/dist/package/src/assets/images/oauth/google.png +0 -0
- package/dist/package/src/assets/images/oauth/wechat.png +0 -0
- package/dist/package/src/assets/images/oauth/wechatwork.png +0 -0
- package/dist/package/src/auth.ts +1 -0
- package/dist/package/src/bootstrap.ts +69 -0
- package/dist/package/src/components/Card/DataPanelCard.vue +67 -0
- package/dist/package/src/components/CronExpression/index.vue +713 -0
- package/dist/package/src/components/Dialog/FormDialog.vue +160 -0
- package/dist/package/src/components/Dialog/ProDialog.vue +96 -0
- package/dist/package/src/components/Dict/DictLabel.vue +62 -0
- package/dist/package/src/components/Dict/index.vue +157 -0
- package/dist/package/src/components/ECharts/config/index.ts +45 -0
- package/dist/package/src/components/ECharts/index.vue +108 -0
- package/dist/package/src/components/ErrorMessage/index.vue +63 -0
- package/dist/package/src/components/Grid/components/GridItem.vue +69 -0
- package/dist/package/src/components/Grid/index.vue +169 -0
- package/dist/package/src/components/Grid/interface/index.ts +8 -0
- package/dist/package/src/components/ImportExcel/index.scss +3 -0
- package/dist/package/src/components/ImportExcel/index.vue +150 -0
- package/dist/package/src/components/Loading/fullScreen.ts +45 -0
- package/dist/package/src/components/Loading/index.scss +67 -0
- package/dist/package/src/components/Loading/index.vue +13 -0
- package/dist/package/src/components/PasswordStrength/index.vue +127 -0
- package/dist/package/src/components/ProForm/components/DynamicList.vue +59 -0
- package/dist/package/src/components/ProForm/components/KvList.vue +73 -0
- package/dist/package/src/components/ProForm/components/ProFormItem.vue +191 -0
- package/dist/package/src/components/ProForm/index.vue +120 -0
- package/dist/package/src/components/ProForm/interface/index.ts +74 -0
- package/dist/package/src/components/ProTable/components/ColSetting.vue +45 -0
- package/dist/package/src/components/ProTable/components/Pagination.vue +58 -0
- package/dist/package/src/components/ProTable/components/TableColumn.vue +234 -0
- package/dist/package/src/components/ProTable/index.vue +567 -0
- package/dist/package/src/components/ProTable/interface/index.ts +223 -0
- package/dist/package/src/components/ProTable.ts +8 -0
- package/dist/package/src/components/SearchForm/components/SearchFormItem.vue +168 -0
- package/dist/package/src/components/SearchForm/index.vue +105 -0
- package/dist/package/src/components/SelectFilter/index.scss +63 -0
- package/dist/package/src/components/SelectFilter/index.vue +113 -0
- package/dist/package/src/components/SelectIcon/index.scss +39 -0
- package/dist/package/src/components/SelectIcon/index.vue +105 -0
- package/dist/package/src/components/SvgIcon/index.vue +35 -0
- package/dist/package/src/components/SwitchDark/index.vue +12 -0
- package/dist/package/src/components/TreeFilter/index.scss +44 -0
- package/dist/package/src/components/TreeFilter/index.vue +207 -0
- package/dist/package/src/components/Upload/File.vue +201 -0
- package/dist/package/src/components/Upload/Files.vue +234 -0
- package/dist/package/src/components/Upload/Img.vue +306 -0
- package/dist/package/src/components/Upload/Imgs.vue +320 -0
- package/dist/package/src/components/WangEditor/index.scss +28 -0
- package/dist/package/src/components/WangEditor/index.vue +154 -0
- package/dist/package/src/config/index.ts +19 -0
- package/dist/package/src/config/nprogress.ts +12 -0
- package/dist/package/src/directives/index.ts +28 -0
- package/dist/package/src/directives/modules/auth.ts +25 -0
- package/dist/package/src/directives/modules/copy.ts +39 -0
- package/dist/package/src/directives/modules/debounce.ts +32 -0
- package/dist/package/src/directives/modules/draggable.ts +50 -0
- package/dist/package/src/directives/modules/longpress.ts +49 -0
- package/dist/package/src/directives/modules/throttle.ts +42 -0
- package/dist/package/src/directives/modules/waterMarker.ts +36 -0
- package/dist/package/src/enums/httpEnum.ts +35 -0
- package/dist/package/src/format.ts +1 -0
- package/dist/package/src/hooks/interface/index.ts +38 -0
- package/dist/package/src/hooks/useAuthButtons.ts +25 -0
- package/dist/package/src/hooks/useDownload.ts +44 -0
- package/dist/package/src/hooks/useHandleData.ts +38 -0
- package/dist/package/src/hooks/useOnline.ts +27 -0
- package/dist/package/src/hooks/useSelection.ts +34 -0
- package/dist/package/src/hooks/useTable.ts +151 -0
- package/dist/package/src/hooks/useTheme.ts +111 -0
- package/dist/package/src/hooks/useTime.ts +38 -0
- package/dist/package/src/index.ts +9 -0
- package/dist/package/src/layouts/LayoutClassic/index.scss +60 -0
- package/dist/package/src/layouts/LayoutClassic/index.vue +64 -0
- package/dist/package/src/layouts/LayoutColumns/index.scss +95 -0
- package/dist/package/src/layouts/LayoutColumns/index.vue +113 -0
- package/dist/package/src/layouts/LayoutTransverse/index.scss +60 -0
- package/dist/package/src/layouts/LayoutTransverse/index.vue +70 -0
- package/dist/package/src/layouts/LayoutVertical/index.scss +70 -0
- package/dist/package/src/layouts/LayoutVertical/index.vue +119 -0
- package/dist/package/src/layouts/components/Footer/index.scss +11 -0
- package/dist/package/src/layouts/components/Footer/index.vue +21 -0
- package/dist/package/src/layouts/components/Header/ToolBarLeft.vue +23 -0
- package/dist/package/src/layouts/components/Header/ToolBarRight.vue +44 -0
- package/dist/package/src/layouts/components/Header/components/AssemblySize.vue +39 -0
- package/dist/package/src/layouts/components/Header/components/Avatar.vue +226 -0
- package/dist/package/src/layouts/components/Header/components/Breadcrumb.vue +117 -0
- package/dist/package/src/layouts/components/Header/components/CollapseIcon.vue +21 -0
- package/dist/package/src/layouts/components/Header/components/Fullscreen.vue +28 -0
- package/dist/package/src/layouts/components/Header/components/InfoDialog.vue +22 -0
- package/dist/package/src/layouts/components/Header/components/PasswordDialog.vue +22 -0
- package/dist/package/src/layouts/components/Header/components/SearchMenu.vue +207 -0
- package/dist/package/src/layouts/components/Header/components/ThemeSetting.vue +14 -0
- package/dist/package/src/layouts/components/Main/components/Maximize.vue +39 -0
- package/dist/package/src/layouts/components/Main/index.scss +14 -0
- package/dist/package/src/layouts/components/Main/index.vue +90 -0
- package/dist/package/src/layouts/components/Menu/SubMenu.vue +132 -0
- package/dist/package/src/layouts/components/Tabs/components/MoreButton.vue +83 -0
- package/dist/package/src/layouts/components/Tabs/index.scss +69 -0
- package/dist/package/src/layouts/components/Tabs/index.vue +111 -0
- package/dist/package/src/layouts/components/ThemeDrawer/index.scss +137 -0
- package/dist/package/src/layouts/components/ThemeDrawer/index.vue +191 -0
- package/dist/package/src/layouts/index.vue +50 -0
- package/dist/package/src/layouts/indexAsync.vue +54 -0
- package/dist/package/src/modules/index.ts +233 -0
- package/dist/package/src/modules/kratosAdmin.ts +17 -0
- package/dist/package/src/navigation.ts +2 -0
- package/dist/package/src/request.ts +2 -0
- package/dist/package/src/routers/index.ts +143 -0
- package/dist/package/src/routers/modules/dynamicRouter.ts +160 -0
- package/dist/package/src/routers/modules/staticRouter.ts +73 -0
- package/dist/package/src/rpc/base/v1/config.ts +34 -0
- package/dist/package/src/rpc/base/v1/file.ts +66 -0
- package/dist/package/src/rpc/base/v1/login.ts +128 -0
- package/dist/package/src/rpc/base/v1/oauth.ts +199 -0
- package/dist/package/src/rpc/common/v1/common.ts +71 -0
- package/dist/package/src/rpc/common/v1/enum.ts +71 -0
- package/dist/package/src/rpc/common/v1/types.ts +77 -0
- package/dist/package/src/rpc/google/protobuf/empty.ts +19 -0
- package/dist/package/src/rpc/google/protobuf/wrappers.ts +124 -0
- package/dist/package/src/rpc/system/admin/v1/auth.ts +208 -0
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +249 -0
- package/dist/package/src/rpc/system/admin/v1/base_tenant.ts +134 -0
- package/dist/package/src/rpc/system/common/v1/enum.ts +80 -0
- package/dist/package/src/security.ts +3 -0
- package/dist/package/src/stores/helper/persist.ts +19 -0
- package/dist/package/src/stores/index.ts +8 -0
- package/dist/package/src/stores/interface/index.ts +102 -0
- package/dist/package/src/stores/modules/auth.ts +73 -0
- package/dist/package/src/stores/modules/config.ts +119 -0
- package/dist/package/src/stores/modules/dict.ts +65 -0
- package/dist/package/src/stores/modules/global.ts +54 -0
- package/dist/package/src/stores/modules/keepAlive.ts +22 -0
- package/dist/package/src/stores/modules/tabs.ts +77 -0
- package/dist/package/src/stores/modules/user.ts +109 -0
- package/dist/package/src/stores/runtime.ts +4 -0
- package/dist/package/src/styles/common.scss +144 -0
- package/dist/package/src/styles/element-dark.scss +46 -0
- package/dist/package/src/styles/element.scss +333 -0
- package/dist/package/src/styles/reset.scss +143 -0
- package/dist/package/src/styles/theme/aside.ts +16 -0
- package/dist/package/src/styles/theme/header.ts +25 -0
- package/dist/package/src/styles/theme/menu.ts +31 -0
- package/dist/package/src/styles/var.scss +2 -0
- package/dist/package/src/table.ts +1 -0
- package/dist/package/src/tenant.ts +1 -0
- package/dist/package/src/typings/global.d.ts +74 -0
- package/dist/package/src/typings/utils.d.ts +17 -0
- package/dist/package/src/typings/window.d.ts +8 -0
- package/dist/package/src/utils/color.ts +59 -0
- package/dist/package/src/utils/dict.ts +17 -0
- package/dist/package/src/utils/eleValidate.ts +14 -0
- package/dist/package/src/utils/errorHandler.ts +27 -0
- package/dist/package/src/utils/index.ts +403 -0
- package/dist/package/src/utils/is/index.ts +125 -0
- package/dist/package/src/utils/mittBus.ts +5 -0
- package/dist/package/src/utils/oauthProvider.ts +79 -0
- package/dist/package/src/utils/passwordCrypto.ts +71 -0
- package/dist/package/src/utils/passwordStrength.ts +86 -0
- package/dist/package/src/utils/proTable.ts +124 -0
- package/dist/package/src/utils/request.ts +296 -0
- package/dist/package/src/utils/router.ts +43 -0
- package/dist/package/src/utils/svg.ts +13 -0
- package/dist/package/src/utils/tenant.ts +10 -0
- package/dist/package/src/utils/utils.ts +40 -0
- package/dist/package/src/views/error/403.vue +8 -0
- package/dist/package/src/views/error/404.vue +8 -0
- package/dist/package/src/views/error/500.vue +8 -0
- package/dist/package/src/views/error/pending.vue +16 -0
- package/dist/package/src/views/login/components/LoginForm.vue +797 -0
- package/dist/package/src/views/login/index.scss +103 -0
- package/dist/package/src/views/login/index.vue +108 -0
- package/dist/package/src/vite-env.d.ts +3 -0
- package/dist/package/types/generated/auto-imports.d.ts +124 -0
- package/dist/package/types/generated/components.d.ts +151 -0
- package/package.json +199 -0
- package/tsconfig.json +21 -0
- package/types/generated/auto-imports.d.ts +124 -0
- package/types/generated/components.d.ts +151 -0
- package/vite.config.ts +239 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import type { Component } from "vue";
|
|
2
|
+
import type { RouteLocationNormalizedLoaded } from "vue-router";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 管理端视图加载器。
|
|
6
|
+
*/
|
|
7
|
+
export type AdminViewLoader = () => Promise<{
|
|
8
|
+
default: Component;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 管理端视图模块表。
|
|
13
|
+
*/
|
|
14
|
+
export type AdminViewModules = Record<string, AdminViewLoader>;
|
|
15
|
+
|
|
16
|
+
/** ADMIN_STATIC_VIEWS 管理端可替换静态页面的固定视图键。 */
|
|
17
|
+
export const ADMIN_STATIC_VIEWS = {
|
|
18
|
+
LOGIN: "login/index",
|
|
19
|
+
FORBIDDEN: "error/403",
|
|
20
|
+
NOT_FOUND: "error/404",
|
|
21
|
+
SERVER_ERROR: "error/500",
|
|
22
|
+
PENDING: "error/pending"
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
/** 管理端静态页面固定视图键。 */
|
|
26
|
+
export type AdminStaticViewKey = (typeof ADMIN_STATIC_VIEWS)[keyof typeof ADMIN_STATIC_VIEWS];
|
|
27
|
+
|
|
28
|
+
/** 管理端静态页面实现表。 */
|
|
29
|
+
export type AdminStaticViewModules = Partial<Record<AdminStaticViewKey, AdminViewLoader>>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 管理端顶部工具。
|
|
33
|
+
*/
|
|
34
|
+
export interface AdminHeaderTool {
|
|
35
|
+
/** 工具唯一名称,同时作为渲染节点 ID。 */
|
|
36
|
+
name: string;
|
|
37
|
+
/** 工具对应的 Vue 组件。 */
|
|
38
|
+
component: Component;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** 管理端用户菜单操作。 */
|
|
42
|
+
export interface AdminUserMenuAction {
|
|
43
|
+
/** 操作唯一名称。 */
|
|
44
|
+
name: string;
|
|
45
|
+
/** 操作显示名称。 */
|
|
46
|
+
label: string;
|
|
47
|
+
/** 对应后端动态菜单名称,菜单不存在时不显示操作。 */
|
|
48
|
+
menuName: string;
|
|
49
|
+
/** 操作图标。 */
|
|
50
|
+
icon?: Component;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 管理端动态路由行为配置。 */
|
|
54
|
+
export interface AdminRouteOptions {
|
|
55
|
+
/** 查询参数变化时是否复用同一个页签。 */
|
|
56
|
+
reuseTabAcrossQuery?: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 管理端模块定义。
|
|
61
|
+
*/
|
|
62
|
+
export interface AdminModule {
|
|
63
|
+
/** 模块名称。 */
|
|
64
|
+
name: string;
|
|
65
|
+
/** 模块提供的业务页面加载器,页面统一通过模块前缀解析。 */
|
|
66
|
+
views?: AdminViewModules;
|
|
67
|
+
/** 模块提供的静态页面实现,后注册模块可替换已有实现。 */
|
|
68
|
+
staticViews?: AdminStaticViewModules;
|
|
69
|
+
/** 模块提供的顶部工具。 */
|
|
70
|
+
headerTools?: AdminHeaderTool[];
|
|
71
|
+
/** 模块提供的用户菜单操作。 */
|
|
72
|
+
userMenuActions?: AdminUserMenuAction[];
|
|
73
|
+
/** 模块提供的动态路由行为配置,以后端菜单名称为键。 */
|
|
74
|
+
routeOptions?: Record<string, AdminRouteOptions>;
|
|
75
|
+
/** 模块提供的命名扩展,由扩展所属业务包定义具体类型。 */
|
|
76
|
+
extensions?: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const registeredModules = new Map<string, AdminModule>();
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 声明一个可被管理端宿主注册的模块。
|
|
83
|
+
*/
|
|
84
|
+
export function defineAdminModule(module: AdminModule): AdminModule {
|
|
85
|
+
return module;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 注册一个管理端模块,名称或模块级扩展点重复时抛出错误。
|
|
90
|
+
*/
|
|
91
|
+
export function registerAdminModule(module: AdminModule): void {
|
|
92
|
+
registerAdminModules([module]);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 批量注册管理端模块,全部通过唯一性校验后再写入注册表。
|
|
97
|
+
*/
|
|
98
|
+
export function registerAdminModules(modules: AdminModule[]): void {
|
|
99
|
+
const nextModules = [...registeredModules.values(), ...modules];
|
|
100
|
+
assertUniqueAdminModuleKeys(nextModules, "模块", module => [module.name]);
|
|
101
|
+
assertUniqueAdminModuleKeys(nextModules, "顶部工具", module => module.headerTools?.map(tool => tool.name) ?? []);
|
|
102
|
+
assertUniqueAdminModuleKeys(nextModules, "用户菜单", module => module.userMenuActions?.map(action => action.name) ?? []);
|
|
103
|
+
assertUniqueAdminModuleKeys(nextModules, "路由配置", module => Object.keys(module.routeOptions ?? {}));
|
|
104
|
+
modules.forEach(module => registeredModules.set(module.name, module));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 获取当前已注册的管理端模块。
|
|
109
|
+
*/
|
|
110
|
+
export function getRegisteredAdminModules(): AdminModule[] {
|
|
111
|
+
return [...registeredModules.values()];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 管理端视图注册表。
|
|
116
|
+
*/
|
|
117
|
+
export interface AdminViewRegistry {
|
|
118
|
+
/** 根据固定视图键或后端菜单组件路径查找页面加载器。 */
|
|
119
|
+
resolve(component?: string): AdminViewLoader | undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 创建管理端视图注册表,业务页面按模块隔离,静态页面允许后注册模块替换。
|
|
124
|
+
*/
|
|
125
|
+
export function createAdminViewRegistry(modules: AdminModule[]): AdminViewRegistry {
|
|
126
|
+
const viewMap = new Map<string, AdminViewLoader>();
|
|
127
|
+
|
|
128
|
+
modules.forEach(module => {
|
|
129
|
+
Object.entries(module.views ?? {}).forEach(([path, loader]) => {
|
|
130
|
+
const normalizedPath = normalizeAdminViewPath(path);
|
|
131
|
+
if (!normalizedPath) return;
|
|
132
|
+
viewMap.set(`${module.name}/${normalizedPath}`, loader);
|
|
133
|
+
});
|
|
134
|
+
Object.entries(module.staticViews ?? {}).forEach(([path, loader]) => {
|
|
135
|
+
const normalizedPath = normalizeAdminViewPath(path);
|
|
136
|
+
if (!normalizedPath || !loader) return;
|
|
137
|
+
viewMap.set(normalizedPath, loader);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
resolve(component) {
|
|
143
|
+
const normalizedPath = normalizeAdminViewPath(component);
|
|
144
|
+
if (!normalizedPath || normalizedPath === "Layout") return undefined;
|
|
145
|
+
|
|
146
|
+
const candidates = [
|
|
147
|
+
normalizedPath,
|
|
148
|
+
`${normalizedPath}/index`,
|
|
149
|
+
normalizedPath.replace(/\/index$/, ""),
|
|
150
|
+
`${normalizedPath.replace(/\/index$/, "")}/index`
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
return candidates.map(path => viewMap.get(path)).find(Boolean);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* 根据当前已注册模块创建视图注册表。
|
|
160
|
+
*/
|
|
161
|
+
export function getAdminViewRegistry(): AdminViewRegistry {
|
|
162
|
+
return createAdminViewRegistry(getRegisteredAdminModules());
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* 获取当前已注册模块提供的顶部工具。
|
|
167
|
+
*/
|
|
168
|
+
export function getAdminHeaderTools(): AdminHeaderTool[] {
|
|
169
|
+
return getRegisteredAdminModules().flatMap(module => module.headerTools ?? []);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 获取当前已注册模块提供的用户菜单操作。
|
|
174
|
+
*/
|
|
175
|
+
export function getAdminUserMenuActions(): AdminUserMenuAction[] {
|
|
176
|
+
return getRegisteredAdminModules().flatMap(module => module.userMenuActions ?? []);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 获取指定动态路由的行为配置。
|
|
181
|
+
*/
|
|
182
|
+
export function getAdminRouteOptions(name?: string): AdminRouteOptions | undefined {
|
|
183
|
+
if (!name) return undefined;
|
|
184
|
+
return getRegisteredAdminModules().reduce<AdminRouteOptions | undefined>((options, module) => {
|
|
185
|
+
return module.routeOptions?.[name] ?? options;
|
|
186
|
+
}, undefined);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** getAdminTabPath 根据路由扩展配置返回当前页签唯一标识。 */
|
|
190
|
+
export function getAdminTabPath(route: Pick<RouteLocationNormalizedLoaded, "name" | "path" | "fullPath">): string {
|
|
191
|
+
const routeName = typeof route.name === "string" ? route.name : undefined;
|
|
192
|
+
return getAdminRouteOptions(routeName)?.reuseTabAcrossQuery ? route.path : route.fullPath;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* 获取最后注册模块提供的指定命名扩展。
|
|
197
|
+
*/
|
|
198
|
+
export function getAdminModuleExtension<T>(name: string): T | undefined {
|
|
199
|
+
return getRegisteredAdminModules().reduce<T | undefined>((extension, module) => {
|
|
200
|
+
return (module.extensions?.[name] as T | undefined) ?? extension;
|
|
201
|
+
}, undefined);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* 统一模块路径和后端菜单组件路径的表示形式。
|
|
206
|
+
*/
|
|
207
|
+
function normalizeAdminViewPath(path?: string): string {
|
|
208
|
+
if (!path) return "";
|
|
209
|
+
|
|
210
|
+
let normalizedPath = path.trim().replace(/\\/g, "/");
|
|
211
|
+
normalizedPath = normalizedPath.replace(/^.*\/src\/views\//, "");
|
|
212
|
+
normalizedPath = normalizedPath.replace(/^.*\/views\//, "");
|
|
213
|
+
normalizedPath = normalizedPath.replace(/^\.\/views\//, "");
|
|
214
|
+
normalizedPath = normalizedPath.replace(/^\/+/, "");
|
|
215
|
+
normalizedPath = normalizedPath.replace(/\.vue$/, "");
|
|
216
|
+
|
|
217
|
+
return normalizedPath;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** 校验模块提供的命名入口在整个宿主内唯一。 */
|
|
221
|
+
function assertUniqueAdminModuleKeys(modules: AdminModule[], label: string, getKeys: (module: AdminModule) => string[]): void {
|
|
222
|
+
const owners = new Map<string, string>();
|
|
223
|
+
|
|
224
|
+
modules.forEach(module => {
|
|
225
|
+
getKeys(module).forEach(key => {
|
|
226
|
+
const owner = owners.get(key);
|
|
227
|
+
if (owner) {
|
|
228
|
+
throw new Error(`管理端${label}名称重复: ${key}(模块 ${owner} 与 ${module.name})`);
|
|
229
|
+
}
|
|
230
|
+
owners.set(key, module.name);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ADMIN_STATIC_VIEWS, defineAdminModule, type AdminStaticViewModules } from "./index";
|
|
2
|
+
|
|
3
|
+
const staticViewModules: AdminStaticViewModules = {
|
|
4
|
+
[ADMIN_STATIC_VIEWS.LOGIN]: () => import("../views/login/index.vue"),
|
|
5
|
+
[ADMIN_STATIC_VIEWS.FORBIDDEN]: () => import("../views/error/403.vue"),
|
|
6
|
+
[ADMIN_STATIC_VIEWS.NOT_FOUND]: () => import("../views/error/404.vue"),
|
|
7
|
+
[ADMIN_STATIC_VIEWS.SERVER_ERROR]: () => import("../views/error/500.vue"),
|
|
8
|
+
[ADMIN_STATIC_VIEWS.PENDING]: () => import("../views/error/pending.vue")
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* kratos-admin 内置基础模块。
|
|
13
|
+
*/
|
|
14
|
+
export const kratosAdminModule = defineAdminModule({
|
|
15
|
+
name: "kratos-admin",
|
|
16
|
+
staticViews: staticViewModules
|
|
17
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";
|
|
2
|
+
import { useAuthStore } from "../stores/modules/auth";
|
|
3
|
+
import { HOME_URL, LOGIN_URL, ROUTER_WHITE_LIST } from "../config";
|
|
4
|
+
import { initDynamicRouter } from "../routers/modules/dynamicRouter";
|
|
5
|
+
import { staticRouter, errorRouter } from "../routers/modules/staticRouter";
|
|
6
|
+
import NProgress from "../config/nprogress";
|
|
7
|
+
import { isUnmatchedRoute } from "../utils/router";
|
|
8
|
+
import { ensureAccessToken } from "../utils/request";
|
|
9
|
+
|
|
10
|
+
const mode = import.meta.env.VITE_ROUTER_MODE;
|
|
11
|
+
|
|
12
|
+
const routerMode = {
|
|
13
|
+
hash: () => createWebHashHistory(),
|
|
14
|
+
history: () => createWebHistory()
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description 📚 路由参数配置简介
|
|
19
|
+
* @param path ==> 路由菜单访问路径
|
|
20
|
+
* @param name ==> 路由 name (对应页面组件 name, 可用作 KeepAlive 缓存标识 && 按钮权限筛选)
|
|
21
|
+
* @param redirect ==> 路由重定向地址
|
|
22
|
+
* @param component ==> 视图文件路径
|
|
23
|
+
* @param meta ==> 路由菜单元信息
|
|
24
|
+
* @param meta.icon ==> 菜单和面包屑对应的图标
|
|
25
|
+
* @param meta.title ==> 路由标题 (用作 document.title || 菜单的名称)
|
|
26
|
+
* @param meta.hide ==> 是否在菜单中隐藏 (通常列表详情页需要隐藏)
|
|
27
|
+
* @param meta.alwaysShow ==> 目录只有一个子路由时是否始终显示
|
|
28
|
+
* @param meta.full ==> 菜单是否全屏 (示例:数据大屏页面)
|
|
29
|
+
* @param meta.affix ==> 菜单是否固定在标签页中 (首页通常是固定项)
|
|
30
|
+
* @param meta.keepAlive ==> 当前路由是否缓存
|
|
31
|
+
* */
|
|
32
|
+
const router = createRouter({
|
|
33
|
+
history: routerMode[mode](),
|
|
34
|
+
routes: [...staticRouter, ...errorRouter],
|
|
35
|
+
strict: false,
|
|
36
|
+
scrollBehavior: () => ({ left: 0, top: 0 })
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description 路由拦截 beforeEach
|
|
41
|
+
* */
|
|
42
|
+
router.beforeEach(async to => {
|
|
43
|
+
const authStore = useAuthStore();
|
|
44
|
+
const redirectQuery = typeof to.query.redirect === "string" ? to.query.redirect : "";
|
|
45
|
+
|
|
46
|
+
// 1.NProgress 开始
|
|
47
|
+
NProgress.start();
|
|
48
|
+
|
|
49
|
+
// 2.动态设置标题
|
|
50
|
+
const title = import.meta.env.VITE_GLOB_APP_TITLE;
|
|
51
|
+
document.title = to.meta.title ? `${to.meta.title} - ${title}` : title;
|
|
52
|
+
|
|
53
|
+
const hasAccessToken = await ensureAccessToken();
|
|
54
|
+
|
|
55
|
+
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
|
|
56
|
+
if (to.path.toLocaleLowerCase() === LOGIN_URL) {
|
|
57
|
+
const hasOauthCallback = typeof to.query.oauth_ticket === "string" || typeof to.query.oauth_error === "string";
|
|
58
|
+
if (hasOauthCallback) {
|
|
59
|
+
resetRouter();
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (hasAccessToken) {
|
|
63
|
+
// 登录态访问登录页时优先回到显式 redirect,避免 from 为根路径时触发重复重定向。
|
|
64
|
+
const targetPath = redirectQuery && redirectQuery !== LOGIN_URL ? redirectQuery : HOME_URL;
|
|
65
|
+
return targetPath;
|
|
66
|
+
}
|
|
67
|
+
resetRouter();
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 4.判断访问页面是否在路由白名单地址(静态路由)中,如果存在直接放行
|
|
72
|
+
if (ROUTER_WHITE_LIST.includes(to.path)) return true;
|
|
73
|
+
|
|
74
|
+
// 5.判断是否有可用 Token,没有重定向到 login 页面
|
|
75
|
+
if (!hasAccessToken) {
|
|
76
|
+
const redirect = to.path === LOGIN_URL ? undefined : to.fullPath;
|
|
77
|
+
return {
|
|
78
|
+
path: LOGIN_URL,
|
|
79
|
+
query: redirect ? { redirect } : undefined,
|
|
80
|
+
replace: true
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
|
85
|
+
if (!authStore.authMenuListGet.length) {
|
|
86
|
+
await initDynamicRouter();
|
|
87
|
+
if (isUnmatchedRoute(router, to.path)) return getFirstAccessibleRoutePath();
|
|
88
|
+
return { ...to, replace: true };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 6.1 菜单已恢复但路由实例尚未重新挂载时,补跑一次动态路由注册,避免刷新或登录首跳直接命中 404。
|
|
92
|
+
if (isUnmatchedRoute(router, to.path)) {
|
|
93
|
+
await initDynamicRouter();
|
|
94
|
+
if (isUnmatchedRoute(router, to.path)) return getFirstAccessibleRoutePath();
|
|
95
|
+
return { ...to, replace: true };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 7.存储 routerName 做按钮权限筛选
|
|
99
|
+
authStore.setRouteName(to.name as string);
|
|
100
|
+
|
|
101
|
+
// 8.正常访问页面
|
|
102
|
+
return true;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @description 重置路由
|
|
107
|
+
* */
|
|
108
|
+
export const resetRouter = () => {
|
|
109
|
+
const authStore = useAuthStore();
|
|
110
|
+
authStore.flatMenuListGet.forEach(route => {
|
|
111
|
+
const { name } = route;
|
|
112
|
+
if (name && router.hasRoute(name)) router.removeRoute(name);
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** 获取当前已注册动态菜单中的第一个可访问页面,作为首页不可用时的兜底落点。 */
|
|
117
|
+
function getFirstAccessibleRoutePath() {
|
|
118
|
+
const authStore = useAuthStore();
|
|
119
|
+
const systemRouteSet = new Set(["/", "/layout", LOGIN_URL, "/403", "/404", "/500"]);
|
|
120
|
+
const firstRoute = authStore.flatMenuListGet.find(item => {
|
|
121
|
+
if (!item.path || systemRouteSet.has(item.path) || item.meta?.hidden) return false;
|
|
122
|
+
if (item.children?.length || !item.component || item.component === "Layout") return false;
|
|
123
|
+
return !isUnmatchedRoute(router, item.path);
|
|
124
|
+
});
|
|
125
|
+
return firstRoute?.path ?? "/404";
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @description 路由跳转错误
|
|
130
|
+
* */
|
|
131
|
+
router.onError(error => {
|
|
132
|
+
NProgress.done();
|
|
133
|
+
console.warn("路由错误", error.message);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @description 路由跳转结束
|
|
138
|
+
* */
|
|
139
|
+
router.afterEach(() => {
|
|
140
|
+
NProgress.done();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
export default router;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import router from "../../routers/index";
|
|
2
|
+
import { LOGIN_URL } from "../../config";
|
|
3
|
+
import { RouteRecordRaw } from "vue-router";
|
|
4
|
+
import { ElNotification } from "element-plus";
|
|
5
|
+
import { useUserStore } from "../../stores/modules/user";
|
|
6
|
+
import { useAuthStore } from "../../stores/modules/auth";
|
|
7
|
+
import type { RouteItem } from "../../rpc/system/admin/v1/auth";
|
|
8
|
+
import { BaseMenuType } from "../../rpc/system/common/v1/enum";
|
|
9
|
+
import { getRouteMetaFull } from "../../utils";
|
|
10
|
+
import { ADMIN_STATIC_VIEWS, getAdminViewRegistry } from "../../modules";
|
|
11
|
+
|
|
12
|
+
/** 解析后的后端路由项,补齐完整路径和重定向。 */
|
|
13
|
+
type ResolvedRouteItem = {
|
|
14
|
+
item: RouteItem;
|
|
15
|
+
path: string;
|
|
16
|
+
redirect?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 判断是否为外链路径。
|
|
21
|
+
*/
|
|
22
|
+
function isExternalPath(path: string) {
|
|
23
|
+
return /^(https?:|mailto:|tel:)/.test(path);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 规范化绝对路由路径,统一前导斜杠并移除重复/尾部斜杠。
|
|
28
|
+
*/
|
|
29
|
+
function normalizeAbsolutePath(path: string) {
|
|
30
|
+
if (!path) return "";
|
|
31
|
+
const pathWithSlash = path.startsWith("/") ? path : `/${path}`;
|
|
32
|
+
const normalizedPath = pathWithSlash.replace(/\/{2,}/g, "/");
|
|
33
|
+
if (normalizedPath === "/") return normalizedPath;
|
|
34
|
+
return normalizedPath.replace(/\/+$/, "");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 结合父级路径解析当前路由路径。
|
|
39
|
+
*/
|
|
40
|
+
function resolveRoutePath(rawPath: string | undefined, parentPath = "") {
|
|
41
|
+
if (!rawPath) return "";
|
|
42
|
+
const trimmedPath = rawPath.trim();
|
|
43
|
+
if (!trimmedPath) return "";
|
|
44
|
+
if (isExternalPath(trimmedPath)) return trimmedPath;
|
|
45
|
+
if (trimmedPath.startsWith("/")) return normalizeAbsolutePath(trimmedPath);
|
|
46
|
+
|
|
47
|
+
const normalizedParentPath = normalizeAbsolutePath(parentPath);
|
|
48
|
+
if (!normalizedParentPath || normalizedParentPath === "/") {
|
|
49
|
+
return normalizeAbsolutePath(trimmedPath);
|
|
50
|
+
}
|
|
51
|
+
return normalizeAbsolutePath(`${normalizedParentPath}/${trimmedPath}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 递归解析菜单的完整路径,兼容子菜单相对路径。
|
|
56
|
+
*/
|
|
57
|
+
function buildResolvedRouteItems(menuList: RouteItem[], parentPath = ""): ResolvedRouteItem[] {
|
|
58
|
+
const resolvedRouteItems: ResolvedRouteItem[] = [];
|
|
59
|
+
|
|
60
|
+
menuList.forEach(item => {
|
|
61
|
+
const currentPath = resolveRoutePath(item.path, parentPath);
|
|
62
|
+
const redirectBasePath = currentPath || parentPath;
|
|
63
|
+
const currentRedirect = resolveRoutePath(item.redirect, redirectBasePath);
|
|
64
|
+
|
|
65
|
+
resolvedRouteItems.push({
|
|
66
|
+
item,
|
|
67
|
+
path: currentPath,
|
|
68
|
+
redirect: currentRedirect || undefined
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (!item.children?.length) return;
|
|
72
|
+
|
|
73
|
+
// 子路由优先基于当前节点路径进行拼接,保证目录 + 菜单路径可还原为完整地址。
|
|
74
|
+
const childParentPath = currentPath || parentPath;
|
|
75
|
+
resolvedRouteItems.push(...buildResolvedRouteItems(item.children, childParentPath));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return resolvedRouteItems;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 解析菜单对应的页面组件。
|
|
83
|
+
*/
|
|
84
|
+
function resolveRouteComponent(component?: string) {
|
|
85
|
+
const viewRegistry = getAdminViewRegistry();
|
|
86
|
+
const viewLoader = viewRegistry.resolve(component);
|
|
87
|
+
if (viewLoader) return viewLoader;
|
|
88
|
+
|
|
89
|
+
const pendingViewLoader = viewRegistry.resolve(ADMIN_STATIC_VIEWS.PENDING);
|
|
90
|
+
if (!pendingViewLoader) throw new Error(`未注册管理端静态页面:${ADMIN_STATIC_VIEWS.PENDING}`);
|
|
91
|
+
return pendingViewLoader;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 将后端路由项转换为前端路由记录。
|
|
96
|
+
*/
|
|
97
|
+
function createRouteRecord(item: RouteItem, path: string, redirect?: string) {
|
|
98
|
+
return {
|
|
99
|
+
path,
|
|
100
|
+
redirect,
|
|
101
|
+
name: item.name ?? undefined,
|
|
102
|
+
component: item.component ?? undefined,
|
|
103
|
+
meta: item.meta ?? undefined
|
|
104
|
+
} as RouteRecordRaw & {
|
|
105
|
+
component?: string | (() => Promise<unknown>);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @description 初始化动态路由
|
|
111
|
+
*/
|
|
112
|
+
export const initDynamicRouter = async () => {
|
|
113
|
+
const userStore = useUserStore();
|
|
114
|
+
const authStore = useAuthStore();
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
// 1.获取菜单列表 && 按钮权限列表
|
|
118
|
+
await authStore.getAuthMenuList();
|
|
119
|
+
await authStore.getAuthButtonList();
|
|
120
|
+
|
|
121
|
+
// 2.判断当前用户有没有菜单权限
|
|
122
|
+
if (!authStore.authMenuListGet.length) {
|
|
123
|
+
ElNotification({
|
|
124
|
+
title: "无权限访问",
|
|
125
|
+
message: "当前账号无任何菜单权限,请联系系统管理员!",
|
|
126
|
+
type: "warning",
|
|
127
|
+
duration: 3000
|
|
128
|
+
});
|
|
129
|
+
userStore.clearAuthData();
|
|
130
|
+
router.replace(LOGIN_URL);
|
|
131
|
+
return Promise.reject("No permission");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 3.添加动态路由
|
|
135
|
+
const resolvedRouteItems = buildResolvedRouteItems(authStore.authMenuListGet);
|
|
136
|
+
resolvedRouteItems.forEach(({ item, path, redirect }) => {
|
|
137
|
+
if (item.type === BaseMenuType.EXT_LINK) return;
|
|
138
|
+
const routeRecord = createRouteRecord(item, path, redirect);
|
|
139
|
+
|
|
140
|
+
if (typeof routeRecord.component === "string") {
|
|
141
|
+
const resolvedComponent = resolveRouteComponent(routeRecord.component);
|
|
142
|
+
if (!resolvedComponent) return;
|
|
143
|
+
routeRecord.component = resolvedComponent;
|
|
144
|
+
}
|
|
145
|
+
if (!routeRecord.component) return;
|
|
146
|
+
if (!routeRecord.path) return;
|
|
147
|
+
if (routeRecord.name && router.hasRoute(routeRecord.name)) return;
|
|
148
|
+
if (getRouteMetaFull(item.meta)) {
|
|
149
|
+
router.addRoute(routeRecord);
|
|
150
|
+
} else {
|
|
151
|
+
router.addRoute("Layout", routeRecord);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
} catch (error) {
|
|
155
|
+
// 当按钮 || 菜单请求出错时,重定向到登陆页
|
|
156
|
+
userStore.clearAuthData();
|
|
157
|
+
router.replace(LOGIN_URL);
|
|
158
|
+
return Promise.reject(error);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { RouteRecordRaw } from "vue-router";
|
|
2
|
+
import { HOME_URL, LOGIN_URL } from "../../config";
|
|
3
|
+
import { ADMIN_STATIC_VIEWS, getAdminViewRegistry } from "../../modules";
|
|
4
|
+
|
|
5
|
+
/** 创建通过视图注册表解析的静态页面加载器。 */
|
|
6
|
+
function createAdminStaticViewLoader(viewPath: string) {
|
|
7
|
+
return () => {
|
|
8
|
+
const viewLoader = getAdminViewRegistry().resolve(viewPath);
|
|
9
|
+
if (!viewLoader) throw new Error(`未注册管理端静态页面:${viewPath}`);
|
|
10
|
+
return viewLoader();
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* staticRouter (静态路由)
|
|
16
|
+
*/
|
|
17
|
+
export const staticRouter: RouteRecordRaw[] = [
|
|
18
|
+
{
|
|
19
|
+
path: "/",
|
|
20
|
+
redirect: HOME_URL
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
path: LOGIN_URL,
|
|
24
|
+
name: "Login",
|
|
25
|
+
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.LOGIN),
|
|
26
|
+
meta: {
|
|
27
|
+
title: "登录"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
path: "/layout",
|
|
32
|
+
name: "Layout",
|
|
33
|
+
component: () => import("../../layouts/index.vue"),
|
|
34
|
+
// component: () => import("../../layouts/indexAsync.vue"),
|
|
35
|
+
redirect: HOME_URL,
|
|
36
|
+
children: []
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* errorRouter (错误页面路由)
|
|
42
|
+
*/
|
|
43
|
+
export const errorRouter = [
|
|
44
|
+
{
|
|
45
|
+
path: "/403",
|
|
46
|
+
name: "403",
|
|
47
|
+
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.FORBIDDEN),
|
|
48
|
+
meta: {
|
|
49
|
+
title: "403页面"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
path: "/404",
|
|
54
|
+
name: "404",
|
|
55
|
+
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.NOT_FOUND),
|
|
56
|
+
meta: {
|
|
57
|
+
title: "404页面"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
path: "/500",
|
|
62
|
+
name: "500",
|
|
63
|
+
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.SERVER_ERROR),
|
|
64
|
+
meta: {
|
|
65
|
+
title: "500页面"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
// Resolve refresh page, route warnings
|
|
69
|
+
{
|
|
70
|
+
path: "/:pathMatch(.*)*",
|
|
71
|
+
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.NOT_FOUND)
|
|
72
|
+
}
|
|
73
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: base/v1/config.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import type { BaseConfigSite } from "../../common/v1/enum";
|
|
9
|
+
|
|
10
|
+
/** 获取系统配置条件 */
|
|
11
|
+
export interface GetConfigRequest {
|
|
12
|
+
/** 位置:枚举【BaseConfigSite】 */
|
|
13
|
+
site: BaseConfigSite;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 系统配置项 */
|
|
17
|
+
export interface ConfigItem {
|
|
18
|
+
/** 配置key */
|
|
19
|
+
key: string;
|
|
20
|
+
/** 配置value */
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 系统配置查询结果 */
|
|
25
|
+
export interface GetConfigResponse {
|
|
26
|
+
/** 系统配置列表 */
|
|
27
|
+
configs: ConfigItem[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Base系统配置公共服务 */
|
|
31
|
+
export interface ConfigService {
|
|
32
|
+
/** 获取系统配置 */
|
|
33
|
+
GetConfig(request: GetConfigRequest): Promise<GetConfigResponse>;
|
|
34
|
+
}
|