kn-cli 1.0.63 → 1.0.65
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/package.json +2 -1
- package/readme.md +6 -0
- package/src/create.js +2 -0
- package/templates/template_oa/public/src/components/IFrame/index.jsx +3 -0
- package/templates/template_oa/readme.md +6 -1
- package/templates/template_oa/webpack.api.js +7 -3
- package/templates/template_oa_jwt/.gitignore +6 -0
- package/templates/template_oa_jwt/build.sh +7 -0
- package/templates/template_oa_jwt/cli.config.js +30 -0
- package/templates/template_oa_jwt/dev.sh +89 -0
- package/templates/template_oa_jwt/frontend_build.sh +88 -0
- package/templates/template_oa_jwt/init/prepare-commit-msg +5 -0
- package/templates/template_oa_jwt/init.sh +33 -0
- package/templates/template_oa_jwt/jsconfig.json +10 -0
- package/templates/template_oa_jwt/package.json +25 -0
- package/templates/template_oa_jwt/public/404.html +26 -0
- package/templates/template_oa_jwt/public/favicon.ico +0 -0
- package/templates/template_oa_jwt/public/index.html +44 -0
- package/templates/template_oa_jwt/public/src/_antd.less +216 -0
- package/templates/template_oa_jwt/public/src/_reset.less +134 -0
- package/templates/template_oa_jwt/public/src/_variable.less +84 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.eot +0 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.less +57 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.svg +36 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.ttf +0 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.woff +0 -0
- package/templates/template_oa_jwt/public/src/assets/iconfont/iconfont.woff2 +0 -0
- package/templates/template_oa_jwt/public/src/assets/images/NY-pop-bg.png +0 -0
- package/templates/template_oa_jwt/public/src/assets/images/avatar.png +0 -0
- package/templates/template_oa_jwt/public/src/assets/images/loading.svg +40 -0
- package/templates/template_oa_jwt/public/src/components/Alert/index.jsx +0 -0
- package/templates/template_oa_jwt/public/src/components/Alert/index.less +0 -0
- package/templates/template_oa_jwt/public/src/components/Auth/index.jsx +44 -0
- package/templates/template_oa_jwt/public/src/components/Dialog/index.jsx +150 -0
- package/templates/template_oa_jwt/public/src/components/Dialog/index.less +123 -0
- package/templates/template_oa_jwt/public/src/components/Empty/index.jsx +23 -0
- package/templates/template_oa_jwt/public/src/components/Empty/index.less +6 -0
- package/templates/template_oa_jwt/public/src/components/Footer/index.jsx +17 -0
- package/templates/template_oa_jwt/public/src/components/Footer/index.less +28 -0
- package/templates/template_oa_jwt/public/src/components/FormRow/index.jsx +39 -0
- package/templates/template_oa_jwt/public/src/components/FormRow/index.less +67 -0
- package/templates/template_oa_jwt/public/src/components/FormTable/index.jsx +137 -0
- package/templates/template_oa_jwt/public/src/components/FormTable/index.less +18 -0
- package/templates/template_oa_jwt/public/src/components/IFrame/index.jsx +44 -0
- package/templates/template_oa_jwt/public/src/components/IFrame/index.less +4 -0
- package/templates/template_oa_jwt/public/src/components/IconFont/index.jsx +10 -0
- package/templates/template_oa_jwt/public/src/components/IconFont/index.less +5 -0
- package/templates/template_oa_jwt/public/src/components/Layout/Basic/index.jsx +52 -0
- package/templates/template_oa_jwt/public/src/components/Layout/Basic/index.less +82 -0
- package/templates/template_oa_jwt/public/src/components/Layout/CenterBody/index.jsx +15 -0
- package/templates/template_oa_jwt/public/src/components/Layout/CenterBody/index.less +36 -0
- package/templates/template_oa_jwt/public/src/components/Layout/FormBlock/index.jsx +23 -0
- package/templates/template_oa_jwt/public/src/components/Layout/FormBlock/index.less +37 -0
- package/templates/template_oa_jwt/public/src/components/Layout/Provider/index.jsx +12 -0
- package/templates/template_oa_jwt/public/src/components/Layout/index.jsx +27 -0
- package/templates/template_oa_jwt/public/src/components/Layout/index.less +8 -0
- package/templates/template_oa_jwt/public/src/components/Link/index.jsx +24 -0
- package/templates/template_oa_jwt/public/src/components/Link/index.less +11 -0
- package/templates/template_oa_jwt/public/src/components/Loading/index.jsx +16 -0
- package/templates/template_oa_jwt/public/src/components/Loading/index.less +96 -0
- package/templates/template_oa_jwt/public/src/components/Nav/index.jsx +184 -0
- package/templates/template_oa_jwt/public/src/components/Nav/index.less +38 -0
- package/templates/template_oa_jwt/public/src/components/Page/PageLoading/index.jsx +30 -0
- package/templates/template_oa_jwt/public/src/components/Page/PageLoading/index.less +29 -0
- package/templates/template_oa_jwt/public/src/components/Popup/index.jsx +22 -0
- package/templates/template_oa_jwt/public/src/components/Popup/index.less +18 -0
- package/templates/template_oa_jwt/public/src/components/Select/DepSelect/index.jsx +47 -0
- package/templates/template_oa_jwt/public/src/components/Select/StaffSelect/index.jsx +97 -0
- package/templates/template_oa_jwt/public/src/components/Select/StaffSelect/index.less +24 -0
- package/templates/template_oa_jwt/public/src/components/Toast/index.jsx +60 -0
- package/templates/template_oa_jwt/public/src/components/Toast/index.less +43 -0
- package/templates/template_oa_jwt/public/src/components/Upload/index.jsx +358 -0
- package/templates/template_oa_jwt/public/src/components/title/index.jsx +12 -0
- package/templates/template_oa_jwt/public/src/components/title/index.less +21 -0
- package/templates/template_oa_jwt/public/src/dictionary/index.js +20 -0
- package/templates/template_oa_jwt/public/src/hooks/index.jsx +21 -0
- package/templates/template_oa_jwt/public/src/hooks/useDelay.jsx +29 -0
- package/templates/template_oa_jwt/public/src/hooks/useImageLoader.jsx +27 -0
- package/templates/template_oa_jwt/public/src/hooks/useLoading.jsx +42 -0
- package/templates/template_oa_jwt/public/src/hooks/useLogin.jsx +33 -0
- package/templates/template_oa_jwt/public/src/hooks/usePreload.jsx +66 -0
- package/templates/template_oa_jwt/public/src/hooks/useScrollTop.jsx +32 -0
- package/templates/template_oa_jwt/public/src/hooks/useSearch.jsx +137 -0
- package/templates/template_oa_jwt/public/src/hooks/useUpdate.jsx +11 -0
- package/templates/template_oa_jwt/public/src/index.jsx +50 -0
- package/templates/template_oa_jwt/public/src/mock/common.js +484 -0
- package/templates/template_oa_jwt/public/src/mock/index.js +63 -0
- package/templates/template_oa_jwt/public/src/mock/user.js +70 -0
- package/templates/template_oa_jwt/public/src/mock/utils.js +33 -0
- package/templates/template_oa_jwt/public/src/pages/components/pageTitle/index.jsx +13 -0
- package/templates/template_oa_jwt/public/src/pages/components/pageTitle/index.less +20 -0
- package/templates/template_oa_jwt/public/src/pages/components/totalRecord/index.jsx +21 -0
- package/templates/template_oa_jwt/public/src/pages/components/totalRecord/index.less +16 -0
- package/templates/template_oa_jwt/public/src/pages/demo/detail/index.jsx +14 -0
- package/templates/template_oa_jwt/public/src/pages/demo/index.jsx +399 -0
- package/templates/template_oa_jwt/public/src/pages/demo/index.less +15 -0
- package/templates/template_oa_jwt/public/src/pages/login/index.jsx +29 -0
- package/templates/template_oa_jwt/public/src/pages/login/index.less +44 -0
- package/templates/template_oa_jwt/public/src/pages/redirect/index.jsx +31 -0
- package/templates/template_oa_jwt/public/src/provider/app.jsx +66 -0
- package/templates/template_oa_jwt/public/src/route.jsx +45 -0
- package/templates/template_oa_jwt/public/src/services/common.js +133 -0
- package/templates/template_oa_jwt/public/src/services/demo.js +41 -0
- package/templates/template_oa_jwt/public/src/services/index.js +266 -0
- package/templates/template_oa_jwt/public/src/services/token.js +132 -0
- package/templates/template_oa_jwt/public/src/utils/index.js +115 -0
- package/templates/template_oa_jwt/public/static/about.html +1 -0
- package/templates/template_oa_jwt/public/static/kssoLogin.html +22 -0
- package/templates/template_oa_jwt/public/static/noAuth.html +217 -0
- package/templates/template_oa_jwt/public/static/noAuth.png +0 -0
- package/templates/template_oa_jwt/readme.md +71 -0
- package/templates/template_oa_jwt/report.sh +68 -0
- package/templates/template_oa_jwt/tools/iconfont/gulpfile.js +70 -0
- package/templates/template_oa_jwt/tools/iconfont/package.json +20 -0
- package/templates/template_oa_jwt/tools/iconfont/run.sh +39 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/arrowBack.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/check.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/close.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/down.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/image.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/play.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/refresh.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/svg/warn.svg +1 -0
- package/templates/template_oa_jwt/tools/iconfont/templates/_icons.css +26 -0
- package/templates/template_oa_jwt/tools/iconfont/templates/_icons.less +29 -0
- package/templates/template_oa_jwt/tools/iconfont/templates/index.html +56 -0
- package/templates/template_oa_jwt/tools/tinypng/package.json +11 -0
- package/templates/template_oa_jwt/tools/tinypng/run.sh +15 -0
- package/templates/template_oa_jwt/versionPublish.sh +27 -0
- package/templates/template_oa_jwt/webpack.api.js +61 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@import '~@/_variable.less';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.contentBody{
|
|
5
|
+
width:100%;
|
|
6
|
+
height:100%;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
overflow: scroll;
|
|
9
|
+
-webkit-overflow-scrolling: touch;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
&[data-layout='xy-center']{
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
&[data-layout='x-center']{
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
flex-wrap: wrap;
|
|
23
|
+
}
|
|
24
|
+
&[data-layout='y-center']{
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
body[data-debug-layout]{
|
|
32
|
+
.contentBody{
|
|
33
|
+
border:1px solid red;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './index.less';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export const FormBlockByTitle = (props) => {
|
|
7
|
+
const {className=''}=props;
|
|
8
|
+
return (
|
|
9
|
+
<section id={props.title} className={`${styles.blockByTitle} ${className}`}>
|
|
10
|
+
{props.title || props.rightBtns ? (
|
|
11
|
+
<div className={styles.titleLine}>
|
|
12
|
+
<div>{props.title ? <div className={styles.title}>{props.title}</div> : ''}</div>
|
|
13
|
+
<div className={styles.rightBtns}>{props.rightBtns}</div>
|
|
14
|
+
</div>
|
|
15
|
+
) : (
|
|
16
|
+
<div className={styles.titleNone} />
|
|
17
|
+
)}
|
|
18
|
+
{props.children}
|
|
19
|
+
</section>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default FormBlockByTitle;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
.blockByTitle {
|
|
3
|
+
border: 1px solid #eaeaea;
|
|
4
|
+
padding: 0 19px 15px;
|
|
5
|
+
background: white;
|
|
6
|
+
border-radius: 3px;
|
|
7
|
+
margin-bottom: 20px;
|
|
8
|
+
&:last-child {
|
|
9
|
+
margin-bottom: 0;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
.titleLine {
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 50px;
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
}
|
|
18
|
+
.title {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
height: 26px;
|
|
23
|
+
min-width: 78px;
|
|
24
|
+
padding: 0 6px;
|
|
25
|
+
color: #fffefe;
|
|
26
|
+
border-radius: 0 0 4px 4px;
|
|
27
|
+
background-color: #2a96fc;
|
|
28
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
29
|
+
}
|
|
30
|
+
.titleNone{
|
|
31
|
+
height: 15px;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.rightBtns{
|
|
36
|
+
margin-top: 10px;
|
|
37
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Outlet} from 'react-router-dom';
|
|
3
|
+
import ProviderApp from '@/provider/app';
|
|
4
|
+
|
|
5
|
+
const LayoutProvider=(props)=>{
|
|
6
|
+
return (
|
|
7
|
+
<ProviderApp.Provider>
|
|
8
|
+
<Outlet />
|
|
9
|
+
</ProviderApp.Provider>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
export default LayoutProvider;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ProviderApp from '@/provider/app';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import {Outlet} from 'react-router-dom';
|
|
6
|
+
import { ConfigProvider } from 'antd';
|
|
7
|
+
import LayoutBasic from './Basic';
|
|
8
|
+
import LayoutCenterBody from './CenterBody';
|
|
9
|
+
import zhCN from 'antd/lib/locale/zh_CN';
|
|
10
|
+
|
|
11
|
+
import styles from './index.less';
|
|
12
|
+
styles;
|
|
13
|
+
|
|
14
|
+
// 站点最基础的layout,用于控制一些全局环境变量
|
|
15
|
+
const Layout = (props) => {
|
|
16
|
+
return (
|
|
17
|
+
<ProviderApp.Provider>
|
|
18
|
+
<ConfigProvider locale={zhCN} autoInsertSpaceInButton={false}>
|
|
19
|
+
<Outlet />
|
|
20
|
+
</ConfigProvider>
|
|
21
|
+
</ProviderApp.Provider>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export { Layout,LayoutCenterBody,LayoutBasic };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { openLink,jumpUrl } from '@/utils';
|
|
3
|
+
import styles from './index.less';
|
|
4
|
+
|
|
5
|
+
const Link=(props)=>{
|
|
6
|
+
const {children,className='',onClick,href='',target=''} = props;
|
|
7
|
+
|
|
8
|
+
const onLink=()=>{
|
|
9
|
+
if(href){
|
|
10
|
+
if(target=='_blank'){
|
|
11
|
+
openLink(href);
|
|
12
|
+
// window.open(href);
|
|
13
|
+
}else{
|
|
14
|
+
jumpUrl(href);
|
|
15
|
+
}
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if(onClick)onClick();
|
|
19
|
+
}
|
|
20
|
+
return (
|
|
21
|
+
<span onClick={onLink} className={`${styles.linkWrap} ${className}`}>{children}</span>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
export default React.memo(Link);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React,{useMemo} from 'react';
|
|
4
|
+
import styles from './index.less';
|
|
5
|
+
styles;
|
|
6
|
+
export const Loading=()=>{
|
|
7
|
+
return (
|
|
8
|
+
<div className='loading-container'>
|
|
9
|
+
<div className="ldio-2oha7mxue8v">
|
|
10
|
+
<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default React.memo(Loading);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
|
|
2
|
+
:global{
|
|
3
|
+
@color:#000;
|
|
4
|
+
@keyframes ldio-2oha7mxue8v {
|
|
5
|
+
0% { opacity: 1 }
|
|
6
|
+
100% { opacity: 0 }
|
|
7
|
+
}
|
|
8
|
+
.ldio-2oha7mxue8v div:local {
|
|
9
|
+
left:0px;
|
|
10
|
+
top:0px;
|
|
11
|
+
position: absolute;
|
|
12
|
+
animation: ldio-2oha7mxue8v linear 1s infinite;
|
|
13
|
+
background: @color;
|
|
14
|
+
width: 12px;
|
|
15
|
+
height: 24px;
|
|
16
|
+
border-radius: 6px / 12px;
|
|
17
|
+
transform-origin: 40px 40px;
|
|
18
|
+
}
|
|
19
|
+
.ldio-2oha7mxue8v div:nth-child(1) {
|
|
20
|
+
transform: rotate(0deg);
|
|
21
|
+
animation-delay: -0.9166666666666666s;
|
|
22
|
+
background: @color;
|
|
23
|
+
}.ldio-2oha7mxue8v div:nth-child(2) {
|
|
24
|
+
transform: rotate(30deg);
|
|
25
|
+
animation-delay: -0.8333333333333334s;
|
|
26
|
+
background: @color;
|
|
27
|
+
}.ldio-2oha7mxue8v div:nth-child(3) {
|
|
28
|
+
transform: rotate(60deg);
|
|
29
|
+
animation-delay: -0.75s;
|
|
30
|
+
background: @color;
|
|
31
|
+
}.ldio-2oha7mxue8v div:nth-child(4) {
|
|
32
|
+
transform: rotate(90deg);
|
|
33
|
+
animation-delay: -0.6666666666666666s;
|
|
34
|
+
background: @color;
|
|
35
|
+
}.ldio-2oha7mxue8v div:nth-child(5) {
|
|
36
|
+
transform: rotate(120deg);
|
|
37
|
+
animation-delay: -0.5833333333333334s;
|
|
38
|
+
background: @color;
|
|
39
|
+
}.ldio-2oha7mxue8v div:nth-child(6) {
|
|
40
|
+
transform: rotate(150deg);
|
|
41
|
+
animation-delay: -0.5s;
|
|
42
|
+
background: @color;
|
|
43
|
+
}.ldio-2oha7mxue8v div:nth-child(7) {
|
|
44
|
+
transform: rotate(180deg);
|
|
45
|
+
animation-delay: -0.4166666666666667s;
|
|
46
|
+
background: @color;
|
|
47
|
+
}.ldio-2oha7mxue8v div:nth-child(8) {
|
|
48
|
+
transform: rotate(210deg);
|
|
49
|
+
animation-delay: -0.3333333333333333s;
|
|
50
|
+
background: @color;
|
|
51
|
+
}.ldio-2oha7mxue8v div:nth-child(9) {
|
|
52
|
+
transform: rotate(240deg);
|
|
53
|
+
animation-delay: -0.25s;
|
|
54
|
+
background: @color;
|
|
55
|
+
}.ldio-2oha7mxue8v div:nth-child(10) {
|
|
56
|
+
transform: rotate(270deg);
|
|
57
|
+
animation-delay: -0.16666666666666666s;
|
|
58
|
+
background: @color;
|
|
59
|
+
}.ldio-2oha7mxue8v div:nth-child(11) {
|
|
60
|
+
transform: rotate(300deg);
|
|
61
|
+
animation-delay: -0.08333333333333333s;
|
|
62
|
+
background: @color;
|
|
63
|
+
}.ldio-2oha7mxue8v div:nth-child(12) {
|
|
64
|
+
transform: rotate(330deg);
|
|
65
|
+
animation-delay: 0s;
|
|
66
|
+
background: @color;
|
|
67
|
+
}
|
|
68
|
+
.loadingio-spinner-spinner-vviroavveu {
|
|
69
|
+
width: 200px;
|
|
70
|
+
height: 200px;
|
|
71
|
+
display: inline-block;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
background: transparent;
|
|
74
|
+
}
|
|
75
|
+
.ldio-2oha7mxue8v {
|
|
76
|
+
width: 80px;
|
|
77
|
+
height: 80px;
|
|
78
|
+
position: absolute;
|
|
79
|
+
transform: translateZ(0) scale(0.5) translate(-50%, 0);
|
|
80
|
+
backface-visibility: hidden;
|
|
81
|
+
transform-origin: 0 0; /* see note above */
|
|
82
|
+
top: 200px;
|
|
83
|
+
left: 50%;
|
|
84
|
+
z-index: 99999;
|
|
85
|
+
}
|
|
86
|
+
.loading-container {
|
|
87
|
+
position: fixed;
|
|
88
|
+
top: 0;
|
|
89
|
+
left: 0;
|
|
90
|
+
width: 100vw;
|
|
91
|
+
height: 100vh;
|
|
92
|
+
z-index: 99999;
|
|
93
|
+
}
|
|
94
|
+
.ldio-2oha7mxue8v div { box-sizing: content-box; }
|
|
95
|
+
/* generated by https://loading.io/ */
|
|
96
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Menu } from 'antd';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import {matchPath,useLocation,useNavigate,} from 'react-router-dom';
|
|
4
|
+
import { AppstoreOutlined, MailOutlined, SettingOutlined } from '@ant-design/icons';
|
|
5
|
+
import {useLoading} from '@/hooks';
|
|
6
|
+
|
|
7
|
+
import styles from './index.less';
|
|
8
|
+
|
|
9
|
+
const ICON_NAME={
|
|
10
|
+
'AppstoreOutlined':<AppstoreOutlined />,
|
|
11
|
+
'MailOutlined':<MailOutlined />,
|
|
12
|
+
'SettingOutlined':<SettingOutlined />,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const SUB_MENU_CONFIG=[
|
|
17
|
+
{
|
|
18
|
+
path:'/',//匹配菜单路由是/video的菜单
|
|
19
|
+
// routeTemplate:''匹配某个模板菜单的模板
|
|
20
|
+
subRoute:[
|
|
21
|
+
{
|
|
22
|
+
path:'/detail',//将video/detail这个路由匹配给菜单/video
|
|
23
|
+
// routeTemplate:''//也可以将某个路由模板匹配给某个菜单
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
const MenuRoute=[
|
|
30
|
+
{
|
|
31
|
+
label:'内容管理',
|
|
32
|
+
icon:'AppstoreOutlined',
|
|
33
|
+
children:[
|
|
34
|
+
{label:'剧集管理',path:'/'},
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label:'用户中心',
|
|
39
|
+
icon:'CustomerServiceOutlined',
|
|
40
|
+
path:'/my'
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
const LeftMenu=(props)=>{
|
|
45
|
+
|
|
46
|
+
const loader = useLoading();
|
|
47
|
+
const [menus,setMenus] = useState([]);
|
|
48
|
+
const [openKeys,setOpenKeys] = useState([]);
|
|
49
|
+
const [selectedKeys,setSelectKeys] = useState([]);
|
|
50
|
+
const curRoute = useLocation();
|
|
51
|
+
const nav = useNavigate();
|
|
52
|
+
|
|
53
|
+
const MENU_KEY_COUNTER=useRef(1);
|
|
54
|
+
const MENU_KEY=useRef({});
|
|
55
|
+
|
|
56
|
+
const getSubConfig=(menu)=>{
|
|
57
|
+
const {path,routeTemplate}= menu;
|
|
58
|
+
for(let i=0;i<SUB_MENU_CONFIG.length;i++){
|
|
59
|
+
let sub= SUB_MENU_CONFIG[i];
|
|
60
|
+
if(routeTemplate&&sub.routeTemplate&&routeTemplate==sub.routeTemplate){
|
|
61
|
+
return sub.subRoute;
|
|
62
|
+
}
|
|
63
|
+
if(path&&sub.path&&path==sub.path){
|
|
64
|
+
return sub.subRoute;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const translateMenu=(data={},parent)=>{
|
|
71
|
+
const {label,icon,children,path}= data;
|
|
72
|
+
let myKey = `${MENU_KEY_COUNTER.current}`
|
|
73
|
+
let item ={
|
|
74
|
+
key:myKey,
|
|
75
|
+
label,
|
|
76
|
+
source:data,
|
|
77
|
+
path,
|
|
78
|
+
routepath:parent?`${parent.key}-${myKey}`:myKey
|
|
79
|
+
}
|
|
80
|
+
MENU_KEY.current[myKey] = item;
|
|
81
|
+
MENU_KEY_COUNTER.current++;
|
|
82
|
+
if(icon){
|
|
83
|
+
item.icon= ICON_NAME[icon];
|
|
84
|
+
}
|
|
85
|
+
let subRoute= getSubConfig(data);
|
|
86
|
+
item.source.subRoute= subRoute;
|
|
87
|
+
if(children){
|
|
88
|
+
item.children = children.map(childData=>{
|
|
89
|
+
return translateMenu(childData,item)
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
return item;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
window.matchPath=matchPath;
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const GET_ROUTE_MENU=(menuList)=>{
|
|
100
|
+
let groupKeys=[];
|
|
101
|
+
for(let key in menuList){
|
|
102
|
+
const menuItem = menuList[key];
|
|
103
|
+
const {path,routeTemplate,subRoute}= menuItem.source;
|
|
104
|
+
if(path){
|
|
105
|
+
let fn = matchPath;
|
|
106
|
+
let match= fn(routeTemplate||path,curRoute.pathname);
|
|
107
|
+
if(!match&&subRoute){
|
|
108
|
+
match= subRoute.some(sub=>{
|
|
109
|
+
let subMatch= fn(sub.routeTemplate||sub.path,curRoute.pathname);
|
|
110
|
+
if(subMatch){
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
if(match){
|
|
117
|
+
groupKeys = menuItem.routepath?menuItem.routepath.split('-'):'';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return groupKeys;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const loadMenu= async ()=>{
|
|
125
|
+
loader.setLoading(true);
|
|
126
|
+
// const req= await GET_LEFT_MENU();
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
const req= {code:0,info:MenuRoute}
|
|
130
|
+
if(req.info){
|
|
131
|
+
const menuList= req.info.map(menu=>{
|
|
132
|
+
return translateMenu(menu)
|
|
133
|
+
})
|
|
134
|
+
setMenus(menuList);
|
|
135
|
+
}else{
|
|
136
|
+
setMenus([]);
|
|
137
|
+
}
|
|
138
|
+
loader.setLoading(false);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
useEffect(()=>{
|
|
142
|
+
loadMenu();
|
|
143
|
+
},[])
|
|
144
|
+
|
|
145
|
+
useEffect(()=>{
|
|
146
|
+
let groupKeys= GET_ROUTE_MENU(MENU_KEY.current);
|
|
147
|
+
setOpenKeys(groupKeys);
|
|
148
|
+
let selectKey =groupKeys[groupKeys.length-1];
|
|
149
|
+
setSelectKeys([selectKey])
|
|
150
|
+
},[curRoute,menus]);
|
|
151
|
+
|
|
152
|
+
const onClickMenuItem=(e)=>{
|
|
153
|
+
const { item, key, keyPath, domEvent } = e;
|
|
154
|
+
const menuData = MENU_KEY.current[key];
|
|
155
|
+
if(menuData.path){
|
|
156
|
+
nav(menuData.path);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const onOpenChange=(keys)=>{
|
|
160
|
+
setOpenKeys(keys);
|
|
161
|
+
}
|
|
162
|
+
return (
|
|
163
|
+
<section
|
|
164
|
+
className={styles.wrap}
|
|
165
|
+
>
|
|
166
|
+
|
|
167
|
+
<Menu
|
|
168
|
+
selectedKeys={selectedKeys}
|
|
169
|
+
className={styles.nav}
|
|
170
|
+
openKeys={openKeys}
|
|
171
|
+
onOpenChange={onOpenChange}
|
|
172
|
+
onClick={onClickMenuItem}
|
|
173
|
+
mode="inline"
|
|
174
|
+
items={loader.loading?[]:menus}
|
|
175
|
+
/>
|
|
176
|
+
|
|
177
|
+
</section>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export default LeftMenu;
|
|
184
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@import '~@/_variable.less';
|
|
2
|
+
|
|
3
|
+
.wrap{
|
|
4
|
+
display: flex;
|
|
5
|
+
background:white;
|
|
6
|
+
margin-bottom: 20px;;
|
|
7
|
+
width: 160px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.nav{
|
|
11
|
+
width: 160px;
|
|
12
|
+
padding: 20px 0px;
|
|
13
|
+
height:100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
overflow-y: auto;
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.loadingWrap{
|
|
20
|
+
padding:60px;
|
|
21
|
+
width: 130px;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
.contentWrap{
|
|
27
|
+
flex:1;
|
|
28
|
+
min-width: var(--min-width);
|
|
29
|
+
padding:10px;
|
|
30
|
+
overflow: auto;
|
|
31
|
+
}
|
|
32
|
+
.titleBar{
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
align-items: center;
|
|
36
|
+
padding-bottom: 10px;
|
|
37
|
+
border-bottom: 1px solid #e8e8e8;
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React,{useEffect, useState} from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import CSS from './index.less';
|
|
4
|
+
import Popup from '@/components/Popup';
|
|
5
|
+
import imgLoading from '@/assets/images/loading.svg';
|
|
6
|
+
|
|
7
|
+
const PageLoading = (props) => {
|
|
8
|
+
const {visible=true} = props;
|
|
9
|
+
if(!visible){
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
return (
|
|
13
|
+
<div className={CSS.wrap } >
|
|
14
|
+
<div className={CSS.box} data-show={visible}>
|
|
15
|
+
<img src={imgLoading} />
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const ShowPageLoading=(props={canTouch:false})=>{
|
|
22
|
+
let popup = Popup(()=>{},{cantouch:props.canTouch});
|
|
23
|
+
ReactDOM.render(
|
|
24
|
+
<PageLoading visible={true} />,
|
|
25
|
+
popup.dom
|
|
26
|
+
);
|
|
27
|
+
return popup.destory;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default React.memo(PageLoading);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.wrap {
|
|
2
|
+
position: fixed;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
left: 0;
|
|
6
|
+
top: 0;
|
|
7
|
+
z-index: 99;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.box {
|
|
14
|
+
|
|
15
|
+
width: 80px;
|
|
16
|
+
height: 80px;
|
|
17
|
+
background: rgba(0,0,0,.3);
|
|
18
|
+
border-radius: 12px;
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
img{
|
|
23
|
+
display: block;
|
|
24
|
+
width:80%;
|
|
25
|
+
}
|
|
26
|
+
&[data-show=false]{
|
|
27
|
+
opacity: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import styles from './index.less';
|
|
4
|
+
styles;
|
|
5
|
+
|
|
6
|
+
const Popup = (reslove,options) => {
|
|
7
|
+
let rootDom = document.createElement('div');
|
|
8
|
+
rootDom.className='popup-box';
|
|
9
|
+
if(options&&options.cantouch)rootDom.setAttribute('data-can-touch','1');
|
|
10
|
+
if(options&&options.transparent)rootDom.setAttribute('data-transparent','1');
|
|
11
|
+
|
|
12
|
+
let destory = (result) => {
|
|
13
|
+
ReactDOM.unmountComponentAtNode(rootDom);
|
|
14
|
+
rootDom.parentNode.removeChild(rootDom);
|
|
15
|
+
if (reslove) reslove(result);
|
|
16
|
+
};
|
|
17
|
+
document.body.appendChild(rootDom);
|
|
18
|
+
return { dom: rootDom, destory };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export default Popup;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Select } from 'antd';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 所属部门选择器
|
|
6
|
+
*/
|
|
7
|
+
function DepSelect(props) {
|
|
8
|
+
const [value, setValue] = useState(props?.value || '');
|
|
9
|
+
const [list] = useState(props.list || null);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (props?.value) setValue(props.value);
|
|
13
|
+
}, [value]);
|
|
14
|
+
|
|
15
|
+
function filterOption(inputValue, option) {
|
|
16
|
+
if (option.data.ORG_NAME && option.data.ORG_NAME.toLocaleLowerCase().includes(inputValue.toLocaleLowerCase())) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
function onChange(options, selected) {
|
|
23
|
+
setValue(options);
|
|
24
|
+
if (props.onChange) props.onChange(options, selected);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Select
|
|
29
|
+
value={`${value}`}
|
|
30
|
+
loading={!list}
|
|
31
|
+
style={{ width: '100%' }}
|
|
32
|
+
onChange={onChange}
|
|
33
|
+
showSearch
|
|
34
|
+
filterOption={filterOption}
|
|
35
|
+
>
|
|
36
|
+
{list?.map((item) => {
|
|
37
|
+
return (
|
|
38
|
+
<Select.Option data={item} key={item.ORG_ID} value={`${item.ORG_ID}`}>
|
|
39
|
+
{item.ORG_NAME}
|
|
40
|
+
</Select.Option>
|
|
41
|
+
);
|
|
42
|
+
})}
|
|
43
|
+
</Select>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default DepSelect;
|