kn-cli 1.0.97 → 1.0.98
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 +1 -1
- package/templates/template_admin/cli.config.js +4 -1
- package/templates/template_admin/package.json +7 -1
- package/templates/template_admin/public/favicon.png +0 -0
- package/templates/template_admin/public/index.html +6 -4
- package/templates/template_admin/public/src/_antd.less +30 -3
- package/templates/template_admin/public/src/_mixin.less +41 -0
- package/templates/template_admin/public/src/_reset.less +28 -20
- package/templates/template_admin/public/src/_variable.less +11 -6
- package/templates/template_admin/public/src/assets/iconfont/iconfont.eot +0 -0
- package/templates/template_admin/public/src/assets/iconfont/iconfont.less +60 -8
- package/templates/template_admin/public/src/assets/iconfont/iconfont.svg +57 -18
- package/templates/template_admin/public/src/assets/iconfont/iconfont.ttf +0 -0
- package/templates/template_admin/public/src/assets/iconfont/iconfont.woff +0 -0
- package/templates/template_admin/public/src/assets/iconfont/iconfont.woff2 +0 -0
- package/templates/template_admin/public/src/assets/images/arrow.png +0 -0
- package/templates/template_admin/public/src/assets/images/icon-notice.png +0 -0
- package/templates/template_admin/public/src/assets/images/icon-user.png +0 -0
- package/templates/template_admin/public/src/assets/images/loadFail.png +0 -0
- package/templates/template_admin/public/src/assets/images/login/bg.png +0 -0
- package/templates/template_admin/public/src/assets/images/login/logo.png +0 -0
- package/templates/template_admin/public/src/assets/images/login/slogan.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-dep-active.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-dep.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-log-active.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-log.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-loginlog-active.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-loginlog.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-role-active.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-role.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-user-active.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/icon-user.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/nav-toggle.png +0 -0
- package/templates/template_admin/public/src/assets/images/nav/slogan.png +0 -0
- package/templates/template_admin/public/src/assets/images/noData.png +0 -0
- package/templates/template_admin/public/src/assets/images/noSelect.png +0 -0
- package/templates/template_admin/public/src/components/auth/index.jsx +7 -3
- package/templates/template_admin/public/src/components/auth/index.less +7 -0
- package/templates/template_admin/public/src/components/badge/index.jsx +47 -0
- package/templates/template_admin/public/src/components/badge/index.less +44 -0
- package/templates/template_admin/public/src/components/debug/index.jsx +27 -0
- package/templates/template_admin/public/src/components/debug/index.less +9 -0
- package/templates/template_admin/public/src/components/empty/index.jsx +28 -0
- package/templates/template_admin/public/src/components/empty/index.less +20 -0
- package/templates/template_admin/public/src/components/image/index.jsx +73 -0
- package/templates/template_admin/public/src/components/image/index.less +117 -0
- package/templates/template_admin/public/src/components/image/preview.jsx +85 -0
- package/templates/template_admin/public/src/components/layout/basic/index.jsx +24 -11
- package/templates/template_admin/public/src/components/layout/basic/index.less +58 -19
- package/templates/template_admin/public/src/components/layout/index.jsx +20 -17
- package/templates/template_admin/public/src/components/layout/index.less +4 -4
- package/templates/template_admin/public/src/components/layout/provider/index.jsx +19 -6
- package/templates/template_admin/public/src/components/{menu → leftMenu}/index.jsx +20 -28
- package/templates/template_admin/public/src/components/leftMenu/index.less +42 -0
- package/templates/template_admin/public/src/components/popup/index.jsx +25 -0
- package/templates/template_admin/public/src/components/table/column.jsx +47 -0
- package/templates/template_admin/public/src/components/table/column.less +12 -0
- package/templates/template_admin/public/src/components/table/index.jsx +22 -13
- package/templates/template_admin/public/src/components/table/index.less +15 -0
- package/templates/template_admin/public/src/components/text/index.jsx +98 -0
- package/templates/template_admin/public/src/components/text/index.less +13 -0
- package/templates/template_admin/public/src/components/topMenu/index.jsx +97 -0
- package/templates/template_admin/public/src/components/topMenu/index.less +80 -0
- package/templates/template_admin/public/src/components/topMenu/topBar/index.jsx +76 -0
- package/templates/template_admin/public/src/components/topMenu/topBar/index.less +88 -0
- package/templates/template_admin/public/src/components/video/index.jsx +96 -0
- package/templates/template_admin/public/src/components/video/index.less +132 -0
- package/templates/template_admin/public/src/components/video/preview.jsx +38 -0
- package/templates/template_admin/public/src/dictionary/index.js +108 -39
- package/templates/template_admin/public/src/enum.js +41 -0
- package/templates/template_admin/public/src/hooks/index.jsx +8 -6
- package/templates/template_admin/public/src/hooks/useDebounceFn.jsx +33 -0
- package/templates/template_admin/public/src/hooks/useInToView.jsx +58 -0
- package/templates/template_admin/public/src/hooks/useRouteMenu.jsx +37 -28
- package/templates/template_admin/public/src/hooks/useTimer.jsx +42 -0
- package/templates/template_admin/public/src/index.jsx +10 -7
- package/templates/template_admin/public/src/mock/auth.js +33 -0
- package/templates/template_admin/public/src/mock/demo.js +12 -74
- package/templates/template_admin/public/src/mock/index.js +1 -0
- package/templates/template_admin/public/src/pages/auth/user/create/index.jsx +55 -0
- package/templates/template_admin/public/src/pages/auth/user/create/index.less +6 -0
- package/templates/template_admin/public/src/pages/auth/user/dialog/index.jsx +96 -0
- package/templates/template_admin/public/src/pages/auth/user/index.jsx +271 -0
- package/templates/template_admin/public/src/pages/components/layout/index.jsx +75 -0
- package/templates/template_admin/public/src/pages/components/layout/index.less +78 -0
- package/templates/template_admin/public/src/pages/components/layout/titleBar/index.jsx +28 -0
- package/templates/template_admin/public/src/pages/components/layout/titleBar/index.less +44 -0
- package/templates/template_admin/public/src/pages/components/select/account/index.jsx +114 -0
- package/templates/template_admin/public/src/pages/components/select/device/index.jsx +83 -0
- package/templates/template_admin/public/src/pages/components/select/groupUser/index.jsx +172 -0
- package/templates/template_admin/public/src/pages/components/select/user/index.jsx +119 -0
- package/templates/template_admin/public/src/pages/home.jsx +79 -0
- package/templates/template_admin/public/src/pages/home.less +6 -0
- package/templates/template_admin/public/src/pages/login/index.jsx +90 -6
- package/templates/template_admin/public/src/pages/login/index.less +133 -24
- package/templates/template_admin/public/src/provider/app.jsx +72 -66
- package/templates/template_admin/public/src/provider/loading.jsx +47 -0
- package/templates/template_admin/public/src/provider/menu.jsx +117 -83
- package/templates/template_admin/public/src/provider/menu.less +35 -0
- package/templates/template_admin/public/src/route.jsx +41 -40
- package/templates/template_admin/public/src/services/auth.js +39 -0
- package/templates/template_admin/public/src/services/demo.js +3 -37
- package/templates/template_admin/public/src/services/index.js +139 -13
- package/templates/template_admin/public/src/services/login.js +37 -0
- package/templates/template_admin/public/src/services/socket/index.jsx +100 -0
- package/templates/template_admin/public/src/type.js +36 -19
- package/templates/template_admin/public/src/utils/event.js +58 -0
- package/templates/template_admin/public/src/utils/format.js +84 -0
- package/templates/template_admin/public/src/utils/index.js +214 -2
- package/templates/template_admin/public/src/utils/rule.js +3 -0
- package/templates/template_admin/public/static/kssoLogin.html +1 -1
- package/templates/template_admin/webpack.api.js +11 -3
- package/templates/template_admin/public/favicon.ico +0 -0
- package/templates/template_admin/public/src/assets/images/avatars/1.png +0 -0
- package/templates/template_admin/public/src/assets/images/avatars/2.png +0 -0
- package/templates/template_admin/public/src/assets/images/avatars/3.png +0 -0
- package/templates/template_admin/public/src/components/layout/centerBody/index.jsx +0 -25
- package/templates/template_admin/public/src/components/layout/centerBody/index.less +0 -30
- package/templates/template_admin/public/src/components/menu/index.less +0 -19
- package/templates/template_admin/public/src/components/menu/topMenu/index.jsx +0 -132
- package/templates/template_admin/public/src/components/menu/topMenu/index.less +0 -105
- package/templates/template_admin/public/src/pages/demo/detail/index.jsx +0 -27
- package/templates/template_admin/public/src/pages/demo/edit/index.jsx +0 -109
- package/templates/template_admin/public/src/pages/demo/index.less +0 -9
- package/templates/template_admin/public/src/pages/demo/page1.jsx +0 -161
- package/templates/template_admin/public/src/pages/superAdminLogin/index.jsx +0 -64
- package/templates/template_admin/public/src/pages/superAdminLogin/index.less +0 -44
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@import '~@/_variable.less';
|
|
2
|
+
@import '~@/_mixin.less';
|
|
3
|
+
|
|
4
|
+
@menuWidth:70px;
|
|
5
|
+
@openMenuWidth:128px;
|
|
6
|
+
|
|
7
|
+
.TopMenuSlogan{
|
|
8
|
+
width: 152px;
|
|
9
|
+
height: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
img{
|
|
14
|
+
width: 73px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.topMenu{
|
|
19
|
+
padding:0 24px;
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-self: center;
|
|
23
|
+
height: 100%;
|
|
24
|
+
width: 100%;
|
|
25
|
+
|
|
26
|
+
.leftGroup{
|
|
27
|
+
display: flex;
|
|
28
|
+
height: 100%;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.menuItem{
|
|
33
|
+
position: relative;
|
|
34
|
+
width: 74px;
|
|
35
|
+
height: 100%;
|
|
36
|
+
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content:center;
|
|
40
|
+
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
|
|
43
|
+
*{.no-select;}
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
color:#fff;
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
span{
|
|
48
|
+
font-weight: inherit;
|
|
49
|
+
font-size: inherit;
|
|
50
|
+
color:inherit;
|
|
51
|
+
}
|
|
52
|
+
&[data-checked='true']{
|
|
53
|
+
background: rgba(78,148,207,0.7);
|
|
54
|
+
font-weight: bold;
|
|
55
|
+
}
|
|
56
|
+
&:hover{
|
|
57
|
+
background-color: rgba(255,255,255,.1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.messageWrap{
|
|
63
|
+
position: absolute;
|
|
64
|
+
right:4px;
|
|
65
|
+
top:6px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
.iconUnread{
|
|
72
|
+
display: block;
|
|
73
|
+
width: 6px;
|
|
74
|
+
height: 6px;
|
|
75
|
+
border-radius: 6px;
|
|
76
|
+
background-color: red;
|
|
77
|
+
// position: absolute;
|
|
78
|
+
// right: 0;
|
|
79
|
+
// top: 0;
|
|
80
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React, { useRef, useState } from 'react';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { Dropdown,message } from 'antd'
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { LogoutOutlined } from '@ant-design/icons';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import { useNavigate } from 'react-router-dom';
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
import imgUser from '@/assets/images/icon-user.png';
|
|
11
|
+
import ProviderApp from '@/provider/app';
|
|
12
|
+
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import styles from './index.less';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const TopBar=()=>{
|
|
18
|
+
const app = ProviderApp.useContainer();
|
|
19
|
+
const navigate = useNavigate();
|
|
20
|
+
|
|
21
|
+
const [unreadNotify,setUnreadNotify]=useState(0);
|
|
22
|
+
/**
|
|
23
|
+
* @type {React.MutableRefObject<object>}
|
|
24
|
+
*/
|
|
25
|
+
const refSelf =useRef();
|
|
26
|
+
|
|
27
|
+
refSelf.current={
|
|
28
|
+
unreadNotify,setUnreadNotify
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// const onToggle=()=>{
|
|
32
|
+
// const {leftNavOpen}= app.nav;
|
|
33
|
+
// app.setNav({...app.nav,leftNavOpen:!leftNavOpen})
|
|
34
|
+
// }
|
|
35
|
+
const onAvatarClick=(type)=>{
|
|
36
|
+
switch(type){
|
|
37
|
+
case 'user':{
|
|
38
|
+
const {name,userId,realName} = app.user;
|
|
39
|
+
const {auths} = app;
|
|
40
|
+
let txt = <div>{`[${userId}]${name}(${realName})`}<br/>{`${auths}`}</div>
|
|
41
|
+
message.info( txt );
|
|
42
|
+
}break;
|
|
43
|
+
case 'logout':{
|
|
44
|
+
app.logout();
|
|
45
|
+
}break;
|
|
46
|
+
case 'message':{
|
|
47
|
+
// navigate('/message/my');
|
|
48
|
+
}break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<section className={styles.topUserInfo}>
|
|
54
|
+
<Dropdown menu={{items:[
|
|
55
|
+
{
|
|
56
|
+
key:'user',
|
|
57
|
+
label:<span className={styles.userMenuItem}>Hi,{app?.user?.realName||'用户'}</span>
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key:'logout',
|
|
61
|
+
label:<span onClick={onAvatarClick.bind(this,'logout')} className={styles.userMenuItem}><LogoutOutlined />退出登录</span>
|
|
62
|
+
}
|
|
63
|
+
]}}>
|
|
64
|
+
<img className={styles.avatar} src={imgUser}/>
|
|
65
|
+
</Dropdown>
|
|
66
|
+
|
|
67
|
+
{/* <span className={styles.notifyWrap}>
|
|
68
|
+
<img src={imgNotice} className={styles.notice} onClick={onAvatarClick.bind(this,'message')} />
|
|
69
|
+
{unreadNotify>0?<i className={styles.noticeUnread}/>:''}
|
|
70
|
+
</span> */}
|
|
71
|
+
|
|
72
|
+
</section>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default TopBar;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@import '~@/_mixin.less';
|
|
2
|
+
|
|
3
|
+
.toggle{
|
|
4
|
+
width: 24px;
|
|
5
|
+
height: 24px;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
transition: transform .2s;
|
|
8
|
+
&[data-tooggle='true']{
|
|
9
|
+
transform: scaleX(-1);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.topUserInfo{
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: flex-end;
|
|
17
|
+
height: 100%;
|
|
18
|
+
width:100%;
|
|
19
|
+
z-index:var(--z-top-menu);
|
|
20
|
+
padding:0 10px;
|
|
21
|
+
|
|
22
|
+
column-gap: 16px;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
.noticeUnread{
|
|
27
|
+
width: 6px;
|
|
28
|
+
height: 6px;
|
|
29
|
+
border-radius: 6px;
|
|
30
|
+
background-color: red;
|
|
31
|
+
position: absolute;
|
|
32
|
+
right:0;
|
|
33
|
+
top:0;
|
|
34
|
+
}
|
|
35
|
+
.notice,
|
|
36
|
+
.avatar{
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
width: 24px;
|
|
39
|
+
height: 24px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.menu:global(.ant-menu){
|
|
43
|
+
line-height: var(--topMenu-height);
|
|
44
|
+
background-color: inherit;
|
|
45
|
+
border-bottom: none;
|
|
46
|
+
flex:1;
|
|
47
|
+
// min-width: 100px;
|
|
48
|
+
|
|
49
|
+
:global{
|
|
50
|
+
.ant-menu-item,
|
|
51
|
+
.ant-menu-item a{
|
|
52
|
+
color:rgba(104,114,126,1);
|
|
53
|
+
font-weight: var(--weight-Medium);
|
|
54
|
+
}
|
|
55
|
+
.ant-menu-item:hover a,
|
|
56
|
+
.ant-menu-item:hover,
|
|
57
|
+
.ant-menu-item-selected a{
|
|
58
|
+
color: rgba(255,255,255,.8);
|
|
59
|
+
}
|
|
60
|
+
.ant-menu-item-selected{
|
|
61
|
+
color: white;
|
|
62
|
+
}
|
|
63
|
+
.ant-menu-item:hover:after,
|
|
64
|
+
.ant-menu-item-selected:after{
|
|
65
|
+
border-bottom: 2px solid #fff;
|
|
66
|
+
}
|
|
67
|
+
.ant-menu-item{
|
|
68
|
+
padding: 0 24px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.avatarMenu{
|
|
75
|
+
min-width: 100px;
|
|
76
|
+
:global(.anticon) {
|
|
77
|
+
margin-right: 8px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:global(.ant-dropdown-menu-item) {
|
|
81
|
+
min-width: 100px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.userMenuItem{
|
|
86
|
+
display: flex;
|
|
87
|
+
column-gap: 6px;
|
|
88
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import ShowPreview from './preview';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import styles from './index.less';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import imgFail from '@/assets/images/loadFail.png';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 视频素材预览组件
|
|
12
|
+
* @param {object} [props]
|
|
13
|
+
* @param {'view'|'checkbox'} [props.mode='view'] - 组件类型,view为展示预览,点击后放大预览,checkbox为选择模式
|
|
14
|
+
* @param {boolean} [props.checked=false] - 如果将该组件设定为选择组件,则这里代表是否选中状态
|
|
15
|
+
* @param {(checked:boolean)=>void} [props.onClick] - 点击回调
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* @param {string|object} props.src - 素材下载地址
|
|
19
|
+
* @param {string|object} [props.preview] - 封面图地址
|
|
20
|
+
*
|
|
21
|
+
* @param {string} [props.className] - 样式
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
const Video = props=>{
|
|
25
|
+
const { src,className,mode='view',checked=false,onClick:_onClick,preview,...others } = props;
|
|
26
|
+
const [time,setTime] = useState('');
|
|
27
|
+
const onPreview = ()=>{
|
|
28
|
+
if(mode=='checkbox'){
|
|
29
|
+
if(_onClick){
|
|
30
|
+
_onClick(!checked)
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
ShowPreview({
|
|
35
|
+
src,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const onLoadedMetaData=(e)=>{
|
|
39
|
+
const {target:{duration}} = e;
|
|
40
|
+
if(duration<=0||!duration){
|
|
41
|
+
setTime('');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const _time = moment.duration(duration*1000);
|
|
45
|
+
const hours=_time.hours();
|
|
46
|
+
const minutes=_time.minutes();
|
|
47
|
+
const seconds=_time.seconds();
|
|
48
|
+
let req='';
|
|
49
|
+
if(hours>0){
|
|
50
|
+
req+= `${hours}`.padStart(2,'0') + ':';
|
|
51
|
+
}
|
|
52
|
+
req+= `${minutes}`.padStart(2,'0') + ':';
|
|
53
|
+
req+= `${seconds}`.padStart(2,'0');
|
|
54
|
+
|
|
55
|
+
setTime(`${req}`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const load=()=>{
|
|
59
|
+
let video = document.createElement('video');
|
|
60
|
+
video.src= src;
|
|
61
|
+
video.addEventListener('loadedmetadata',onLoadedMetaData);
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
useEffect(()=>{
|
|
65
|
+
load();
|
|
66
|
+
},[])
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div className={`${styles.wrap} ${className}`} onClick={onPreview} data-checked={checked}>
|
|
70
|
+
<img src={preview||imgFail} className={styles.video}/>
|
|
71
|
+
|
|
72
|
+
{/* <video
|
|
73
|
+
onLoadedMetadata={onLoadedMetaData}
|
|
74
|
+
src={src}
|
|
75
|
+
className={`${styles.video}`}
|
|
76
|
+
{...others}
|
|
77
|
+
>
|
|
78
|
+
<a href={src} download>
|
|
79
|
+
下载
|
|
80
|
+
</a>
|
|
81
|
+
</video> */}
|
|
82
|
+
|
|
83
|
+
{
|
|
84
|
+
time&&
|
|
85
|
+
<div className={styles.info}>
|
|
86
|
+
<div className={styles.iconPlay}></div>
|
|
87
|
+
<span className={styles.time}>{time}</span>
|
|
88
|
+
</div>
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default Video;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
@keyframes loading {
|
|
4
|
+
0% { transform: rotateZ(0); }
|
|
5
|
+
100% { transform: rotateZ(360deg); }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
.wrap{
|
|
10
|
+
width: 200px;
|
|
11
|
+
height: 200px;
|
|
12
|
+
position: relative;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
align-items: center;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
|
|
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
|
+
.loading{
|
|
42
|
+
width: 64px;
|
|
43
|
+
animation: loading 2s infinite normal;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.video{
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.info{
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
background: rgba(31,35,41,0.8);
|
|
55
|
+
position: absolute;
|
|
56
|
+
right:0;
|
|
57
|
+
bottom:0;
|
|
58
|
+
padding:2px 2px 2px 8px;
|
|
59
|
+
border-top-left-radius: 4px;
|
|
60
|
+
border-bottom-left-radius: 4px;
|
|
61
|
+
.iconPlay{
|
|
62
|
+
width: 0;
|
|
63
|
+
height: 0;
|
|
64
|
+
border-left:5px solid white;
|
|
65
|
+
border-right:5px solid transparent;
|
|
66
|
+
border-top:5px solid transparent;
|
|
67
|
+
border-bottom:5px solid transparent;
|
|
68
|
+
}
|
|
69
|
+
.time{
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
font-size: 12px;
|
|
72
|
+
color: #FFFFFF;
|
|
73
|
+
line-height: 16px;
|
|
74
|
+
letter-spacing:-1px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
.main{
|
|
85
|
+
position: fixed;
|
|
86
|
+
top: 0;
|
|
87
|
+
left: 0;
|
|
88
|
+
z-index: 1000;
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
padding: 30px;
|
|
92
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
97
|
+
overflow: auto;
|
|
98
|
+
.current{
|
|
99
|
+
margin-top: 30px;
|
|
100
|
+
flex:none;
|
|
101
|
+
width:70vh;
|
|
102
|
+
height: 70vh;
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
position: relative;
|
|
107
|
+
.video{
|
|
108
|
+
width:100%;
|
|
109
|
+
height: 100%;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
.close{
|
|
113
|
+
position: absolute;
|
|
114
|
+
top: -30px;
|
|
115
|
+
right: -30px;
|
|
116
|
+
svg{
|
|
117
|
+
font-size: 24px;
|
|
118
|
+
color:rgba(255, 255, 255, 0.85)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
.preview {
|
|
123
|
+
width: 100%;
|
|
124
|
+
height: 100%;
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
align-items: center;
|
|
129
|
+
overflow-y: auto;
|
|
130
|
+
position: relative;
|
|
131
|
+
|
|
132
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDom from 'react-dom';
|
|
3
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
4
|
+
import Popup from '@/components/popup';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import styles from './index.less';
|
|
7
|
+
|
|
8
|
+
const ModalPreview = (props) => {
|
|
9
|
+
const { destory, src } = props;
|
|
10
|
+
|
|
11
|
+
const onCancel = () => {
|
|
12
|
+
destory && destory();
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<section className={styles.main}>
|
|
17
|
+
<div className={styles.current}>
|
|
18
|
+
<video controls src={src} className={styles.video}>
|
|
19
|
+
<a href={src} download>
|
|
20
|
+
下载
|
|
21
|
+
</a>
|
|
22
|
+
</video>
|
|
23
|
+
<CloseOutlined className={styles.close} onClick={onCancel} />
|
|
24
|
+
</div>
|
|
25
|
+
</section>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const ShowPreview = (props = {}) => {
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
let popup = Popup(resolve);
|
|
32
|
+
ReactDom.render(
|
|
33
|
+
<ModalPreview destory={popup.destory} {...props} />,
|
|
34
|
+
popup.dom
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export default ShowPreview;
|
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
import {useDictionary} from 'kn-hooks';
|
|
6
|
+
|
|
6
7
|
// @ts-ignore
|
|
7
8
|
import {Select,Radio} from 'antd';
|
|
8
9
|
|
|
9
|
-
import {GET_ENUM_TYPE} from '@/services/demo'
|
|
10
|
-
|
|
11
|
-
import ShowToast from '@/components/toast';
|
|
12
|
-
|
|
13
10
|
|
|
14
11
|
|
|
15
12
|
/**
|
|
@@ -39,51 +36,123 @@ import ShowToast from '@/components/toast';
|
|
|
39
36
|
*/
|
|
40
37
|
|
|
41
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @typedef Dictionary
|
|
41
|
+
* @property {DictionaryItem[]} list - 字典数据列表
|
|
42
|
+
* @property {(labelOrName:string)=>string|number} getId - (labelOrName:string)=>string,搜索字典项中,label或name匹配labelOrName的项目,返回其id的值
|
|
43
|
+
* @property {(idOrLabel:string|number)=>string} getName - (id:string)=>string,搜索字典项中,id匹配id的项目,返回其name的值
|
|
44
|
+
* @property {(idOrName:string|number)=>string} getLabel - (id:string)=>string,搜索字典项中,id匹配id的项目,返回其label的值
|
|
45
|
+
* @property {(text:string|number)=>DictionaryItem|null} getItem - 匹配text为id\name\label中任何一个的对象
|
|
46
|
+
* @property {JSX.Element[]} [selectOptions] - antd-select渲染成员
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
|
|
42
50
|
|
|
43
|
-
export const SelectOption=(props)=>{
|
|
44
|
-
const {value}=props;
|
|
45
|
-
const name = props['data-keyname'];
|
|
46
|
-
const onClick=(e)=>{
|
|
47
|
-
ShowToast(`点击option name=${name},value=${value},label=${props.children}`)
|
|
48
|
-
if(props.onClick)props.onClick();
|
|
49
|
-
}
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
return <hgroup onClick={onClick} key={value} name={name} value={value}>{props.children}</hgroup>
|
|
52
|
-
}
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
// export const SelectOption=(props)=>{
|
|
53
|
+
// const {value}=props;
|
|
54
|
+
// const name = props['data-keyname'];
|
|
55
|
+
// const onClick=(e)=>{
|
|
56
|
+
// ShowToast(`点击option name=${name},value=${value},label=${props.children}`)
|
|
57
|
+
// if(props.onClick)props.onClick();
|
|
58
|
+
// }
|
|
59
|
+
// // @ts-ignore
|
|
60
|
+
// return <hgroup onClick={onClick} key={value} name={name} value={value}>{props.children}</hgroup>
|
|
61
|
+
// }
|
|
55
62
|
|
|
63
|
+
useDictionary.SetConfig({SelectOption:Select.Option,RadioOption:Radio})
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param {DictionaryItem[]|[]} list
|
|
69
|
+
* @returns {Dictionary}
|
|
70
|
+
*/
|
|
71
|
+
const createDictionary=(list)=>{
|
|
72
|
+
const getId=(nameOrLabel)=>{
|
|
73
|
+
for(let i=0;i<list.length;i++){
|
|
74
|
+
if(list[i].label == nameOrLabel || list[i].name == nameOrLabel){
|
|
75
|
+
return list[i].id;
|
|
76
|
+
}
|
|
66
77
|
}
|
|
67
|
-
return
|
|
78
|
+
return null;
|
|
68
79
|
}
|
|
69
|
-
|
|
80
|
+
const getLabel=(nameOrId)=>{
|
|
81
|
+
for(let i=0;i<list.length;i++){
|
|
82
|
+
if(list[i].id == nameOrId || list[i].name == nameOrId){
|
|
83
|
+
return list[i].label;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const getName=(idOrLabel)=>{
|
|
89
|
+
for(let i=0;i<list.length;i++){
|
|
90
|
+
if(list[i].id == idOrLabel || list[i].label == idOrLabel){
|
|
91
|
+
return list[i].name;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const getItem=(idOrNameOrLabel)=>{
|
|
97
|
+
for(let i=0;i<list.length;i++){
|
|
98
|
+
if(list[i].id == idOrNameOrLabel || list[i].label == idOrNameOrLabel || list[i].name== idOrNameOrLabel ){
|
|
99
|
+
return list[i];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const selectOptions = list.map(item=>{
|
|
106
|
+
return <Select.Option value={item.id} >{item.label}</Select.Option>
|
|
107
|
+
})
|
|
108
|
+
return {
|
|
109
|
+
getId,getLabel,getName,getItem,list,selectOptions
|
|
110
|
+
}
|
|
111
|
+
}
|
|
70
112
|
|
|
71
|
-
export const useTaskState= useDictionary.createDictionary({
|
|
72
|
-
defaultTypes:[
|
|
73
|
-
{label:'进行中',id:'1',name:'run'},
|
|
74
|
-
{label:'已完成',id:'5',name:'complete'},
|
|
75
|
-
]
|
|
76
|
-
});
|
|
77
113
|
|
|
114
|
+
/**
|
|
115
|
+
* 用户枚举数据
|
|
116
|
+
* @type UseDictionary
|
|
117
|
+
*/
|
|
118
|
+
// export const useUserEnum=useDictionary.createDictionary({
|
|
119
|
+
// beforeApi: () => ({
|
|
120
|
+
// status: 1 // 筛选已启用的数据
|
|
121
|
+
// }),
|
|
122
|
+
// api: USER_ENUM,
|
|
123
|
+
// labelKey: 'name',
|
|
124
|
+
// afterApi: res => {
|
|
125
|
+
// let list=[];
|
|
126
|
+
// if(res?.code===0) {
|
|
127
|
+
// list=res?.data||[];
|
|
128
|
+
// }
|
|
129
|
+
// return list;
|
|
130
|
+
// }
|
|
131
|
+
// })
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 消息已读状态的
|
|
136
|
+
*/
|
|
137
|
+
export const DictMessageStatus=[
|
|
138
|
+
{label: '未读',id: '0',name: '0'},
|
|
139
|
+
{label: '已读',id: '1',name: '1'}
|
|
140
|
+
]
|
|
78
141
|
|
|
79
142
|
/**
|
|
80
|
-
*
|
|
143
|
+
* 消息已读状态
|
|
81
144
|
* @type UseDictionary
|
|
82
145
|
*/
|
|
83
|
-
export const
|
|
84
|
-
defaultTypes:
|
|
85
|
-
{label:'正常',id:'normal',name:'normal'},
|
|
86
|
-
{label:'异常',id:'abnormal',name:'abnormal'},
|
|
87
|
-
{label:'禁用',id:'disabled',name:'disabled'},
|
|
88
|
-
]
|
|
146
|
+
export const useMessageStatus=useDictionary.createDictionary({
|
|
147
|
+
defaultTypes: DictMessageStatus
|
|
89
148
|
});
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 用户状态
|
|
153
|
+
*/
|
|
154
|
+
export const emUserState= createDictionary([
|
|
155
|
+
{label:'启用',id:'1',name:'open'},
|
|
156
|
+
{label:'禁用',id:'0',name:'disabled'},
|
|
157
|
+
{label:'离职',id:'2',name:'out'},
|
|
158
|
+
]);
|