kn-cli 1.0.131 → 1.0.133
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/build/vite.config.js +1 -1
- package/package.json +2 -1
- package/src/create.js +2 -0
- package/templates/template_admin_antd5/.vscode/settings.json +28 -0
- package/templates/template_admin_antd5/build.sh +8 -0
- package/templates/template_admin_antd5/cli.config.js +35 -0
- package/templates/template_admin_antd5/dev.sh +33 -0
- package/templates/template_admin_antd5/frontend_build.sh +48 -0
- package/templates/template_admin_antd5/init/prepare-commit-msg +5 -0
- package/templates/template_admin_antd5/init.sh +24 -0
- package/templates/template_admin_antd5/jsconfig.json +17 -0
- package/templates/template_admin_antd5/package.json +27 -0
- package/templates/template_admin_antd5/public/404.html +26 -0
- package/templates/template_admin_antd5/public/favicon.png +0 -0
- package/templates/template_admin_antd5/public/index.html +48 -0
- package/templates/template_admin_antd5/public/src/_antd.less +37 -0
- package/templates/template_admin_antd5/public/src/_mixin.module.less +79 -0
- package/templates/template_admin_antd5/public/src/_reset.module.less +134 -0
- package/templates/template_admin_antd5/public/src/_variable.module.less +85 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.eot +0 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.module.less +109 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.svg +75 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.ttf +0 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.woff +0 -0
- package/templates/template_admin_antd5/public/src/assets/iconfont/iconfont.woff2 +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/arrow.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/avatar.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/icon-notice.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/icon-user.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/loadFail.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/loading.svg +40 -0
- package/templates/template_admin_antd5/public/src/assets/images/login/bg.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/login/logo.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/login/slogan.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-dep-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-dep.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-log-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-log.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-loginlog-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-loginlog.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-role-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-role.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-user-active.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/icon-user.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/nav-toggle.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/nav/slogan.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/noData.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/noSelect.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/permission/403.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/permission/404.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/permission/503.png +0 -0
- package/templates/template_admin_antd5/public/src/assets/images/play.png +0 -0
- package/templates/template_admin_antd5/public/src/components/_table/column.jsx +47 -0
- package/templates/template_admin_antd5/public/src/components/_table/column.module.less +12 -0
- package/templates/template_admin_antd5/public/src/components/_table/index.jsx +71 -0
- package/templates/template_admin_antd5/public/src/components/_table/index.module.less +15 -0
- package/templates/template_admin_antd5/public/src/components/antd/antProvider.jsx +21 -0
- package/templates/template_admin_antd5/public/src/components/antd/index.jsx +146 -0
- package/templates/template_admin_antd5/public/src/components/antd/select/index.jsx +296 -0
- package/templates/template_admin_antd5/public/src/components/antd/select/index.module.less +21 -0
- package/templates/template_admin_antd5/public/src/components/antd/theme.js +173 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/detail/index.jsx +70 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/detail/index.module.less +12 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/index.jsx +69 -0
- package/templates/template_admin_antd5/public/src/components/antd/tooltip/index.module.less +28 -0
- package/templates/template_admin_antd5/public/src/components/auth/index.jsx +123 -0
- package/templates/template_admin_antd5/public/src/components/auth/index.module.less +7 -0
- package/templates/template_admin_antd5/public/src/components/auth/navCheck.jsx +27 -0
- package/templates/template_admin_antd5/public/src/components/badge/index.jsx +47 -0
- package/templates/template_admin_antd5/public/src/components/badge/index.module.less +44 -0
- package/templates/template_admin_antd5/public/src/components/button/index.jsx +17 -0
- package/templates/template_admin_antd5/public/src/components/debug/index.jsx +28 -0
- package/templates/template_admin_antd5/public/src/components/debug/index.module.less +10 -0
- package/templates/template_admin_antd5/public/src/components/empty/index.jsx +28 -0
- package/templates/template_admin_antd5/public/src/components/empty/index.module.less +20 -0
- package/templates/template_admin_antd5/public/src/components/error/index.jsx +39 -0
- package/templates/template_admin_antd5/public/src/components/icon/index.jsx +128 -0
- package/templates/template_admin_antd5/public/src/components/icon/playVideo/index.jsx +21 -0
- package/templates/template_admin_antd5/public/src/components/icon/playVideo/index.module.less +16 -0
- package/templates/template_admin_antd5/public/src/components/iconFont/index.jsx +20 -0
- package/templates/template_admin_antd5/public/src/components/iconFont/index.module.less +5 -0
- package/templates/template_admin_antd5/public/src/components/image/index.jsx +73 -0
- package/templates/template_admin_antd5/public/src/components/image/index.module.less +117 -0
- package/templates/template_admin_antd5/public/src/components/image/preview.jsx +85 -0
- package/templates/template_admin_antd5/public/src/components/layout/basic/index.jsx +49 -0
- package/templates/template_admin_antd5/public/src/components/layout/basic/index.module.less +76 -0
- package/templates/template_admin_antd5/public/src/components/layout/index.jsx +39 -0
- package/templates/template_admin_antd5/public/src/components/layout/index.module.less +63 -0
- package/templates/template_admin_antd5/public/src/components/layout/provider/index.jsx +32 -0
- package/templates/template_admin_antd5/public/src/components/leftMenu/index.jsx +106 -0
- package/templates/template_admin_antd5/public/src/components/leftMenu/index.module.less +42 -0
- package/templates/template_admin_antd5/public/src/components/link/index.jsx +39 -0
- package/templates/template_admin_antd5/public/src/components/link/index.module.less +11 -0
- package/templates/template_admin_antd5/public/src/components/menuIcon/index.jsx +33 -0
- package/templates/template_admin_antd5/public/src/components/menuIcon/index.module.less +49 -0
- package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.jsx +51 -0
- package/templates/template_admin_antd5/public/src/components/page/pageLoading/index.module.less +29 -0
- package/templates/template_admin_antd5/public/src/components/popup/index.jsx +60 -0
- package/templates/template_admin_antd5/public/src/components/popup/index.module.less +18 -0
- package/templates/template_admin_antd5/public/src/components/react/index.jsx +13 -0
- package/templates/template_admin_antd5/public/src/components/resizeBox/index.jsx +144 -0
- package/templates/template_admin_antd5/public/src/components/resizeBox/index.module.css +90 -0
- package/templates/template_admin_antd5/public/src/components/select/defaultServicesSelect/index.jsx +182 -0
- package/templates/template_admin_antd5/public/src/components/select/dictSelect/index.jsx +84 -0
- package/templates/template_admin_antd5/public/src/components/select/index.jsx +7 -0
- package/templates/template_admin_antd5/public/src/components/select/useSelectList.jsx +217 -0
- package/templates/template_admin_antd5/public/src/components/table/aliTable/index.jsx +250 -0
- package/templates/template_admin_antd5/public/src/components/table/aliTable/index.module.less +105 -0
- package/templates/template_admin_antd5/public/src/components/table/column.jsx +128 -0
- package/templates/template_admin_antd5/public/src/components/table/column.module.less +50 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/index.jsx +302 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/index.module.less +196 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/radio.jsx +15 -0
- package/templates/template_admin_antd5/public/src/components/table/imageTable/radio.module.less +18 -0
- package/templates/template_admin_antd5/public/src/components/table/index.jsx +475 -0
- package/templates/template_admin_antd5/public/src/components/table/index.module.less +133 -0
- package/templates/template_admin_antd5/public/src/components/text/index.jsx +98 -0
- package/templates/template_admin_antd5/public/src/components/text/index.module.less +13 -0
- package/templates/template_admin_antd5/public/src/components/toast/index.jsx +79 -0
- package/templates/template_admin_antd5/public/src/components/toast/index.module.less +43 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/index.jsx +102 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/index.module.less +89 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/topBar/index.jsx +81 -0
- package/templates/template_admin_antd5/public/src/components/topMenu/topBar/index.module.less +97 -0
- package/templates/template_admin_antd5/public/src/components/video/index.jsx +96 -0
- package/templates/template_admin_antd5/public/src/components/video/index.module.less +132 -0
- package/templates/template_admin_antd5/public/src/components/video/preview.jsx +38 -0
- package/templates/template_admin_antd5/public/src/config.js +31 -0
- package/templates/template_admin_antd5/public/src/declarations.d.ts +1 -0
- package/templates/template_admin_antd5/public/src/dictionary/dictionary.js +289 -0
- package/templates/template_admin_antd5/public/src/dictionary/index.jsx +64 -0
- package/templates/template_admin_antd5/public/src/enum.js +41 -0
- package/templates/template_admin_antd5/public/src/hooks/index.jsx +29 -0
- package/templates/template_admin_antd5/public/src/hooks/useDebounceFn.jsx +33 -0
- package/templates/template_admin_antd5/public/src/hooks/useDelay.jsx +34 -0
- package/templates/template_admin_antd5/public/src/hooks/useEsc.jsx +98 -0
- package/templates/template_admin_antd5/public/src/hooks/useImageLoader.jsx +26 -0
- package/templates/template_admin_antd5/public/src/hooks/useInToView.jsx +58 -0
- package/templates/template_admin_antd5/public/src/hooks/useLoading.jsx +46 -0
- package/templates/template_admin_antd5/public/src/hooks/usePreload.jsx +67 -0
- package/templates/template_admin_antd5/public/src/hooks/useRouteMenu.jsx +263 -0
- package/templates/template_admin_antd5/public/src/hooks/useScrollTop.jsx +44 -0
- package/templates/template_admin_antd5/public/src/hooks/useSearch.jsx +163 -0
- package/templates/template_admin_antd5/public/src/hooks/useTableRowSelect.jsx +310 -0
- package/templates/template_admin_antd5/public/src/hooks/useThrottole.jsx +68 -0
- package/templates/template_admin_antd5/public/src/hooks/useTimer.jsx +42 -0
- package/templates/template_admin_antd5/public/src/hooks/useUpdate.jsx +16 -0
- package/templates/template_admin_antd5/public/src/hooks/useWatchServices.jsx +124 -0
- package/templates/template_admin_antd5/public/src/index.jsx +89 -0
- package/templates/template_admin_antd5/public/src/menuConfig/auth.jsx +92 -0
- package/templates/template_admin_antd5/public/src/menuConfig/dashboard.jsx +25 -0
- package/templates/template_admin_antd5/public/src/menuConfig/dna.jsx +76 -0
- package/templates/template_admin_antd5/public/src/menuConfig/index.jsx +17 -0
- package/templates/template_admin_antd5/public/src/mock/auth.js +33 -0
- package/templates/template_admin_antd5/public/src/mock/demo.js +122 -0
- package/templates/template_admin_antd5/public/src/mock/index.js +65 -0
- package/templates/template_admin_antd5/public/src/mock/utils.js +33 -0
- package/templates/template_admin_antd5/public/src/pages/antdComponents/index.jsx +142 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/create/index.jsx +47 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/create/index.module.less +6 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/dialog/index.jsx +96 -0
- package/templates/template_admin_antd5/public/src/pages/auth/user/index.jsx +214 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/index.jsx +75 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/index.module.less +78 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/titleBar/index.jsx +28 -0
- package/templates/template_admin_antd5/public/src/pages/components/layout/titleBar/index.module.less +44 -0
- package/templates/template_admin_antd5/public/src/pages/components/select/user.jsx +18 -0
- package/templates/template_admin_antd5/public/src/pages/demo/page1.jsx +21 -0
- package/templates/template_admin_antd5/public/src/pages/demo/page2.jsx +21 -0
- package/templates/template_admin_antd5/public/src/pages/demo/page3.jsx +21 -0
- package/templates/template_admin_antd5/public/src/pages/error/403.jsx +15 -0
- package/templates/template_admin_antd5/public/src/pages/error/404.jsx +15 -0
- package/templates/template_admin_antd5/public/src/pages/error/503.jsx +15 -0
- package/templates/template_admin_antd5/public/src/pages/error/permission.jsx +40 -0
- package/templates/template_admin_antd5/public/src/pages/error/permission.module.less +16 -0
- package/templates/template_admin_antd5/public/src/pages/home.jsx +90 -0
- package/templates/template_admin_antd5/public/src/pages/home.module.less +6 -0
- package/templates/template_admin_antd5/public/src/pages/login/index.jsx +113 -0
- package/templates/template_admin_antd5/public/src/pages/login/index.module.less +153 -0
- package/templates/template_admin_antd5/public/src/pages/pageTemplate.jsx +28 -0
- package/templates/template_admin_antd5/public/src/provider/app.jsx +201 -0
- package/templates/template_admin_antd5/public/src/provider/loading.jsx +47 -0
- package/templates/template_admin_antd5/public/src/provider/menu.jsx +161 -0
- package/templates/template_admin_antd5/public/src/provider/menu.module.less +35 -0
- package/templates/template_admin_antd5/public/src/route.jsx +127 -0
- package/templates/template_admin_antd5/public/src/services/demo.js +85 -0
- package/templates/template_admin_antd5/public/src/services/excel.js +43 -0
- package/templates/template_admin_antd5/public/src/services/http/index.js +155 -0
- package/templates/template_admin_antd5/public/src/services/index.js +126 -0
- package/templates/template_admin_antd5/public/src/services/interceptor/index.js +67 -0
- package/templates/template_admin_antd5/public/src/services/login.js +37 -0
- package/templates/template_admin_antd5/public/src/services/socket/index.jsx +99 -0
- package/templates/template_admin_antd5/public/src/services/token/index.js +41 -0
- package/templates/template_admin_antd5/public/src/type.js +67 -0
- package/templates/template_admin_antd5/public/src/utils/event.js +58 -0
- package/templates/template_admin_antd5/public/src/utils/format.js +135 -0
- package/templates/template_admin_antd5/public/src/utils/index.js +727 -0
- package/templates/template_admin_antd5/public/src/utils/menu.js +33 -0
- package/templates/template_admin_antd5/public/src/utils/rule.js +277 -0
- package/templates/template_admin_antd5/public/src/utils/storage.js +30 -0
- package/templates/template_admin_antd5/public/static/about.html +1 -0
- package/templates/template_admin_antd5/public/static/kssoLogin.html +22 -0
- package/templates/template_admin_antd5/readme.md +84 -0
- package/templates/template_admin_antd5/renamejstojsx.js +45 -0
- package/templates/template_admin_antd5/renameless.js +53 -0
- package/templates/template_admin_antd5/report.sh +25 -0
- package/templates/template_admin_antd5/shellUtil.sh +110 -0
- package/templates/template_admin_antd5/versionPublish.sh +16 -0
- package/templates/template_admin_antd5/webpack.api.js +105 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import styles from'./index.module.less';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* iconFont图标
|
|
8
|
+
* @param {object} props
|
|
9
|
+
* @param {string} [props.icon] - 图标名称
|
|
10
|
+
* @param {string} [props.className] - 扩展类名
|
|
11
|
+
*
|
|
12
|
+
* @returns {JSX.Element}
|
|
13
|
+
*/
|
|
14
|
+
const IconFont=(props)=>{
|
|
15
|
+
const {icon,className,...others} = props;
|
|
16
|
+
return (
|
|
17
|
+
<span {...others} className={`iconfont icon-${icon} ${styles.iconBox} ${className||''}`} ></span>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
export default IconFont;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { Image } from '@/components/antd';
|
|
4
|
+
import ShowPreview from './preview';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import styles from './index.module.less';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import imgFail from '@/assets/images/loadFail.png';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const errorImg =imgFail;
|
|
12
|
+
// 'data:image/png;base64,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';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef ParamsBasic
|
|
16
|
+
* @property {string} props.src - 必填项;显示的图片地址
|
|
17
|
+
* @property {boolean} [props.hidePreview] - 可选项;是否展示预览功能
|
|
18
|
+
* @property {Array} [props.previewSrcs] - 可选项;预览图片地址
|
|
19
|
+
* @property {boolean} [props.showBlurOSS] - 可选项;展示oss图片模糊效果,大图时渐进加载
|
|
20
|
+
* @property {string} [props.className] - 可选项;类名
|
|
21
|
+
* @property {'view'|'checkbox'} [props.mode='view'] - view为预览模式,点击后会放大,checkbox为选择模式点击后为选中
|
|
22
|
+
* @property {(checked:boolean)=>void} [props.onClick] - 点击后的回调
|
|
23
|
+
* @property {boolean} [props.checked=false] - 选中状态
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 带预览功能的图片组件
|
|
29
|
+
* @param {ParamsBasic & OtherAny} props
|
|
30
|
+
* @returns {JSX.Element}
|
|
31
|
+
*/
|
|
32
|
+
const ImgPreview = (props) => {
|
|
33
|
+
const { src, hidePreview, showBlurOSS, className,mode='view',checked=false,onClick:_onClick, ...others } =props;
|
|
34
|
+
const previewSrcs = props.previewSrcs || [{ src,name:src }];
|
|
35
|
+
|
|
36
|
+
const onImgClick = ()=>{
|
|
37
|
+
if(mode=='checkbox'){
|
|
38
|
+
if(_onClick){
|
|
39
|
+
_onClick(!checked);
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if(hidePreview) return;
|
|
44
|
+
ShowPreview({
|
|
45
|
+
data:previewSrcs,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div className={`${styles.wrap} ${className}`} data-checked={checked} onClick={onImgClick}>
|
|
51
|
+
<Image
|
|
52
|
+
className={`${styles.imgWrap}`}
|
|
53
|
+
src={src || errorImg}
|
|
54
|
+
preview={false}
|
|
55
|
+
placeholder={
|
|
56
|
+
showBlurOSS ? (
|
|
57
|
+
<Image
|
|
58
|
+
preview={false}
|
|
59
|
+
src={`${src}?x-oss-process=image/blur,r_50,s_50/quality,q_1/resize,m_mfit,h_200`}
|
|
60
|
+
className={`${className}`}
|
|
61
|
+
/>
|
|
62
|
+
) : (
|
|
63
|
+
false
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
fallback={errorImg}
|
|
67
|
+
{...others}
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default ImgPreview;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
|
|
2
|
+
.wrap{
|
|
3
|
+
position: relative;
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
width: 174px;
|
|
10
|
+
height: 174px;
|
|
11
|
+
:global{
|
|
12
|
+
.ant-image{
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
.imgWrap{width: 100%;height: 100%;}
|
|
18
|
+
&[data-checked='true']{
|
|
19
|
+
&:before{
|
|
20
|
+
content:' ';
|
|
21
|
+
position: absolute;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
background-color: rgba(0,0,0,.5);
|
|
25
|
+
left:0;
|
|
26
|
+
top:0;
|
|
27
|
+
z-index: 1;
|
|
28
|
+
}
|
|
29
|
+
&:after{
|
|
30
|
+
background-image: url('~@/assets/images/chat/checked.png');
|
|
31
|
+
background-size: contain;
|
|
32
|
+
width: 48px;
|
|
33
|
+
height: 48px;
|
|
34
|
+
position: absolute;
|
|
35
|
+
content: ' ';
|
|
36
|
+
z-index: 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.main{
|
|
42
|
+
position: fixed;
|
|
43
|
+
top: 0;
|
|
44
|
+
right: 0;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
z-index: 1000;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
.preview {
|
|
53
|
+
padding: 30px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
61
|
+
overflow: auto;
|
|
62
|
+
.current{
|
|
63
|
+
margin-top: 30px;
|
|
64
|
+
margin-bottom: 8px;
|
|
65
|
+
flex:none;
|
|
66
|
+
width:70vh;
|
|
67
|
+
height: 70vh;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
position: relative;
|
|
72
|
+
.image{
|
|
73
|
+
max-width:70vh;
|
|
74
|
+
max-height: 70vh;
|
|
75
|
+
object-fit: contain;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
.name{
|
|
79
|
+
flex: none;
|
|
80
|
+
color: #FFFFFF;
|
|
81
|
+
font-weight: var(--weight-Medium);
|
|
82
|
+
line-height: 16px;
|
|
83
|
+
padding-bottom: 24px;
|
|
84
|
+
}
|
|
85
|
+
.thumb{
|
|
86
|
+
flex: none;
|
|
87
|
+
width: 100%;
|
|
88
|
+
padding-bottom: 24px;
|
|
89
|
+
display: flex;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
column-gap: 24px;
|
|
92
|
+
overflow-x: auto;
|
|
93
|
+
.item{
|
|
94
|
+
border: 1px solid rgba(31,35,41,0.15);
|
|
95
|
+
border-radius: 4px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
.itemImage{
|
|
98
|
+
width: 45px;
|
|
99
|
+
height: 80px;
|
|
100
|
+
object-fit: cover;
|
|
101
|
+
border-radius: 4px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
.active{
|
|
105
|
+
border: 2px solid #fff;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
.close{
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: -30px;
|
|
111
|
+
right: -30px;
|
|
112
|
+
svg{
|
|
113
|
+
font-size: 24px;
|
|
114
|
+
color:rgba(255, 255, 255, 0.85)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Image,Button,Space } from '@/components/antd';
|
|
3
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
4
|
+
import Popup from '@/components/popup';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import styles from './index.module.less';
|
|
7
|
+
import { ReactRender } from '@/components/react';
|
|
8
|
+
|
|
9
|
+
const ModalPreview = (props) => {
|
|
10
|
+
const { destory,data=[] } = props;
|
|
11
|
+
const [current,setCurrent] = useState(0);
|
|
12
|
+
|
|
13
|
+
const onCancel = () => {
|
|
14
|
+
destory && destory();
|
|
15
|
+
};
|
|
16
|
+
const prePage = (e)=>{
|
|
17
|
+
e.stopPropagation();
|
|
18
|
+
if(!current) return;
|
|
19
|
+
setCurrent(current - 1);
|
|
20
|
+
}
|
|
21
|
+
const nextPage = (e)=>{
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
setCurrent(current+1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<section className={styles.main}>
|
|
29
|
+
<section className={styles.preview}>
|
|
30
|
+
<div className={styles.current}>
|
|
31
|
+
<Image
|
|
32
|
+
preview={false}
|
|
33
|
+
src={data?.[current]?.src}
|
|
34
|
+
className={styles.image}
|
|
35
|
+
/>
|
|
36
|
+
<CloseOutlined className={styles.close} onClick={onCancel} />
|
|
37
|
+
</div>
|
|
38
|
+
{data?.length > 1 && (
|
|
39
|
+
<>
|
|
40
|
+
<div className={styles.name}>{data?.[current]?.name}</div>
|
|
41
|
+
<section className={styles.thumb}>
|
|
42
|
+
{data.map((item, index) => (
|
|
43
|
+
<div
|
|
44
|
+
key={index}
|
|
45
|
+
className={`${styles.item} ${
|
|
46
|
+
current === index ? styles.active : ''
|
|
47
|
+
}`}
|
|
48
|
+
onClick={() => setCurrent(index)}
|
|
49
|
+
>
|
|
50
|
+
<Image
|
|
51
|
+
preview={false}
|
|
52
|
+
src={item?.src}
|
|
53
|
+
className={styles.itemImage}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</section>
|
|
58
|
+
<Space size={'middle'}>
|
|
59
|
+
<Button disabled={!current} onClick={prePage}>
|
|
60
|
+
上一页
|
|
61
|
+
</Button>
|
|
62
|
+
<Button
|
|
63
|
+
disabled={!(current < data?.length - 1)}
|
|
64
|
+
onClick={nextPage}
|
|
65
|
+
>
|
|
66
|
+
下一页
|
|
67
|
+
</Button>
|
|
68
|
+
</Space>
|
|
69
|
+
</>
|
|
70
|
+
)}
|
|
71
|
+
</section>
|
|
72
|
+
</section>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const ShowPreview = (props = {}) => {
|
|
77
|
+
return new Promise((resolve) => {
|
|
78
|
+
let popup = Popup(resolve);
|
|
79
|
+
ReactRender(
|
|
80
|
+
<ModalPreview destory={popup.destory} {...props} />,
|
|
81
|
+
popup.dom
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
export default ShowPreview;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import {Outlet} from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
import TopBar from '@/components/topMenu/topBar';
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import styles from './index.module.less';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 登录后的页面主体框架,定义导航栏、路由主体部分位置
|
|
13
|
+
* @param {object} props
|
|
14
|
+
* @param {JSX.Element} [props.nav] - 左侧导航栏组件
|
|
15
|
+
* @param {JSX.Element} [props.topMenu] - 顶部导航栏组件
|
|
16
|
+
*
|
|
17
|
+
* @returns {JSX.Element}
|
|
18
|
+
*/
|
|
19
|
+
const LayoutBasic=(props)=>{
|
|
20
|
+
const {nav="",topMenu=""} = props;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={styles.layout}>
|
|
24
|
+
{/* 设置站点主体最小尺寸,窗口小于该尺寸将触发滚动条 */}
|
|
25
|
+
<div className={styles.frameMinSize} >
|
|
26
|
+
|
|
27
|
+
{/* 定义站点基础框架圣杯布局 */}
|
|
28
|
+
<section className={styles.frameTop}>
|
|
29
|
+
{/* 一级导航栏 */}
|
|
30
|
+
{topMenu}
|
|
31
|
+
</section>
|
|
32
|
+
|
|
33
|
+
<section className={styles.frameBottom}>
|
|
34
|
+
<section className={styles.frameContent}>
|
|
35
|
+
{/* 二级导航栏 */}
|
|
36
|
+
{nav}
|
|
37
|
+
{/* 路由内的页面部分 */}
|
|
38
|
+
<section className={styles.framePage}>
|
|
39
|
+
<Outlet />
|
|
40
|
+
</section>
|
|
41
|
+
</section>
|
|
42
|
+
</section>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default LayoutBasic;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@import '~@/_variable.module.less';
|
|
2
|
+
@import '~@/_mixin.module.less';
|
|
3
|
+
|
|
4
|
+
.layout{
|
|
5
|
+
position: relative;
|
|
6
|
+
width:100%;
|
|
7
|
+
height:100%;
|
|
8
|
+
overflow: auto;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.frameMinSize{
|
|
12
|
+
position: relative;
|
|
13
|
+
width:100%;
|
|
14
|
+
height:100%;
|
|
15
|
+
min-width: 1200PX;
|
|
16
|
+
min-height: 600PX;
|
|
17
|
+
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.frameTop{
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: var(--topMenu-height);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
display: flex;
|
|
28
|
+
background: #1B243D;
|
|
29
|
+
}
|
|
30
|
+
.frameBottom{
|
|
31
|
+
width: 100%;
|
|
32
|
+
flex:1;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
.frameLeft{
|
|
36
|
+
height: 100%;
|
|
37
|
+
min-width: var(--nav-min-width);
|
|
38
|
+
// width:var(--nav-width);
|
|
39
|
+
z-index: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.frameRight{
|
|
43
|
+
flex:1;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
z-index: 1;
|
|
47
|
+
padding-left:6px;
|
|
48
|
+
padding-right: 6px;
|
|
49
|
+
padding-bottom: 6px;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.frameContent{
|
|
54
|
+
width:100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
display: flex;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
.framePage{
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
flex:1;
|
|
61
|
+
height:100%;
|
|
62
|
+
position: relative;
|
|
63
|
+
.hideScrollBar;
|
|
64
|
+
background-color: #F5F6FB;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
// body[data-debug-layout]{
|
|
70
|
+
// .leftWrap{
|
|
71
|
+
// border:1px solid red;
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import {Outlet,useLocation} from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
import ProviderApp from '@/provider/app';
|
|
7
|
+
import LayoutBasic from './basic/index';
|
|
8
|
+
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
import styles from './index.module.less';
|
|
11
|
+
|
|
12
|
+
import { popupList } from '@/components/popup';
|
|
13
|
+
|
|
14
|
+
import Antd5Provider from '@/components/antd/antProvider';
|
|
15
|
+
/**
|
|
16
|
+
* 页面根框架,用于注入各类provider
|
|
17
|
+
* @returns {JSX.Element}
|
|
18
|
+
*/
|
|
19
|
+
const AbsoluteLayout = () => {
|
|
20
|
+
const curLocation =useLocation();
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
popupList.destroyAll();
|
|
24
|
+
}, [curLocation]);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Antd5Provider>
|
|
28
|
+
<ProviderApp.Provider>
|
|
29
|
+
<section className={styles.absoluteLayout} >
|
|
30
|
+
<Outlet />
|
|
31
|
+
</section>
|
|
32
|
+
</ProviderApp.Provider>
|
|
33
|
+
</Antd5Provider>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export { AbsoluteLayout,LayoutBasic };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@import '~@/_variable.module.less';
|
|
2
|
+
@import '~@/_mixin.module.less';
|
|
3
|
+
|
|
4
|
+
.absoluteLayout {
|
|
5
|
+
width: 100%;
|
|
6
|
+
height:100%;
|
|
7
|
+
left:0;
|
|
8
|
+
top:0;
|
|
9
|
+
position: absolute;
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
z-index:0;
|
|
12
|
+
background:white;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
|
|
17
|
+
.app-scroll-body-pull-load-box{
|
|
18
|
+
width:100%;
|
|
19
|
+
height:100%;
|
|
20
|
+
overflow: scroll;
|
|
21
|
+
-webkit-overflow-scrolling: touch;
|
|
22
|
+
.hideScrollBar;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.app-scroll-body-pull-load{
|
|
26
|
+
height:@pullLoadHeight+PX;
|
|
27
|
+
background:#F2F5FA;
|
|
28
|
+
width:100%;
|
|
29
|
+
color:#aaa;
|
|
30
|
+
z-index:1;
|
|
31
|
+
|
|
32
|
+
position: absolute;
|
|
33
|
+
left:0;
|
|
34
|
+
top:0;
|
|
35
|
+
transform: translate3d(0,-@pullLoadHeight+PX,0);
|
|
36
|
+
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
align-items: center;
|
|
41
|
+
|
|
42
|
+
div,img{
|
|
43
|
+
// width:56*2+px;
|
|
44
|
+
max-height: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
.app-scroll-body{
|
|
49
|
+
width:100%;
|
|
50
|
+
min-height:100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
body[data-debug-layout]{
|
|
56
|
+
.layout .center{
|
|
57
|
+
border:4px solid #4366a0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { ConfigProvider } from '@/components/antd';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import {zhCN} from '@/components/antd';
|
|
7
|
+
|
|
8
|
+
import ProviderApp from '@/provider/app';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 注入AppProvider
|
|
12
|
+
*/
|
|
13
|
+
const LayoutProvider=(props)=>{
|
|
14
|
+
return (
|
|
15
|
+
<ConfigProvider locale={zhCN}>
|
|
16
|
+
<ProviderApp.Provider>
|
|
17
|
+
{props.children}
|
|
18
|
+
</ProviderApp.Provider>
|
|
19
|
+
</ConfigProvider>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const LayoutLanguage=(props)=>{
|
|
24
|
+
return (
|
|
25
|
+
<ConfigProvider locale={zhCN}>
|
|
26
|
+
{props.children}
|
|
27
|
+
</ConfigProvider>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export default LayoutProvider;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import {useNavigate,} from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import { Menu } from '@/components/antd';
|
|
8
|
+
import Badge from '@/components/badge'
|
|
9
|
+
|
|
10
|
+
import {useLoading} from '@/hooks/index';
|
|
11
|
+
import ProviderMenu from '@/provider/menu';
|
|
12
|
+
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import styles from './index.module.less';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 左侧导航栏的demo组件
|
|
22
|
+
*
|
|
23
|
+
* @returns {JSX.Element}
|
|
24
|
+
*/
|
|
25
|
+
const LeftMenu=(props)=>{
|
|
26
|
+
|
|
27
|
+
const providerMenu = ProviderMenu.useContainer();
|
|
28
|
+
const loader = useLoading();
|
|
29
|
+
const [menus,setMenus] = useState([]);
|
|
30
|
+
const nav = useNavigate();
|
|
31
|
+
const [openKeys,setOpenKeys] = useState([])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const translateMenu=(list)=>{
|
|
35
|
+
if(!list||list.length<=0)return [];
|
|
36
|
+
let req=list.map(menu=>{
|
|
37
|
+
const {key,name:label,icon,url,msgCount}=menu;
|
|
38
|
+
|
|
39
|
+
let item={
|
|
40
|
+
key,
|
|
41
|
+
label: menu.children?.length > 0 ? label: <a href={'/#'+url}>{label}</a>,
|
|
42
|
+
icon,
|
|
43
|
+
url
|
|
44
|
+
}
|
|
45
|
+
if(msgCount&&msgCount>0){
|
|
46
|
+
item.label=<span className={styles.menuLabel}>{label}
|
|
47
|
+
<Badge count={msgCount}/>
|
|
48
|
+
</span>
|
|
49
|
+
}
|
|
50
|
+
if(menu.children){
|
|
51
|
+
item.children = translateMenu(menu.children)
|
|
52
|
+
}
|
|
53
|
+
return item;
|
|
54
|
+
})
|
|
55
|
+
return req;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const onOpenChange=(keys)=>{
|
|
59
|
+
setOpenKeys(keys);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
useEffect(()=>{
|
|
63
|
+
let menuList = translateMenu(providerMenu.leftMenu);
|
|
64
|
+
setMenus(menuList);
|
|
65
|
+
},[providerMenu.leftMenu])
|
|
66
|
+
|
|
67
|
+
useEffect(()=>{
|
|
68
|
+
if(openKeys.length != providerMenu.selectMenus.keys.length){
|
|
69
|
+
setOpenKeys(providerMenu.selectMenus.keys)
|
|
70
|
+
}else{
|
|
71
|
+
let notSome= openKeys.some(key=>{
|
|
72
|
+
if( providerMenu.selectMenus.keys.includes(key) ){
|
|
73
|
+
return false;
|
|
74
|
+
}else{
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
if(notSome){
|
|
79
|
+
setOpenKeys(providerMenu.selectMenus.keys)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},[providerMenu.selectMenus.keys])
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
const onClickMenuItem=(e)=>{
|
|
86
|
+
const { item, key, keyPath, domEvent } = e;
|
|
87
|
+
let menu = providerMenu.findMenuData(key);
|
|
88
|
+
nav(menu.url);
|
|
89
|
+
}
|
|
90
|
+
if(!menus||menus.length<=0)return <></>;
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<section className={styles.nav} data-nav-hide={!menus||menus.length<=0}>
|
|
94
|
+
<Menu
|
|
95
|
+
selectedKeys={providerMenu.selectMenus.keys}
|
|
96
|
+
openKeys={openKeys}
|
|
97
|
+
onOpenChange={onOpenChange}
|
|
98
|
+
onClick={onClickMenuItem}
|
|
99
|
+
mode="inline"
|
|
100
|
+
items={loader.loading?[]:menus}
|
|
101
|
+
/>
|
|
102
|
+
</section>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default LeftMenu;
|