@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,403 @@
|
|
|
1
|
+
import { isArray } from "../utils/is";
|
|
2
|
+
import type { RouteItem, RouteMeta } from "../rpc/system/admin/v1/auth";
|
|
3
|
+
import { BaseMenuType } from "../rpc/system/common/v1/enum";
|
|
4
|
+
|
|
5
|
+
const mode = import.meta.env.VITE_ROUTER_MODE;
|
|
6
|
+
|
|
7
|
+
/** 树形或枚举数据字段映射配置。 */
|
|
8
|
+
type FieldNamesProps = {
|
|
9
|
+
label?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
children?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 获取菜单图标。
|
|
16
|
+
*/
|
|
17
|
+
export function getRouteMetaIcon(meta?: RouteMeta) {
|
|
18
|
+
return meta?.icon ?? "";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 获取菜单标题。
|
|
23
|
+
*/
|
|
24
|
+
export function getRouteMetaTitle(meta?: RouteMeta) {
|
|
25
|
+
return meta?.title ?? "未命名菜单";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 判断菜单是否隐藏。
|
|
30
|
+
*/
|
|
31
|
+
export function getRouteMetaHidden(meta?: RouteMeta) {
|
|
32
|
+
return meta?.hidden ?? false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 判断目录是否始终显示。
|
|
37
|
+
*/
|
|
38
|
+
export function getRouteMetaAlwaysShow(meta?: RouteMeta) {
|
|
39
|
+
return meta?.always_show ?? false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 判断菜单是否全屏。
|
|
44
|
+
*/
|
|
45
|
+
export function getRouteMetaFull(meta?: RouteMeta) {
|
|
46
|
+
return meta?.full ?? false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 判断菜单是否固定标签。
|
|
51
|
+
*/
|
|
52
|
+
export function getRouteMetaAffix(meta?: RouteMeta) {
|
|
53
|
+
return meta?.affix ?? false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 判断菜单是否缓存。
|
|
58
|
+
*/
|
|
59
|
+
export function getRouteMetaKeepAlive(meta?: RouteMeta) {
|
|
60
|
+
return meta?.keep_alive ?? false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @description 获取localStorage
|
|
65
|
+
* @param {String} key Storage名称
|
|
66
|
+
* @returns {String}
|
|
67
|
+
*/
|
|
68
|
+
export function localGet(key: string) {
|
|
69
|
+
const value = window.localStorage.getItem(key);
|
|
70
|
+
try {
|
|
71
|
+
return JSON.parse(window.localStorage.getItem(key) as string);
|
|
72
|
+
} catch {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @description 存储localStorage
|
|
79
|
+
* @param {String} key Storage名称
|
|
80
|
+
* @param {*} value Storage值
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
export function localSet(key: string, value: any) {
|
|
84
|
+
window.localStorage.setItem(key, JSON.stringify(value));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @description 清除localStorage
|
|
89
|
+
* @param {String} key Storage名称
|
|
90
|
+
* @returns {void}
|
|
91
|
+
*/
|
|
92
|
+
export function localRemove(key: string) {
|
|
93
|
+
window.localStorage.removeItem(key);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description 清除所有localStorage
|
|
98
|
+
* @returns {void}
|
|
99
|
+
*/
|
|
100
|
+
export function localClear() {
|
|
101
|
+
window.localStorage.clear();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @description 判断数据类型
|
|
106
|
+
* @param {*} val 需要判断类型的数据
|
|
107
|
+
* @returns {String}
|
|
108
|
+
*/
|
|
109
|
+
export function isType(val: any) {
|
|
110
|
+
if (val === null) return "null";
|
|
111
|
+
if (typeof val !== "object") return typeof val;
|
|
112
|
+
else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @description 生成唯一 uuid
|
|
117
|
+
* @returns {String}
|
|
118
|
+
*/
|
|
119
|
+
export function generateUUID() {
|
|
120
|
+
let uuid = "";
|
|
121
|
+
for (let i = 0; i < 32; i++) {
|
|
122
|
+
let random = (Math.random() * 16) | 0;
|
|
123
|
+
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += "-";
|
|
124
|
+
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16);
|
|
125
|
+
}
|
|
126
|
+
return uuid;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 判断两个对象是否相同
|
|
131
|
+
* @param {Object} a 要比较的对象一
|
|
132
|
+
* @param {Object} b 要比较的对象二
|
|
133
|
+
* @returns {Boolean} 相同返回 true,反之 false
|
|
134
|
+
*/
|
|
135
|
+
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
|
|
136
|
+
if (!a || !b) return false;
|
|
137
|
+
let aProps = Object.getOwnPropertyNames(a);
|
|
138
|
+
let bProps = Object.getOwnPropertyNames(b);
|
|
139
|
+
if (aProps.length != bProps.length) return false;
|
|
140
|
+
for (let i = 0; i < aProps.length; i++) {
|
|
141
|
+
let propName = aProps[i];
|
|
142
|
+
let propA = a[propName];
|
|
143
|
+
let propB = b[propName];
|
|
144
|
+
if (!b.hasOwnProperty(propName)) return false;
|
|
145
|
+
if (propA instanceof Object) {
|
|
146
|
+
if (!isObjectValueEqual(propA, propB)) return false;
|
|
147
|
+
} else if (propA !== propB) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @description 生成随机数
|
|
156
|
+
* @param {Number} min 最小值
|
|
157
|
+
* @param {Number} max 最大值
|
|
158
|
+
* @returns {Number}
|
|
159
|
+
*/
|
|
160
|
+
export function randomNum(min: number, max: number): number {
|
|
161
|
+
let num = Math.floor(Math.random() * (min - max) + max);
|
|
162
|
+
return num;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @description 获取当前时间对应的提示语
|
|
167
|
+
* @returns {String}
|
|
168
|
+
*/
|
|
169
|
+
export function getTimeState() {
|
|
170
|
+
let timeNow = new Date();
|
|
171
|
+
let hours = timeNow.getHours();
|
|
172
|
+
if (hours >= 6 && hours <= 10) return `早上好 ⛅`;
|
|
173
|
+
if (hours >= 10 && hours <= 14) return `中午好 🌞`;
|
|
174
|
+
if (hours >= 14 && hours <= 18) return `下午好 🌞`;
|
|
175
|
+
if (hours >= 18 && hours <= 24) return `晚上好 🌛`;
|
|
176
|
+
if (hours >= 0 && hours <= 6) return `凌晨好 🌛`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @description 获取不同路由模式所对应的 url + params
|
|
181
|
+
* @returns {String}
|
|
182
|
+
*/
|
|
183
|
+
export function getUrlWithParams() {
|
|
184
|
+
const url = {
|
|
185
|
+
hash: location.hash.substring(1),
|
|
186
|
+
history: location.pathname + location.search
|
|
187
|
+
};
|
|
188
|
+
return url[mode];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* 判断路径是否为外部链接。
|
|
193
|
+
*/
|
|
194
|
+
export function isExternalPath(path?: string) {
|
|
195
|
+
if (!path) return false;
|
|
196
|
+
return /^(https?:|mailto:|tel:)/.test(path);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** 获取菜单项实际跳转目标,外链优先使用 redirect。 */
|
|
200
|
+
export function getRouteTarget(item: RouteItem): string {
|
|
201
|
+
if (item.type === BaseMenuType.EXT_LINK) return item.redirect || item.path || "";
|
|
202
|
+
return item.path ?? "";
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** 获取菜单节点的首个可跳转子路径。 */
|
|
206
|
+
function getFirstRoutePath(item: RouteItem): string {
|
|
207
|
+
if (item.path) return item.path;
|
|
208
|
+
for (const child of item.children ?? []) {
|
|
209
|
+
const path = getFirstRoutePath(child);
|
|
210
|
+
if (path) return path;
|
|
211
|
+
}
|
|
212
|
+
return "";
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** 获取菜单节点在 Element Plus 菜单树中的稳定索引。 */
|
|
216
|
+
export function getRouteMenuKey(item: RouteItem): string {
|
|
217
|
+
if (item.path) return item.path;
|
|
218
|
+
return `folder:${getFirstRoutePath(item) || getRouteMetaTitle(item.meta)}`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** 判断路由路径是否匹配菜单路径,兼容动态参数。 */
|
|
222
|
+
function matchRoutePath(menuPath: string, currentPath: string): boolean {
|
|
223
|
+
const menuSegments = menuPath.split("/").filter(Boolean);
|
|
224
|
+
const currentSegments = currentPath.split("/").filter(Boolean);
|
|
225
|
+
if (menuSegments.length !== currentSegments.length) return false;
|
|
226
|
+
return menuSegments.every((segment, index) => segment.startsWith(":") || segment === currentSegments[index]);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** 判断菜单节点或其子节点是否对应当前路由。 */
|
|
230
|
+
export function isRouteMenuActive(item: RouteItem, currentPath: string): boolean {
|
|
231
|
+
if (item.path && matchRoutePath(item.path, currentPath)) return true;
|
|
232
|
+
return (item.children ?? []).some(child => isRouteMenuActive(child, currentPath));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @description 使用递归扁平化菜单,方便添加动态路由
|
|
237
|
+
* @param {Array} menuList 菜单列表
|
|
238
|
+
* @returns {Array}
|
|
239
|
+
*/
|
|
240
|
+
export function getFlatMenuList(menuList: RouteItem[]): RouteItem[] {
|
|
241
|
+
let newMenuList: RouteItem[] = JSON.parse(JSON.stringify(menuList));
|
|
242
|
+
return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])]);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @description 使用递归过滤出需要渲染在左侧菜单的列表 (需剔除 hide == true 的菜单)
|
|
247
|
+
* @param {Array} menuList 菜单列表
|
|
248
|
+
* @returns {Array}
|
|
249
|
+
* */
|
|
250
|
+
export function getShowMenuList(menuList: RouteItem[]) {
|
|
251
|
+
let newMenuList: RouteItem[] = JSON.parse(JSON.stringify(menuList));
|
|
252
|
+
return newMenuList.filter(item => {
|
|
253
|
+
item.children?.length && (item.children = getShowMenuList(item.children));
|
|
254
|
+
return !getRouteMetaHidden(item.meta);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @description 使用递归找出所有面包屑存储到 pinia/vuex 中
|
|
260
|
+
* @param {Array} menuList 菜单列表
|
|
261
|
+
* @param {Array} parent 父级菜单
|
|
262
|
+
* @param {Object} result 处理后的结果
|
|
263
|
+
* @returns {Object}
|
|
264
|
+
*/
|
|
265
|
+
export const getAllBreadcrumbList = (
|
|
266
|
+
menuList: RouteItem[],
|
|
267
|
+
parent: RouteItem[] = [],
|
|
268
|
+
result: Record<string, RouteItem[]> = {}
|
|
269
|
+
) => {
|
|
270
|
+
for (const item of menuList) {
|
|
271
|
+
const routePath = item.path ?? "";
|
|
272
|
+
const breadcrumb = [...parent, item];
|
|
273
|
+
if (routePath) result[routePath] = breadcrumb;
|
|
274
|
+
if (item.children) getAllBreadcrumbList(item.children, breadcrumb, result);
|
|
275
|
+
}
|
|
276
|
+
return result;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用)
|
|
281
|
+
* @param {Array} menuList 所有菜单列表
|
|
282
|
+
* @param {Array} menuPathArr 菜单地址的一维数组 ['**','**']
|
|
283
|
+
* @returns {Array}
|
|
284
|
+
*/
|
|
285
|
+
export function getMenuListPath(menuList: RouteItem[], menuPathArr: string[] = []): string[] {
|
|
286
|
+
for (const item of menuList) {
|
|
287
|
+
if (typeof item === "object" && item.path) menuPathArr.push(item.path);
|
|
288
|
+
if (item.children?.length) getMenuListPath(item.children, menuPathArr);
|
|
289
|
+
}
|
|
290
|
+
return menuPathArr;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* @description 递归查询当前 path 所对应的菜单对象 (该函数暂未使用)
|
|
295
|
+
* @param {Array} menuList 菜单列表
|
|
296
|
+
* @param {String} path 当前访问地址
|
|
297
|
+
* @returns {Object | null}
|
|
298
|
+
*/
|
|
299
|
+
export function findMenuByPath(menuList: RouteItem[], path: string): RouteItem | null {
|
|
300
|
+
for (const item of menuList) {
|
|
301
|
+
if (item.path === path) return item;
|
|
302
|
+
if (item.children) {
|
|
303
|
+
const res = findMenuByPath(item.children, path);
|
|
304
|
+
if (res) return res;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @description 使用递归过滤需要缓存的菜单 name (该函数暂未使用)
|
|
312
|
+
* @param {Array} menuList 所有菜单列表
|
|
313
|
+
* @param {Array} keepAliveNameArr 缓存的菜单 name ['**','**']
|
|
314
|
+
* @returns {Array}
|
|
315
|
+
* */
|
|
316
|
+
export function getKeepAliveRouterName(menuList: RouteItem[], keepAliveNameArr: string[] = []) {
|
|
317
|
+
menuList.forEach(item => {
|
|
318
|
+
getRouteMetaKeepAlive(item.meta) && item.name && keepAliveNameArr.push(item.name);
|
|
319
|
+
item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr);
|
|
320
|
+
});
|
|
321
|
+
return keepAliveNameArr;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* @description 格式化表格单元格默认值 (el-table-column)
|
|
326
|
+
* @param {Number} row 行
|
|
327
|
+
* @param {Number} col 列
|
|
328
|
+
* @param {*} callValue 当前单元格值
|
|
329
|
+
* @returns {String}
|
|
330
|
+
* */
|
|
331
|
+
export function formatTableColumn(row: number, col: number, callValue: any) {
|
|
332
|
+
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
|
333
|
+
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
|
334
|
+
return callValue ?? "--";
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @description 处理 ProTable 值为数组 || 无数据
|
|
339
|
+
* @param {*} callValue 需要处理的值
|
|
340
|
+
* @returns {String}
|
|
341
|
+
* */
|
|
342
|
+
export function formatValue(callValue: any) {
|
|
343
|
+
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
|
344
|
+
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
|
345
|
+
return callValue ?? "--";
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
|
|
350
|
+
* @param {Object} row 当前行数据
|
|
351
|
+
* @param {String} prop 当前 prop
|
|
352
|
+
* @returns {*}
|
|
353
|
+
* */
|
|
354
|
+
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
|
|
355
|
+
if (!prop.includes(".")) return row[prop] ?? "--";
|
|
356
|
+
prop.split(".").forEach(item => (row = row[item] ?? "--"));
|
|
357
|
+
return row;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* @description 处理 prop,当 prop 为多级嵌套时 ==> 返回最后一级 prop
|
|
362
|
+
* @param {String} prop 当前 prop
|
|
363
|
+
* @returns {String}
|
|
364
|
+
* */
|
|
365
|
+
export function handleProp(prop: string) {
|
|
366
|
+
const propArr = prop.split(".");
|
|
367
|
+
if (propArr.length == 1) return prop;
|
|
368
|
+
return propArr[propArr.length - 1];
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @description 根据枚举列表查询当需要的数据(如果指定了 label 和 value 的 key值,会自动识别格式化)
|
|
373
|
+
* @param {String} callValue 当前单元格值
|
|
374
|
+
* @param {Array} enumData 字典列表
|
|
375
|
+
* @param {Array} fieldNames label && value && children 的 key 值
|
|
376
|
+
* @param {String} type 过滤类型(目前只有 tag)
|
|
377
|
+
* @returns {String}
|
|
378
|
+
* */
|
|
379
|
+
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag") {
|
|
380
|
+
const value = fieldNames?.value ?? "value";
|
|
381
|
+
const label = fieldNames?.label ?? "label";
|
|
382
|
+
const children = fieldNames?.children ?? "children";
|
|
383
|
+
let filterData: { [key: string]: any } = {};
|
|
384
|
+
// 判断 enumData 是否为数组
|
|
385
|
+
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
|
|
386
|
+
// 判断是否输出的结果为 tag 类型
|
|
387
|
+
if (type == "tag") {
|
|
388
|
+
return filterData?.tag_type ?? "";
|
|
389
|
+
} else {
|
|
390
|
+
return filterData ? filterData[label] : "--";
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* @description 递归查找 callValue 对应的 enum 值
|
|
396
|
+
* */
|
|
397
|
+
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
|
|
398
|
+
return enumData.reduce((accumulator: any, current: any) => {
|
|
399
|
+
if (accumulator) return accumulator;
|
|
400
|
+
if (current[value] === callValue) return current;
|
|
401
|
+
if (current[children]) return findItemNested(current[children], callValue, value, children);
|
|
402
|
+
}, null);
|
|
403
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: 判断值是否未某个类型
|
|
3
|
+
*/
|
|
4
|
+
export function is(val: unknown, type: string) {
|
|
5
|
+
return Object.prototype.toString.call(val) === `[object ${type}]`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @description: 是否为函数
|
|
10
|
+
*/
|
|
11
|
+
export function isFunction<T = Function>(val: unknown): val is T {
|
|
12
|
+
return is(val, "Function");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @description: 是否已定义
|
|
17
|
+
*/
|
|
18
|
+
export const isDef = <T = unknown>(val?: T): val is T => {
|
|
19
|
+
return typeof val !== "undefined";
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description: 是否未定义
|
|
24
|
+
*/
|
|
25
|
+
export const isUnDef = <T = unknown>(val?: T): val is T => {
|
|
26
|
+
return !isDef(val);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @description: 是否为对象
|
|
31
|
+
*/
|
|
32
|
+
export const isObject = (val: any): val is Record<any, any> => {
|
|
33
|
+
return val !== null && is(val, "Object");
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @description: 是否为时间
|
|
38
|
+
*/
|
|
39
|
+
export function isDate(val: unknown): val is Date {
|
|
40
|
+
return is(val, "Date");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @description: 是否为数值
|
|
45
|
+
*/
|
|
46
|
+
export function isNumber(val: unknown): val is number {
|
|
47
|
+
return is(val, "Number");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @description: 是否为AsyncFunction
|
|
52
|
+
*/
|
|
53
|
+
export function isAsyncFunction<T = any>(val: unknown): val is Promise<T> {
|
|
54
|
+
return is(val, "AsyncFunction");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @description: 是否为promise
|
|
59
|
+
*/
|
|
60
|
+
export function isPromise<T = any>(val: unknown): val is Promise<T> {
|
|
61
|
+
return is(val, "Promise") && isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @description: 是否为字符串
|
|
66
|
+
*/
|
|
67
|
+
export function isString(val: unknown): val is string {
|
|
68
|
+
return is(val, "String");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @description: 是否为boolean类型
|
|
73
|
+
*/
|
|
74
|
+
export function isBoolean(val: unknown): val is boolean {
|
|
75
|
+
return is(val, "Boolean");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @description: 是否为数组
|
|
80
|
+
*/
|
|
81
|
+
export function isArray(val: any): val is Array<any> {
|
|
82
|
+
return val && Array.isArray(val);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @description: 是否客户端
|
|
87
|
+
*/
|
|
88
|
+
export const isClient = () => {
|
|
89
|
+
return typeof window !== "undefined";
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @description: 是否为浏览器
|
|
94
|
+
*/
|
|
95
|
+
export const isWindow = (val: any): val is Window => {
|
|
96
|
+
return typeof window !== "undefined" && is(val, "Window");
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description: 是否为 element 元素
|
|
101
|
+
*/
|
|
102
|
+
export const isElement = (val: unknown): val is Element => {
|
|
103
|
+
return isObject(val) && !!val.tagName;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @description: 是否为 null
|
|
108
|
+
*/
|
|
109
|
+
export function isNull(val: unknown): val is null {
|
|
110
|
+
return val === null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @description: 是否为 null || undefined
|
|
115
|
+
*/
|
|
116
|
+
export function isNullOrUnDef(val: unknown): val is null | undefined {
|
|
117
|
+
return isUnDef(val) || isNull(val);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @description: 是否为 16 进制颜色
|
|
122
|
+
*/
|
|
123
|
+
export const isHexColor = (str: string) => {
|
|
124
|
+
return /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(str);
|
|
125
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { h, type Component } from "vue";
|
|
2
|
+
import dingtalkIconUrl from "../assets/images/oauth/dingtalk.png";
|
|
3
|
+
import feishuIconUrl from "../assets/images/oauth/feishu.png";
|
|
4
|
+
import giteeIconUrl from "../assets/images/oauth/gitee.png";
|
|
5
|
+
import githubIconUrl from "../assets/images/oauth/github.png";
|
|
6
|
+
import googleIconUrl from "../assets/images/oauth/google.png";
|
|
7
|
+
import wechatIconUrl from "../assets/images/oauth/wechat.png";
|
|
8
|
+
import wechatworkIconUrl from "../assets/images/oauth/wechatwork.png";
|
|
9
|
+
|
|
10
|
+
/** 三方登录展示信息。 */
|
|
11
|
+
export interface OauthProviderDisplay {
|
|
12
|
+
/** 登录方式名称。 */
|
|
13
|
+
name: string;
|
|
14
|
+
/** 登录方式图标标识。 */
|
|
15
|
+
icon: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** 带三方登录 provider 标识的数据。 */
|
|
19
|
+
export interface OauthProviderSource {
|
|
20
|
+
/** 登录方式标识。 */
|
|
21
|
+
provider: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const oauthProviderDisplayMap: Record<string, OauthProviderDisplay> = {
|
|
25
|
+
github: { name: "GitHub", icon: "github" },
|
|
26
|
+
wechat: { name: "微信", icon: "wechat" },
|
|
27
|
+
wechatmp: { name: "微信公众号", icon: "wechat" },
|
|
28
|
+
gitee: { name: "Gitee", icon: "gitee" },
|
|
29
|
+
google: { name: "Google", icon: "google" },
|
|
30
|
+
dingtalk: { name: "钉钉", icon: "dingtalk" },
|
|
31
|
+
feishu: { name: "飞书", icon: "feishu" },
|
|
32
|
+
wechatwork: { name: "企业微信", icon: "wechatwork" }
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** 创建本地官方图标图片组件。 */
|
|
36
|
+
const createOauthImageIcon = (src: string, icon: string): Component => {
|
|
37
|
+
return () =>
|
|
38
|
+
h("img", {
|
|
39
|
+
src,
|
|
40
|
+
alt: "",
|
|
41
|
+
class: `oauth-provider-img oauth-provider-img--${icon}`,
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** 三方登录真实品牌图标组件映射。 */
|
|
47
|
+
const oauthIconMap: Record<string, Component> = {
|
|
48
|
+
github: createOauthImageIcon(githubIconUrl, "github"),
|
|
49
|
+
wechat: createOauthImageIcon(wechatIconUrl, "wechat"),
|
|
50
|
+
google: createOauthImageIcon(googleIconUrl, "google"),
|
|
51
|
+
gitee: createOauthImageIcon(giteeIconUrl, "gitee"),
|
|
52
|
+
dingtalk: createOauthImageIcon(dingtalkIconUrl, "dingtalk"),
|
|
53
|
+
feishu: createOauthImageIcon(feishuIconUrl, "feishu"),
|
|
54
|
+
wechatwork: createOauthImageIcon(wechatworkIconUrl, "wechatwork")
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** 根据 provider 标识获取前端展示信息。 */
|
|
58
|
+
export function getOauthProviderDisplay(provider: string): OauthProviderDisplay {
|
|
59
|
+
return oauthProviderDisplayMap[provider] || { name: provider || "未知方式", icon: provider };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 创建未知 provider 的文字兜底图标。 */
|
|
63
|
+
function createOauthFallbackIcon(provider: OauthProviderSource & OauthProviderDisplay): Component {
|
|
64
|
+
const label = (provider.name || provider.provider || "?").slice(0, 1).toUpperCase();
|
|
65
|
+
return () => h("span", { class: "oauth-provider-fallback", "aria-hidden": "true" }, label);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 获取三方登录真实品牌图标组件。 */
|
|
69
|
+
export function getOauthProviderIcon(provider: OauthProviderSource & OauthProviderDisplay): Component {
|
|
70
|
+
return oauthIconMap[provider.icon] || oauthIconMap[provider.provider] || createOauthFallbackIcon(provider);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** 为接口返回的三方登录数据补齐前端展示信息。 */
|
|
74
|
+
export function withOauthProviderDisplay<T extends OauthProviderSource>(item: T): T & OauthProviderDisplay {
|
|
75
|
+
return {
|
|
76
|
+
...item,
|
|
77
|
+
...getOauthProviderDisplay(item.provider)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defLoginService } from "../api/base/login";
|
|
2
|
+
import { PasswordCryptoScene } from "../rpc/common/v1/enum";
|
|
3
|
+
import type { PasswordCrypto } from "../rpc/common/v1/types";
|
|
4
|
+
|
|
5
|
+
export const PASSWORD_CRYPTO_SCENE = PasswordCryptoScene;
|
|
6
|
+
export type { PasswordCryptoScene };
|
|
7
|
+
|
|
8
|
+
/** 将 PEM 公钥转换为二进制 DER 数据。 */
|
|
9
|
+
function pemToArrayBuffer(pem: string) {
|
|
10
|
+
const base64 = pem
|
|
11
|
+
.replace(/-----BEGIN PUBLIC KEY-----/g, "")
|
|
12
|
+
.replace(/-----END PUBLIC KEY-----/g, "")
|
|
13
|
+
.replace(/\s/g, "");
|
|
14
|
+
const binary = window.atob(base64);
|
|
15
|
+
const buffer = new Uint8Array(binary.length);
|
|
16
|
+
for (let i = 0; i < binary.length; i += 1) {
|
|
17
|
+
buffer[i] = binary.charCodeAt(i);
|
|
18
|
+
}
|
|
19
|
+
return buffer.buffer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 将二进制数据编码为 base64 字符串。 */
|
|
23
|
+
function arrayBufferToBase64(buffer: ArrayBuffer) {
|
|
24
|
+
const bytes = new Uint8Array(buffer);
|
|
25
|
+
let binary = "";
|
|
26
|
+
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
27
|
+
binary += String.fromCharCode(bytes[i]);
|
|
28
|
+
}
|
|
29
|
+
return window.btoa(binary);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 获取浏览器 WebCrypto 能力。 */
|
|
33
|
+
function getSubtleCrypto() {
|
|
34
|
+
const cryptoApi = globalThis.crypto;
|
|
35
|
+
if (!cryptoApi?.subtle) {
|
|
36
|
+
throw new Error("当前环境不支持密码加密");
|
|
37
|
+
}
|
|
38
|
+
return cryptoApi;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** 加密单个密码字段,返回后端可解析的密码密文。 */
|
|
42
|
+
export async function encryptPassword(password: string, scene: PasswordCryptoScene): Promise<PasswordCrypto> {
|
|
43
|
+
const plainPassword = password.trim();
|
|
44
|
+
if (!plainPassword) {
|
|
45
|
+
throw new Error("密码不能为空");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const cryptoApi = getSubtleCrypto();
|
|
49
|
+
const publicKeyResponse = await defLoginService.PasswordPublicKey({ scene });
|
|
50
|
+
const publicKey = await cryptoApi.subtle.importKey(
|
|
51
|
+
"spki",
|
|
52
|
+
pemToArrayBuffer(publicKeyResponse.public_key),
|
|
53
|
+
{ name: "RSA-OAEP", hash: "SHA-256" },
|
|
54
|
+
false,
|
|
55
|
+
["encrypt"]
|
|
56
|
+
);
|
|
57
|
+
const aesKey = await cryptoApi.subtle.generateKey({ name: "AES-GCM", length: 256 }, true, ["encrypt"]);
|
|
58
|
+
const rawAesKey = await cryptoApi.subtle.exportKey("raw", aesKey);
|
|
59
|
+
const iv = cryptoApi.getRandomValues(new Uint8Array(12));
|
|
60
|
+
const ciphertext = await cryptoApi.subtle.encrypt({ name: "AES-GCM", iv }, aesKey, new TextEncoder().encode(plainPassword));
|
|
61
|
+
const encryptedKey = await cryptoApi.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, rawAesKey);
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
key_id: publicKeyResponse.key_id,
|
|
65
|
+
nonce: publicKeyResponse.nonce,
|
|
66
|
+
algorithm: publicKeyResponse.algorithm,
|
|
67
|
+
encrypted_key: arrayBufferToBase64(encryptedKey),
|
|
68
|
+
iv: arrayBufferToBase64(iv.buffer),
|
|
69
|
+
ciphertext: arrayBufferToBase64(ciphertext)
|
|
70
|
+
};
|
|
71
|
+
}
|