kn-cli 1.0.92 → 1.0.94
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/public/index.html +5 -2
- package/templates/template_admin/public/src/_antd.less +7 -1
- 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/basic/index.less +3 -3
- package/templates/template_admin/public/src/components/menu/index.jsx +47 -100
- package/templates/template_admin/public/src/components/menu/topMenu/index.jsx +129 -0
- package/templates/template_admin/public/src/components/table/index.jsx +62 -0
- package/templates/template_admin/public/src/dictionary/index.js +49 -4
- package/templates/template_admin/public/src/hooks/index.jsx +4 -1
- package/templates/template_admin/public/src/hooks/useRouteMenu.jsx +232 -0
- package/templates/template_admin/public/src/mock/demo.js +177 -0
- package/templates/template_admin/public/src/mock/index.js +5 -2
- package/templates/template_admin/public/src/pages/demo/detail/index.jsx +27 -0
- package/templates/template_admin/public/src/pages/demo/edit/index.jsx +109 -0
- package/templates/template_admin/public/src/pages/demo/index.less +9 -0
- package/templates/template_admin/public/src/pages/demo/page1.jsx +161 -0
- package/templates/template_admin/public/src/pages/login/index.jsx +5 -4
- package/templates/template_admin/public/src/pages/superAdminLogin/index.jsx +9 -2
- package/templates/template_admin/public/src/provider/app.jsx +18 -8
- package/templates/template_admin/public/src/provider/menu.jsx +146 -10
- package/templates/template_admin/public/src/route.jsx +21 -18
- package/templates/template_admin/public/src/services/demo.js +54 -0
- package/templates/template_admin/public/src/services/index.js +9 -0
- package/templates/template_admin/public/src/utils/format.js +51 -0
- package/templates/template_admin/public/src/utils/rule.js +274 -0
- package/templates/template_admin/readme.md +4 -0
- package/templates/template_admin/public/src/components/topMenu/index.jsx +0 -267
- package/templates/template_admin/public/src/mock/auth.js +0 -91
- package/templates/template_admin/public/src/mock/user.js +0 -70
- package/templates/template_admin/public/src/pages/material/index.jsx +0 -84
- package/templates/template_admin/public/src/pages/order/index.jsx +0 -12
- package/templates/template_admin/public/src/pages/permission/index.jsx +0 -12
- package/templates/template_admin/public/src/pages/suggest/index.jsx +0 -12
- package/templates/template_admin/public/src/pages/user/index.jsx +0 -18
- package/templates/template_admin/public/src/pages/userData/index.jsx +0 -12
- package/templates/template_admin/public/src/pages/video/index.jsx +0 -65
- package/templates/template_admin/public/src/services/auth.js +0 -28
- package/templates/template_admin/public/src/services/user.js +0 -26
- package/templates/template_admin/public/src/services/video.js +0 -33
- /package/templates/template_admin/public/src/components/{topMenu → menu/topMenu}/index.less +0 -0
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import {usePaginationWithForm} from '@/hooks/index';
|
|
3
|
-
import {GET_LIST} from '@/services/video';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import {Table,Pagination,Form,Input,Button} from 'antd';
|
|
6
|
-
|
|
7
|
-
const Page = () => {
|
|
8
|
-
const [form] = Form.useForm();
|
|
9
|
-
|
|
10
|
-
const request = usePaginationWithForm({
|
|
11
|
-
service:GET_LIST,
|
|
12
|
-
pagination:{pageSize:10},
|
|
13
|
-
form:form
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
useEffect(()=>{
|
|
17
|
-
request.update();
|
|
18
|
-
},[])
|
|
19
|
-
|
|
20
|
-
const columns=[{
|
|
21
|
-
dataIndex:'id',
|
|
22
|
-
title:'id',
|
|
23
|
-
render:(_,record,idx)=>{
|
|
24
|
-
return record.id;
|
|
25
|
-
}
|
|
26
|
-
},{
|
|
27
|
-
dataIndex:'value',
|
|
28
|
-
title:'数据值',
|
|
29
|
-
render:(_,record,idx)=>{
|
|
30
|
-
return record.value||'-'
|
|
31
|
-
}
|
|
32
|
-
}];
|
|
33
|
-
|
|
34
|
-
useEffect(()=>{
|
|
35
|
-
console.log(request)
|
|
36
|
-
},[request])
|
|
37
|
-
|
|
38
|
-
const getDataSource=()=>{
|
|
39
|
-
if(request?.data?.length>0){
|
|
40
|
-
let req=request?.data[request.pagination.current-1]||[];
|
|
41
|
-
return req;
|
|
42
|
-
}
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const onPageChange=(current,pageSize)=>{
|
|
47
|
-
debugger;
|
|
48
|
-
request.update({pagination:{current,pageSize}})
|
|
49
|
-
}
|
|
50
|
-
const onSearch=()=>{
|
|
51
|
-
request.update();
|
|
52
|
-
}
|
|
53
|
-
const onReset=()=>{
|
|
54
|
-
request.reset();
|
|
55
|
-
}
|
|
56
|
-
return (
|
|
57
|
-
<section className='wrap-space'>
|
|
58
|
-
<section style={{display:'flex'}}>
|
|
59
|
-
<Form form={form} >
|
|
60
|
-
<Form.Item name='keywords' label='关键字'>
|
|
61
|
-
<Input />
|
|
62
|
-
</Form.Item>
|
|
63
|
-
</Form>
|
|
64
|
-
<Button onClick={onSearch} type='primary' style={{margin:'0 12px'}}>查询</Button>
|
|
65
|
-
<Button onClick={onReset}>重置</Button>
|
|
66
|
-
</section>
|
|
67
|
-
<Table
|
|
68
|
-
rowKey={'id'}
|
|
69
|
-
loading={!request?.data?.length>0}
|
|
70
|
-
columns={columns}
|
|
71
|
-
dataSource={getDataSource()}
|
|
72
|
-
pagination={false}
|
|
73
|
-
/>
|
|
74
|
-
<Pagination
|
|
75
|
-
current={request?.pagination?.current}
|
|
76
|
-
pageSize={request?.pagination?.pageSize}
|
|
77
|
-
onChange={onPageChange}
|
|
78
|
-
total={request?.pagination?.total}
|
|
79
|
-
/>
|
|
80
|
-
</section>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default Page;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { useParams, useSearchParams,useNavigate } from 'react-router-dom';
|
|
3
|
-
|
|
4
|
-
const Page = () => {
|
|
5
|
-
const query = useParams();
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<p>permission</p>
|
|
9
|
-
)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default Page;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import Link from '@/components/link';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @returns {JSX.Element}
|
|
8
|
-
*/
|
|
9
|
-
const Page = () => {
|
|
10
|
-
return (
|
|
11
|
-
<div>
|
|
12
|
-
<p>用户信息页:用户已登录才可以看到本页,不然会跳转登录页面</p>
|
|
13
|
-
<Link href={'/'}>点击返回首页</Link>
|
|
14
|
-
</div>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default Page;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import {usePagination} from '@/hooks';
|
|
3
|
-
import {GET_LIST} from '@/services/video';
|
|
4
|
-
import {Table,Pagination} from 'antd';
|
|
5
|
-
|
|
6
|
-
const Page = () => {
|
|
7
|
-
const request = usePagination({
|
|
8
|
-
service:GET_LIST,
|
|
9
|
-
pagination:{pageSize:10}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
useEffect(()=>{
|
|
13
|
-
request.update();
|
|
14
|
-
},[])
|
|
15
|
-
|
|
16
|
-
const columns=[{
|
|
17
|
-
dataIndex:'id',
|
|
18
|
-
title:'id',
|
|
19
|
-
render:(_,record,idx)=>{
|
|
20
|
-
return record.id;
|
|
21
|
-
}
|
|
22
|
-
},{
|
|
23
|
-
dataIndex:'value',
|
|
24
|
-
title:'数据值',
|
|
25
|
-
render:(_,record,idx)=>{
|
|
26
|
-
return record.value||'-'
|
|
27
|
-
}
|
|
28
|
-
}];
|
|
29
|
-
|
|
30
|
-
useEffect(()=>{
|
|
31
|
-
console.log(request)
|
|
32
|
-
},[request])
|
|
33
|
-
|
|
34
|
-
const getDataSource=()=>{
|
|
35
|
-
if(request?.data?.length>0){
|
|
36
|
-
let req=request?.data[request.pagination.current-1]||[];
|
|
37
|
-
return req;
|
|
38
|
-
}
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const onPageChange=(current,pageSize)=>{
|
|
43
|
-
debugger;
|
|
44
|
-
request.update({pagination:{current,pageSize}})
|
|
45
|
-
}
|
|
46
|
-
return (
|
|
47
|
-
<section className='wrap-space'>
|
|
48
|
-
<Table
|
|
49
|
-
rowKey={'id'}
|
|
50
|
-
loading={!request?.data?.length>0}
|
|
51
|
-
columns={columns}
|
|
52
|
-
dataSource={getDataSource()}
|
|
53
|
-
pagination={false}
|
|
54
|
-
/>
|
|
55
|
-
<Pagination
|
|
56
|
-
current={request?.pagination?.current}
|
|
57
|
-
pageSize={request?.pagination?.pageSize}
|
|
58
|
-
onChange={onPageChange}
|
|
59
|
-
total={request?.pagination?.total}
|
|
60
|
-
/>
|
|
61
|
-
</section>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default Page;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {GET_DEFAULT,API_ROOT,POST_DEFAULT} from './index.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export function GET_MENU(){
|
|
6
|
-
return GET_DEFAULT(`${API_ROOT}/api/menu/nav`);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function KSSO_LOGIN(params={
|
|
12
|
-
code:'',
|
|
13
|
-
redirectUri:'',
|
|
14
|
-
}){
|
|
15
|
-
return POST_DEFAULT(`${API_ROOT}/api/ksso/auth`,params)
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function LOGIN(params={
|
|
20
|
-
username:'',
|
|
21
|
-
password:'',
|
|
22
|
-
}){
|
|
23
|
-
return POST_DEFAULT(`${API_ROOT}/api/login`,params)
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
export function LOGOUT(){
|
|
27
|
-
return POST_DEFAULT(`${API_ROOT}/api/logout`)
|
|
28
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {GET_DEFAULT,POST_DEFAULT,API_ROOT} from './index.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export function GET_USER(){
|
|
6
|
-
return GET_DEFAULT(`${API_ROOT}/user`);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function SET_USER(params={
|
|
10
|
-
name:'',
|
|
11
|
-
age:''
|
|
12
|
-
}){
|
|
13
|
-
return POST_DEFAULT(`${API_ROOT}/user`,params)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export function GET_USER_LIST(params={
|
|
18
|
-
current:1,
|
|
19
|
-
pageSize:20
|
|
20
|
-
}){
|
|
21
|
-
return GET_DEFAULT(`${API_ROOT}/userList`,params)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function GET_USER_TYPE(){
|
|
25
|
-
return GET_DEFAULT(`${API_ROOT}/userType`)
|
|
26
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export function GET_LIST(params={
|
|
4
|
-
current:1,
|
|
5
|
-
pageSize:10,
|
|
6
|
-
keywords:''
|
|
7
|
-
}){
|
|
8
|
-
const {current,pageSize,keywords='-'}=params;
|
|
9
|
-
let list=[];
|
|
10
|
-
for(let i=0;i<200;i++){
|
|
11
|
-
list.push({
|
|
12
|
-
id:i,
|
|
13
|
-
value:`item-${i}-${keywords}`,
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
let total=200;
|
|
17
|
-
let startIdx = (current-1)*pageSize;
|
|
18
|
-
let data = list.splice(startIdx,pageSize);
|
|
19
|
-
let req= {
|
|
20
|
-
code:0,
|
|
21
|
-
data,
|
|
22
|
-
page:{
|
|
23
|
-
current,
|
|
24
|
-
pageSize,
|
|
25
|
-
total
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
return new Promise(resolve=>{
|
|
29
|
-
setTimeout(()=>{
|
|
30
|
-
resolve(req)
|
|
31
|
-
},500)
|
|
32
|
-
})
|
|
33
|
-
}
|
|
File without changes
|