kn-cli 1.0.47 → 1.0.49
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/cli.config.js +3 -0
- package/build/webpack.config.js +61 -74
- package/package.json +1 -1
- package/readme.md +10 -0
- package/templates/template_admin/cli.config.js +3 -0
- package/templates/template_admin/package.json +1 -0
- package/templates/template_admin/public/src/components/Auth/index.jsx +1 -1
- package/templates/template_admin/public/src/components/TopMenu/index.jsx +1 -1
- package/templates/template_admin/public/src/dictionary/index.js +26 -90
- package/templates/template_admin/public/src/hooks/index.jsx +4 -2
- package/templates/template_admin/public/src/pages/material/index.jsx +74 -3
- package/templates/template_admin/public/src/pages/video/index.jsx +56 -3
- package/templates/template_admin/public/src/provider/app.jsx +1 -1
- package/templates/template_admin/public/src/route.jsx +0 -10
- package/templates/template_admin/public/src/services/video.js +33 -0
- package/templates/template_app/cli.config.js +3 -0
- package/templates/template_app/package.json +1 -0
- package/templates/template_app/public/src/_reset.less +1 -1
- package/templates/template_app/public/src/dictionary/index.js +26 -90
- package/templates/template_app/public/src/hooks/index.jsx +4 -7
- package/templates/template_app/public/src/mock/user.js +5 -7
- package/templates/template_app/public/src/pages/dictionary/index.jsx +33 -0
- package/templates/template_app/public/src/pages/index.jsx +9 -70
- package/templates/template_app/public/src/pages/list/index.jsx +88 -0
- package/templates/template_app/public/src/pages/list/index.less +22 -0
- package/templates/template_app/public/src/pages/login/index.jsx +0 -1
- package/templates/template_app/public/src/provider/app.jsx +22 -0
- package/templates/template_app/public/src/route.jsx +8 -0
- package/templates/template_app/public/src/services/index.js +34 -1
- package/templates/template_admin/public/src/hooks/useNextPage.jsx +0 -89
- package/templates/template_admin/public/src/pages/checkLogin/index.jsx +0 -13
- package/templates/template_admin/public/src/pages/index.jsx +0 -23
- package/templates/template_admin/public/src/pages/subHome/index.jsx +0 -12
- package/templates/template_admin/public/src/pages/subHome2/index.jsx +0 -12
- package/templates/template_admin/public/src/pages/subHome3/index.jsx +0 -12
- package/templates/template_app/public/src/hooks/useNextPage.jsx +0 -89
- package/templates/template_app/public/src/hooks/useSearch.jsx +0 -137
- package/templates/template_app/public/src/hooks/useUpdate.jsx +0 -11
- /package/templates/{template_admin/public/src/pages → template_app/public/src/pages/dictionary}/index.less +0 -0
package/build/cli.config.js
CHANGED
|
@@ -6,6 +6,9 @@ module.exports = {
|
|
|
6
6
|
javascriptEnabled:false,//是否开启less js
|
|
7
7
|
},
|
|
8
8
|
version:'1.0',
|
|
9
|
+
// rules:{
|
|
10
|
+
// compileNpmPackage:['kn-hooks'],//需要参与编译的npm包
|
|
11
|
+
// },
|
|
9
12
|
// https:true,//是否使用https本地调试
|
|
10
13
|
// pxtorem:false,//默认:true,开启px转rem模式
|
|
11
14
|
// site_root_path:'/dist/',// 默认:'',站点根目录
|
package/build/webpack.config.js
CHANGED
|
@@ -110,88 +110,58 @@ if(!hashMode){
|
|
|
110
110
|
////////////// OUTPUT-END ///////////////
|
|
111
111
|
|
|
112
112
|
/////////////// RULES ////////////////
|
|
113
|
+
|
|
114
|
+
const LOADER_JS=[
|
|
115
|
+
{
|
|
116
|
+
loader: 'babel-loader',
|
|
117
|
+
options: {
|
|
118
|
+
presets: [
|
|
119
|
+
'@babel/preset-react',
|
|
120
|
+
[
|
|
121
|
+
'@babel/preset-env',
|
|
122
|
+
{
|
|
123
|
+
targets: devMode
|
|
124
|
+
? { chrome: '90' }
|
|
125
|
+
: {
|
|
126
|
+
chrome: '40',
|
|
127
|
+
ie: '11',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
],
|
|
132
|
+
plugins: [
|
|
133
|
+
['@babel/plugin-transform-runtime', { corejs: 3 }],
|
|
134
|
+
'@babel/plugin-proposal-optional-chaining',
|
|
135
|
+
'@babel/plugin-proposal-nullish-coalescing-operator',
|
|
136
|
+
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
137
|
+
['@babel/plugin-proposal-private-methods', { loose: true }],
|
|
138
|
+
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
139
|
+
// ["import", {
|
|
140
|
+
// style: false,//"css",
|
|
141
|
+
// libraryName: "kn-hooks" ,
|
|
142
|
+
// libraryDirectory:"src",
|
|
143
|
+
// camel2DashComponentName:false,
|
|
144
|
+
// }],
|
|
145
|
+
// ["import", {
|
|
146
|
+
// style: true,//"css",
|
|
147
|
+
// libraryDirectory:"",
|
|
148
|
+
// libraryName: "antd" ,
|
|
149
|
+
// }]
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
]
|
|
154
|
+
|
|
113
155
|
const rules= [
|
|
114
156
|
{
|
|
115
157
|
test: /\.js[x]?$/,
|
|
116
158
|
exclude: /node_modules/,
|
|
117
|
-
use:
|
|
118
|
-
{
|
|
119
|
-
loader: 'babel-loader',
|
|
120
|
-
options: {
|
|
121
|
-
presets: [
|
|
122
|
-
'@babel/preset-react',
|
|
123
|
-
[
|
|
124
|
-
'@babel/preset-env',
|
|
125
|
-
{
|
|
126
|
-
targets: devMode
|
|
127
|
-
? { chrome: '90' }
|
|
128
|
-
: {
|
|
129
|
-
chrome: '40',
|
|
130
|
-
ie: '11',
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
],
|
|
135
|
-
plugins: [
|
|
136
|
-
['@babel/plugin-transform-runtime', { corejs: 3 }],
|
|
137
|
-
'@babel/plugin-proposal-optional-chaining',
|
|
138
|
-
'@babel/plugin-proposal-nullish-coalescing-operator',
|
|
139
|
-
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
140
|
-
['@babel/plugin-proposal-private-methods', { loose: true }],
|
|
141
|
-
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
142
|
-
// ["import", {
|
|
143
|
-
// style: false,//"css",
|
|
144
|
-
// libraryName: "kn-hooks" ,
|
|
145
|
-
// libraryDirectory:"src",
|
|
146
|
-
// camel2DashComponentName:false,
|
|
147
|
-
// }],
|
|
148
|
-
// ["import", {
|
|
149
|
-
// style: true,//"css",
|
|
150
|
-
// libraryDirectory:"",
|
|
151
|
-
// libraryName: "antd" ,
|
|
152
|
-
// }]
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
],
|
|
159
|
+
use: LOADER_JS,
|
|
157
160
|
},
|
|
158
161
|
// {
|
|
159
162
|
// test: /\.json$/,
|
|
160
163
|
// use: 'json-loader'
|
|
161
164
|
// },
|
|
162
|
-
{
|
|
163
|
-
test: /\.js[x]?$/,
|
|
164
|
-
include: /kn-hooks/,
|
|
165
|
-
use: [
|
|
166
|
-
{
|
|
167
|
-
loader: 'babel-loader',
|
|
168
|
-
options: {
|
|
169
|
-
presets: [
|
|
170
|
-
'@babel/preset-react',
|
|
171
|
-
[
|
|
172
|
-
'@babel/preset-env',
|
|
173
|
-
{
|
|
174
|
-
targets: devMode
|
|
175
|
-
? { chrome: '80' }
|
|
176
|
-
: {
|
|
177
|
-
chrome: '40',
|
|
178
|
-
ie: '11',
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
],
|
|
183
|
-
plugins: [
|
|
184
|
-
['@babel/plugin-transform-runtime', { corejs: 3 }],
|
|
185
|
-
'@babel/plugin-proposal-optional-chaining',
|
|
186
|
-
'@babel/plugin-proposal-nullish-coalescing-operator',
|
|
187
|
-
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
188
|
-
['@babel/plugin-proposal-private-methods', { loose: true }],
|
|
189
|
-
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
},
|
|
195
165
|
{
|
|
196
166
|
test: /\.(jpg|png|gif|svg)$/,
|
|
197
167
|
loader: 'url-loader',
|
|
@@ -291,6 +261,16 @@ if(support_sass){
|
|
|
291
261
|
],
|
|
292
262
|
})
|
|
293
263
|
}
|
|
264
|
+
if(CLI_CONFIG.rules){
|
|
265
|
+
if(CLI_CONFIG.rules.compileNpmPackage){
|
|
266
|
+
let JS_LIST= CLI_CONFIG.rules.compileNpmPackage.join('|');
|
|
267
|
+
rules.push({
|
|
268
|
+
test: /\.js[x]?$/,
|
|
269
|
+
include: new RegExp(`(${JS_LIST})`),
|
|
270
|
+
use: LOADER_JS
|
|
271
|
+
},)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
294
274
|
////////////// RULES-END ///////////////
|
|
295
275
|
|
|
296
276
|
|
|
@@ -320,6 +300,13 @@ if(jsSplitMode){
|
|
|
320
300
|
}
|
|
321
301
|
optimization.splitChunks= {
|
|
322
302
|
cacheGroups: {
|
|
303
|
+
knHooks:{
|
|
304
|
+
test: /(kn-hooks)/,
|
|
305
|
+
priority: 10220,
|
|
306
|
+
name: 'kn-hooks',
|
|
307
|
+
chunks: 'all',
|
|
308
|
+
enforce: true,
|
|
309
|
+
},
|
|
323
310
|
react: {
|
|
324
311
|
test: /(react)/,
|
|
325
312
|
priority: 100,
|
|
@@ -381,7 +368,7 @@ const plugins= [
|
|
|
381
368
|
|
|
382
369
|
|
|
383
370
|
if(indexHtml){
|
|
384
|
-
const shareJs = jsSplitMode?['react-bundle', 'modules-bundle', 'default-bundle', 'styles-bundle']:[];
|
|
371
|
+
const shareJs = jsSplitMode?['react-bundle', 'modules-bundle', 'default-bundle', 'styles-bundle','kn-hooks']:[];
|
|
385
372
|
if(jsSplitMode===true || jsSplitMode?.runtime !== false){
|
|
386
373
|
shareJs.splice(0,0,'runtime');
|
|
387
374
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -62,10 +62,20 @@ module.exports = {
|
|
|
62
62
|
// }
|
|
63
63
|
// pxtorem:false,//默认:true,开启px转rem模式
|
|
64
64
|
// https:true,//是否使用https本地调试
|
|
65
|
+
// rules:{
|
|
66
|
+
// compileNpmPackage:['kn-hooks'],//需要参与编译的npm包
|
|
67
|
+
// },
|
|
65
68
|
};
|
|
66
69
|
```
|
|
67
70
|
|
|
68
71
|
# 更新日志
|
|
72
|
+
* 1.0.49
|
|
73
|
+
更新app和admin模板,主要是编写了使用案例
|
|
74
|
+
|
|
75
|
+
* 1.0.48
|
|
76
|
+
1. cli.config增加rules:{compileNpmPackage:[]}配置,用于配置一些需要参与编译的npm包
|
|
77
|
+
2. 更新app及后管项目的模板
|
|
78
|
+
|
|
69
79
|
* 1.0.47
|
|
70
80
|
后管模板工程对菜单路由的隐藏子路由控制方法
|
|
71
81
|
|
|
@@ -1,103 +1,39 @@
|
|
|
1
1
|
|
|
2
2
|
import React, { useState, useEffect,useMemo} from 'react';
|
|
3
3
|
import {GET_USER_TYPE} from '@/services/user';
|
|
4
|
+
import {useDictionary} from 'kn-hooks';
|
|
5
|
+
import ShowToast from '@/components/Toast';
|
|
6
|
+
export const SelectOption=(props)=>{
|
|
7
|
+
const {value}=props;
|
|
8
|
+
const name = props['data-keyname'];
|
|
9
|
+
const onClick=(e)=>{
|
|
10
|
+
ShowToast(`点击option name=${name},value=${value},label=${props.children}`)
|
|
11
|
+
if(props.onClick)props.onClick();
|
|
12
|
+
}
|
|
13
|
+
return <hgroup onClick={onClick} key={value} name={name} value={value}>{props.children}</hgroup>
|
|
14
|
+
}
|
|
4
15
|
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
service,
|
|
8
|
-
idKey='value',
|
|
9
|
-
titleKey='label',
|
|
10
|
-
keyName='key',
|
|
11
|
-
defaultTypes=null
|
|
12
|
-
}=options;
|
|
13
|
-
|
|
14
|
-
return (props)=>{
|
|
15
|
-
const [types,setTypes]=useState(defaultTypes||null);
|
|
16
|
-
|
|
17
|
-
const init=async ()=>{
|
|
18
|
-
let ret = await service();
|
|
19
|
-
if(+ret?.code===0){
|
|
20
|
-
setTypes(ret.data||[]);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
useEffect(()=>{
|
|
24
|
-
if(defaultTypes)return;
|
|
25
|
-
init();
|
|
26
|
-
},[]);
|
|
27
|
-
|
|
28
|
-
const getData=({id,title,key}={})=>{
|
|
29
|
-
let name='';
|
|
30
|
-
if(id){
|
|
31
|
-
name=idKey
|
|
32
|
-
}
|
|
33
|
-
else if(title){
|
|
34
|
-
name=titleKey
|
|
35
|
-
}
|
|
36
|
-
else if(key){
|
|
37
|
-
name=keyName;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for(let i=0;i<types.length;i++){
|
|
41
|
-
if(''+types[i][name]===''+id){
|
|
42
|
-
return types[i];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
16
|
+
useDictionary.SetConfig({SelectOption})
|
|
47
17
|
|
|
48
|
-
const getTitle=(id)=>{
|
|
49
|
-
if(types){
|
|
50
|
-
for(let i=0;i<types.length;i++){
|
|
51
|
-
if(''+types[i][idKey]===''+id){
|
|
52
|
-
return types[i][titleKey];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return '';
|
|
57
|
-
}
|
|
58
|
-
const getId=(title)=>{
|
|
59
|
-
if(types){
|
|
60
|
-
for(let i=0;i<types.length;i++){
|
|
61
|
-
if(''+types[i][titleKey]===''+title){
|
|
62
|
-
return types[i][idKey];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return '';
|
|
67
|
-
}
|
|
68
18
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
for(let i=0;i<types.length;i++){
|
|
79
|
-
let item = types[i];
|
|
80
|
-
ret.push({
|
|
81
|
-
label:item[titleKey],
|
|
82
|
-
value:item[idKey],
|
|
83
|
-
key:item[keyName]
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
return ret;
|
|
19
|
+
export const useUserType = useDictionary.createDictionary({
|
|
20
|
+
api:GET_USER_TYPE,
|
|
21
|
+
afterApi:(response)=>{
|
|
22
|
+
if(response?.code==0){
|
|
23
|
+
let req= response.data.map(item=>{
|
|
24
|
+
const {label,value:id,key:name}=item;
|
|
25
|
+
return {label,id,name}
|
|
26
|
+
});
|
|
27
|
+
return req;
|
|
87
28
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return {types,getTitle,getId,isReady,reload,getData,getList}
|
|
29
|
+
return [];
|
|
91
30
|
}
|
|
92
|
-
}
|
|
31
|
+
});
|
|
93
32
|
|
|
94
|
-
export const
|
|
95
|
-
service:GET_USER_TYPE,
|
|
96
|
-
})
|
|
97
|
-
export const useTaskState=bookCreater({
|
|
33
|
+
export const useTaskState= useDictionary.createDictionary({
|
|
98
34
|
defaultTypes:[
|
|
99
|
-
{label:'进行中',
|
|
100
|
-
{label:'已完成',
|
|
35
|
+
{label:'进行中',id:'1',name:'run'},
|
|
36
|
+
{label:'已完成',id:'5',name:'complete'},
|
|
101
37
|
]
|
|
102
38
|
});
|
|
103
39
|
|
|
@@ -5,14 +5,16 @@ import useDelay from './useDelay';
|
|
|
5
5
|
import usePreload from './usePreload';
|
|
6
6
|
import useSearch from './useSearch';
|
|
7
7
|
import useUpdate from './useUpdate';
|
|
8
|
-
import useNextPage from './useNextPage';
|
|
9
8
|
import useLoading from './useLoading';
|
|
9
|
+
import {usePagination,usePaginationWithForm} from 'kn-hooks';
|
|
10
|
+
|
|
10
11
|
export {
|
|
12
|
+
usePaginationWithForm,
|
|
13
|
+
usePagination,
|
|
11
14
|
useImageLoader,
|
|
12
15
|
useDelay,
|
|
13
16
|
usePreload,
|
|
14
17
|
useSearch,
|
|
15
18
|
useUpdate,
|
|
16
|
-
useNextPage,
|
|
17
19
|
useLoading
|
|
18
20
|
}
|
|
@@ -1,11 +1,82 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {usePaginationWithForm} from '@/hooks';
|
|
3
|
+
import {GET_LIST} from '@/services/video';
|
|
4
|
+
import {Table,Pagination,Form,Input,Button} from 'antd';
|
|
3
5
|
|
|
4
6
|
const Page = () => {
|
|
5
|
-
const
|
|
7
|
+
const [form] = Form.useForm();
|
|
6
8
|
|
|
9
|
+
const request = usePaginationWithForm({
|
|
10
|
+
service:GET_LIST,
|
|
11
|
+
pagination:{pageSize:10},
|
|
12
|
+
form:form
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
useEffect(()=>{
|
|
16
|
+
request.update();
|
|
17
|
+
},[])
|
|
18
|
+
|
|
19
|
+
const columns=[{
|
|
20
|
+
dataIndex:'id',
|
|
21
|
+
title:'id',
|
|
22
|
+
render:(_,record,idx)=>{
|
|
23
|
+
return record.id;
|
|
24
|
+
}
|
|
25
|
+
},{
|
|
26
|
+
dataIndex:'value',
|
|
27
|
+
title:'数据值',
|
|
28
|
+
render:(_,record,idx)=>{
|
|
29
|
+
return record.value||'-'
|
|
30
|
+
}
|
|
31
|
+
}];
|
|
32
|
+
|
|
33
|
+
useEffect(()=>{
|
|
34
|
+
console.log(request)
|
|
35
|
+
},[request])
|
|
36
|
+
|
|
37
|
+
const getDataSource=()=>{
|
|
38
|
+
if(request?.data?.length>0){
|
|
39
|
+
let req=request?.data[request.pagination.current-1]||[];
|
|
40
|
+
return req;
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const onPageChange=(current,pageSize)=>{
|
|
46
|
+
debugger;
|
|
47
|
+
request.update({pagination:{current,pageSize}})
|
|
48
|
+
}
|
|
49
|
+
const onSearch=()=>{
|
|
50
|
+
request.update();
|
|
51
|
+
}
|
|
52
|
+
const onReset=()=>{
|
|
53
|
+
request.reset();
|
|
54
|
+
}
|
|
7
55
|
return (
|
|
8
|
-
<
|
|
56
|
+
<section>
|
|
57
|
+
<section style={{display:'flex'}}>
|
|
58
|
+
<Form form={form} >
|
|
59
|
+
<Form.Item name='keywords' label='关键字'>
|
|
60
|
+
<Input />
|
|
61
|
+
</Form.Item>
|
|
62
|
+
</Form>
|
|
63
|
+
<Button onClick={onSearch} type='primary' style={{margin:'0 12px'}}>查询</Button>
|
|
64
|
+
<Button onClick={onReset}>重置</Button>
|
|
65
|
+
</section>
|
|
66
|
+
<Table
|
|
67
|
+
rowKey={'id'}
|
|
68
|
+
loading={!request?.data?.length>0}
|
|
69
|
+
columns={columns}
|
|
70
|
+
dataSource={getDataSource()}
|
|
71
|
+
pagination={false}
|
|
72
|
+
/>
|
|
73
|
+
<Pagination
|
|
74
|
+
current={request?.pagination?.current}
|
|
75
|
+
pageSize={request?.pagination?.pageSize}
|
|
76
|
+
onChange={onPageChange}
|
|
77
|
+
total={request?.pagination?.total}
|
|
78
|
+
/>
|
|
79
|
+
</section>
|
|
9
80
|
)
|
|
10
81
|
}
|
|
11
82
|
|
|
@@ -1,11 +1,64 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {usePagination} from '@/hooks';
|
|
3
|
+
import {GET_LIST} from '@/services/video';
|
|
4
|
+
import {Table,Pagination} from 'antd';
|
|
3
5
|
|
|
4
6
|
const Page = () => {
|
|
5
|
-
const
|
|
7
|
+
const request = usePagination({
|
|
8
|
+
service:GET_LIST,
|
|
9
|
+
pagination:{pageSize:10}
|
|
10
|
+
})
|
|
6
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
|
+
}
|
|
7
46
|
return (
|
|
8
|
-
<
|
|
47
|
+
<section>
|
|
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>
|
|
9
62
|
)
|
|
10
63
|
}
|
|
11
64
|
|
|
@@ -21,12 +21,6 @@ const delayLoader=(loader)=>{
|
|
|
21
21
|
})
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// /*webpackChunkName:'subGroup'*/
|
|
25
|
-
const Home = React.lazy(()=>import('@/pages/index.jsx'));
|
|
26
|
-
const SubHome = React.lazy(()=>import('@/pages/subHome'));
|
|
27
|
-
const SubHome2 = React.lazy(()=>import('@/pages/subHome2'));
|
|
28
|
-
const SubHome3 = React.lazy(()=>import('@/pages/subHome3'));
|
|
29
|
-
const CheckLogin = React.lazy(()=>import('@/pages/checkLogin'));
|
|
30
24
|
|
|
31
25
|
|
|
32
26
|
const Video = React.lazy(()=>import('@/pages/video'));
|
|
@@ -66,10 +60,6 @@ export const RouteList = (
|
|
|
66
60
|
<Route path='/user' element={<User />} />
|
|
67
61
|
<Route path='/userData' element={<UserData />} />
|
|
68
62
|
|
|
69
|
-
{/* <Route path='/home/sub' element={<SubHome />} />
|
|
70
|
-
<Route path='/home/sub/:id' element={<Suspense fallback={<PageLoading />}><SubHome2 /></Suspense>} />
|
|
71
|
-
<Route path='/home/sub3/:id' element={<SubHome3 />} />
|
|
72
|
-
<Route path='/checkLogin' element={<AuthLogin><CheckLogin /></AuthLogin>} /> */}
|
|
73
63
|
</Route>
|
|
74
64
|
</Route>
|
|
75
65
|
</Routes>
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
@@ -64,7 +64,7 @@ a,div,p,span,section,hgroup{
|
|
|
64
64
|
|
|
65
65
|
* {
|
|
66
66
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
67
|
-
position: relative;
|
|
67
|
+
// position: relative;
|
|
68
68
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
69
69
|
-webkit-text-size-adjust: none;
|
|
70
70
|
-webkit-box-sizing: border-box;
|