kn-cli 1.0.60 → 1.0.62
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/build.sh +1 -1
- package/build/dev.sh +1 -1
- package/package.json +1 -1
- package/readme.md +9 -0
- package/src/build.js +28 -9
- package/templates/template_admin/build.sh +7 -1
- package/templates/template_admin/readme.md +8 -0
- package/templates/template_app/build.sh +7 -1
- package/templates/template_app/readme.md +8 -0
- package/templates/template_oa/build.sh +7 -1
- package/templates/template_oa/frontend_build.sh +1 -2
- package/templates/template_oa/package.json +2 -1
- package/templates/template_oa/public/favicon.ico +0 -0
- package/templates/template_oa/public/index.html +1 -1
- package/templates/template_oa/public/src/_antd.less +0 -21
- package/templates/template_oa/public/src/_reset.less +3 -0
- package/templates/template_oa/public/src/_variable.less +1 -1
- package/templates/template_oa/public/src/assets/images/NY-pop-bg.png +0 -0
- package/templates/template_oa/public/src/components/Auth/index.jsx +1 -1
- package/templates/template_oa/public/src/components/Dialog/index.jsx +150 -0
- package/templates/template_oa/public/src/components/Dialog/index.less +123 -0
- package/templates/template_oa/public/src/components/Empty/index.jsx +23 -0
- package/templates/template_oa/public/src/components/Empty/index.less +6 -0
- package/templates/template_oa/public/src/components/FormRow/index.jsx +39 -0
- package/templates/template_oa/public/src/components/FormRow/index.less +67 -0
- package/templates/template_oa/public/src/components/FormTable/index.jsx +136 -0
- package/templates/template_oa/public/src/components/IFrame/index.less +1 -1
- package/templates/template_oa/public/src/components/Layout/Basic/index.jsx +18 -12
- package/templates/template_oa/public/src/components/Layout/Basic/index.less +21 -11
- package/templates/template_oa/public/src/components/Layout/index.jsx +2 -1
- package/templates/template_oa/public/src/components/Nav/index.jsx +163 -100
- package/templates/template_oa/public/src/components/Select/DepSelect/index.jsx +47 -0
- package/templates/template_oa/public/src/components/Select/StaffSelect/index.jsx +97 -0
- package/templates/template_oa/public/src/components/Select/StaffSelect/index.less +24 -0
- package/templates/template_oa/public/src/components/Toast/index.less +1 -1
- package/templates/template_oa/public/src/components/Upload/index.jsx +358 -0
- package/templates/template_oa/public/src/components/title/index.jsx +12 -0
- package/templates/template_oa/public/src/components/title/index.less +21 -0
- package/templates/template_oa/public/src/mock/cases.js +52 -0
- package/templates/template_oa/public/src/mock/index.js +2 -0
- package/templates/template_oa/public/src/pages/components/totalRecord/index.jsx +21 -0
- package/templates/template_oa/public/src/pages/components/totalRecord/index.less +16 -0
- package/templates/template_oa/public/src/pages/login/index.jsx +7 -9
- package/templates/template_oa/public/src/pages/my/index.jsx +14 -0
- package/templates/template_oa/public/src/pages/video/detail/index.jsx +14 -0
- package/templates/template_oa/public/src/pages/video/index.jsx +325 -23
- package/templates/template_oa/public/src/pages/video/index.less +3 -0
- package/templates/template_oa/public/src/provider/app.jsx +14 -81
- package/templates/template_oa/public/src/route.jsx +8 -2
- package/templates/template_oa/public/src/services/cases.js +7 -0
- package/templates/template_oa/public/src/services/common.js +132 -0
- package/templates/template_oa/public/src/services/index.js +42 -8
- package/templates/template_oa/public/src/services/video.js +1 -0
- package/templates/template_oa/public/src/utils/index.js +61 -1
- package/templates/template_oa/readme.md +8 -0
- package/templates/template_oa/webpack.api.js +10 -22
- package/templates/template_offcial/build.sh +7 -1
- package/templates/template_offcial/readme.md +8 -0
- package/templates/template_oa/public/favicon.png +0 -0
- package/templates/template_oa/public/src/components/mask/index.jsx +0 -47
- package/templates/template_oa/public/src/components/mask/index.less +0 -32
- package/templates/template_oa/public/src/dictionary/index.js +0 -39
- package/templates/template_oa/public/src/provider/menu.jsx +0 -20
- package/templates/template_oa/public/src/services/user.js +0 -26
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
|
|
2
|
+
import {GET_TOKEN,GET_DEFAULT_CROSS} from '@/services';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 获取员工列表
|
|
7
|
+
*/
|
|
8
|
+
export async function GET_STAFF_LIST() {
|
|
9
|
+
let ret = await GET_DEFAULT_CROSS(`${OA_HOST}/common/getNewUserList`);
|
|
10
|
+
return ret;
|
|
11
|
+
// let response = await axios({
|
|
12
|
+
// method: 'get',
|
|
13
|
+
// xsrfCookieName: '',
|
|
14
|
+
// xsrfHeaderName: '',
|
|
15
|
+
// withCredentials: true,
|
|
16
|
+
// url: `${EnvConfig.oaHost}/common/getNewUserList`,
|
|
17
|
+
// });
|
|
18
|
+
|
|
19
|
+
// return response && response.data ? response.data : null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 所有部门信息
|
|
24
|
+
*/
|
|
25
|
+
export async function GET_DEP_LIST() {
|
|
26
|
+
return GET_DEFAULT_CROSS(`${OA_HOST}/common/getBenefitDept`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 获取公司信息
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export function GET_COMPANY_LIST(){
|
|
34
|
+
return GET_DEFAULT_CROSS(`${OA_HOST}/filestore/list?status=1`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 上传文件
|
|
42
|
+
*/
|
|
43
|
+
export async function POST_IMPORT_EXCEL(url, file, onProgress) {
|
|
44
|
+
let formdata = new FormData();
|
|
45
|
+
let token = await GET_TOKEN();
|
|
46
|
+
formdata.append('file', file);
|
|
47
|
+
formdata.append('_token', token);
|
|
48
|
+
let response = await axios({
|
|
49
|
+
method: 'post',
|
|
50
|
+
url: url,
|
|
51
|
+
data: formdata,
|
|
52
|
+
onUploadProgress: (e) => {
|
|
53
|
+
onProgress({ percent: `${e.loaded}/${e.total}` * 100 });
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return response && response.data ? response.data : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 获取下载文件的url路径
|
|
61
|
+
*/
|
|
62
|
+
export function GET_DOWNLOAD_FILE(s_name) {
|
|
63
|
+
return `${OA_HOST}/file/download?name=${s_name}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
export async function UPLOAD_FILE(file, param, onProgress) {
|
|
69
|
+
// return new Promise(res=>{
|
|
70
|
+
// res({
|
|
71
|
+
// url:'https://officialwebsite-static.kingnet.com/20210312142223-360%E6%88%AA%E5%9B%BE20210312142143898.jpg',
|
|
72
|
+
// key:'123',
|
|
73
|
+
// })
|
|
74
|
+
// });
|
|
75
|
+
let token = await GET_TOKEN();
|
|
76
|
+
let formdata = new FormData();
|
|
77
|
+
|
|
78
|
+
formdata.append('uploadFile', file);
|
|
79
|
+
formdata.append('_token', token);
|
|
80
|
+
|
|
81
|
+
let response = await axios({
|
|
82
|
+
method: 'post',
|
|
83
|
+
url: `${OA_HOST}/file/upload`,
|
|
84
|
+
data: formdata,
|
|
85
|
+
xsrfCookieName: '',
|
|
86
|
+
xsrfHeaderName: '',
|
|
87
|
+
withCredentials: true,
|
|
88
|
+
|
|
89
|
+
onUploadProgress: (e) => {
|
|
90
|
+
let per = parseFloat((e.loaded / e.total) * 100).toFixed(0);
|
|
91
|
+
onProgress({ percent: per });
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
if(response&&response.data&&response.data.info){
|
|
95
|
+
response = response.data.info;
|
|
96
|
+
response = {
|
|
97
|
+
url:response.s_name,
|
|
98
|
+
key:response.c_name
|
|
99
|
+
};
|
|
100
|
+
}else{
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return response||null;
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 检查文件类型
|
|
109
|
+
* filename:文件名称
|
|
110
|
+
* types:array|string,['png','gif']|'png' 类型
|
|
111
|
+
*/
|
|
112
|
+
export function CHECK_FILE_TYPE(types, filename) {
|
|
113
|
+
let reg = '';
|
|
114
|
+
|
|
115
|
+
if (types.constructor === Array) {
|
|
116
|
+
types = types.join('|');
|
|
117
|
+
}
|
|
118
|
+
reg = `[.](${types})$`;
|
|
119
|
+
reg = new RegExp(reg, 'i');
|
|
120
|
+
return reg.test(filename);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 模拟延迟
|
|
127
|
+
*/
|
|
128
|
+
export async function DELAY(ms) {
|
|
129
|
+
return new Promise((reslove) => {
|
|
130
|
+
setTimeout(reslove, ms);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
@@ -15,7 +15,8 @@ let Modal = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
let jwt = '';
|
|
18
|
-
let logout = ()=>{
|
|
18
|
+
let logout = ()=>{
|
|
19
|
+
}
|
|
19
20
|
|
|
20
21
|
export const setJwt = (value) => {
|
|
21
22
|
if(value==''){
|
|
@@ -62,9 +63,9 @@ axios.interceptors.response.use(
|
|
|
62
63
|
return response;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
if (Number(response.data.code) !==
|
|
66
|
-
console.log(`${JSON.stringify(response.data)}`);
|
|
67
|
-
Modal.error({ title: `注意`, content: `${response.data.
|
|
66
|
+
if (Number(response.data.code) !== 1) {
|
|
67
|
+
// console.log(`${JSON.stringify(response.data)}`);
|
|
68
|
+
Modal.error({ title: `注意`, content: `${response.data.info}(${response.data.code})` });
|
|
68
69
|
}
|
|
69
70
|
return response;
|
|
70
71
|
},
|
|
@@ -79,7 +80,7 @@ axios.interceptors.response.use(
|
|
|
79
80
|
} else if (error.response.status === 403) {
|
|
80
81
|
Modal.error({
|
|
81
82
|
title: '提示',
|
|
82
|
-
content: `${error.response.data.
|
|
83
|
+
content: `${error.response.data.info}`,
|
|
83
84
|
});
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
@@ -148,11 +149,14 @@ export async function POST_DEFAULT(url, params, method, options) {
|
|
|
148
149
|
// } else {
|
|
149
150
|
// data = { ...params };
|
|
150
151
|
// }
|
|
151
|
-
|
|
152
|
+
let token= await GET_TOKEN();
|
|
152
153
|
let response = await axios({
|
|
153
154
|
method: method || 'POST',
|
|
154
155
|
url: url,
|
|
155
|
-
data
|
|
156
|
+
data:{
|
|
157
|
+
_token:token,
|
|
158
|
+
...data
|
|
159
|
+
},
|
|
156
160
|
...options,
|
|
157
161
|
// headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
158
162
|
});
|
|
@@ -160,6 +164,8 @@ export async function POST_DEFAULT(url, params, method, options) {
|
|
|
160
164
|
}
|
|
161
165
|
|
|
162
166
|
export async function POST_DEFAULT_CROSS(url, params) {
|
|
167
|
+
let token= await GET_TOKEN();
|
|
168
|
+
|
|
163
169
|
let data = {};
|
|
164
170
|
// if (params) params = qs.stringify(params, { arrayFormat: 'indices' });
|
|
165
171
|
|
|
@@ -169,13 +175,41 @@ export async function POST_DEFAULT_CROSS(url, params) {
|
|
|
169
175
|
data = { ...params };
|
|
170
176
|
}
|
|
171
177
|
let response = await axios({
|
|
178
|
+
headers:{
|
|
179
|
+
'X-XSRF-TOKEN': token,
|
|
180
|
+
},
|
|
172
181
|
method: 'POST',
|
|
173
182
|
url: url,
|
|
174
183
|
xsrfCookieName: '',
|
|
175
184
|
xsrfHeaderName: '',
|
|
176
185
|
withCredentials: true,
|
|
177
|
-
data
|
|
186
|
+
data: {
|
|
187
|
+
_token:token,
|
|
188
|
+
...data,
|
|
189
|
+
},
|
|
178
190
|
});
|
|
179
191
|
|
|
180
192
|
return response && response.data ? response.data : null;
|
|
181
193
|
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
/**************************************************************************
|
|
197
|
+
* 基础共享接口
|
|
198
|
+
*************************************************************************/
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 获取用户token
|
|
204
|
+
*/
|
|
205
|
+
export async function GET_TOKEN() {
|
|
206
|
+
let cookie = document.cookie.split(';').map(item=>item.split('='));
|
|
207
|
+
let xsrf = cookie.filter(item=>item[0].trim().toUpperCase()==='CSRF-TOKEN')
|
|
208
|
+
return Promise.resolve(xsrf[0][1]);
|
|
209
|
+
// let response = await axios({
|
|
210
|
+
// method: 'get',
|
|
211
|
+
// url: '/csrf_token',
|
|
212
|
+
// })
|
|
213
|
+
// return (response && response.data) ? response.data : null;
|
|
214
|
+
}
|
|
215
|
+
|
|
@@ -63,4 +63,64 @@ export const closeWindow = () => {
|
|
|
63
63
|
window.close();
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 数组转对象, lodash的keyBy
|
|
71
|
+
* @param {*} array
|
|
72
|
+
* @param {*} key
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
const keyBy = (array, key) => {
|
|
76
|
+
const obj = {};
|
|
77
|
+
array.map(i => {
|
|
78
|
+
obj[i[key]] = i;
|
|
79
|
+
})
|
|
80
|
+
return obj;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 案件类型枚举
|
|
85
|
+
*/
|
|
86
|
+
export const caseTypeEnum = [
|
|
87
|
+
{value: '1', label: '诉讼'},
|
|
88
|
+
{value: '2', label: '劳动仲裁'},
|
|
89
|
+
{value: '3', label: '商事仲裁'},
|
|
90
|
+
]
|
|
91
|
+
export const caseTypeEnumObjByValue = keyBy(caseTypeEnum, 'value');
|
|
92
|
+
/**
|
|
93
|
+
* 案件状态枚举
|
|
94
|
+
*/
|
|
95
|
+
export const caseStatusEnum = [
|
|
96
|
+
{value: '1', label: '审理中'},
|
|
97
|
+
{value: '2', label: '已终结'},
|
|
98
|
+
]
|
|
99
|
+
export const caseStatusEnumObjByValue = keyBy(caseStatusEnum, 'value');
|
|
100
|
+
/**
|
|
101
|
+
* 案件是否保全枚举
|
|
102
|
+
*/
|
|
103
|
+
export const caseIsPreservationEnum = [
|
|
104
|
+
{value: '1', label: '是'},
|
|
105
|
+
{value: '2', label: '否'},
|
|
106
|
+
]
|
|
107
|
+
export const caseIsPreservationEnumObjByValue = keyBy(caseIsPreservationEnum, 'value');
|
|
108
|
+
/**
|
|
109
|
+
* 申请法院强制执行 枚举
|
|
110
|
+
*/
|
|
111
|
+
export const caseEnforceEnum = [
|
|
112
|
+
{value: '1', label: '是'},
|
|
113
|
+
{value: '2', label: '否'},
|
|
114
|
+
]
|
|
115
|
+
export const caseEnforceEnumObjByValue = keyBy(caseEnforceEnum, 'value');
|
|
116
|
+
/**
|
|
117
|
+
* 配置页面模块 枚举
|
|
118
|
+
*/
|
|
119
|
+
export const moduleEnum = [
|
|
120
|
+
{value: '0', label: '基本信息'},
|
|
121
|
+
{value: '1', label: '仲裁'},
|
|
122
|
+
{value: '2', label: '一审'},
|
|
123
|
+
{value: '3', label: '二审'},
|
|
124
|
+
{value: '4', label: '执行'},
|
|
125
|
+
{value: '5', label: '提醒事项'},
|
|
126
|
+
]
|
|
@@ -21,6 +21,14 @@ kn-cli --dev
|
|
|
21
21
|
构建方式:执行仓库下 sh frontend_build.sh
|
|
22
22
|
部署方式:将构建完成的文件夹下的 `release` 内的内容部署到目标服务器
|
|
23
23
|
参考应用:oa-app
|
|
24
|
+
其它要求:nginx添加对index.html的缓存策略,配置如下:
|
|
25
|
+
expires 0;
|
|
26
|
+
add_header Cache-Control "max-age=0";
|
|
27
|
+
add_header Cache-Control "private";
|
|
28
|
+
add_header Cache-Control "no-store";
|
|
29
|
+
add_header Cache-Control "no-cache";
|
|
30
|
+
add_header Cache-Control "must-revalidate";
|
|
31
|
+
add_header Cache-Control "proxy-revalidate";
|
|
24
32
|
|
|
25
33
|
```
|
|
26
34
|
2. 进入CICD,构建相应环境
|
|
@@ -2,20 +2,23 @@ const configs = {
|
|
|
2
2
|
// 本地研发环境(npm start)
|
|
3
3
|
localdebug: {
|
|
4
4
|
API_HOST: '/api',
|
|
5
|
-
OA_HOST: '',
|
|
6
|
-
OA_MENU_HOST:'/oa-menu
|
|
5
|
+
OA_HOST: '/oaApi',
|
|
6
|
+
OA_MENU_HOST:'//192.168.90.250:8020/oa-menu/?mock=1',
|
|
7
|
+
LOGIN_URL: 'http://192.168.90.250:8886'
|
|
7
8
|
},
|
|
8
9
|
// cicd构建时研发环境
|
|
9
10
|
dev: {
|
|
10
11
|
API_HOST: 'http://dev-drama-admin-api.skitoon.com',
|
|
11
12
|
OA_HOST: 'http://192.168.90.250:8886',
|
|
12
|
-
OA_MENU_HOST:'//192.168.90.250:8020/oa-menu/'
|
|
13
|
+
OA_MENU_HOST:'//192.168.90.250:8020/oa-menu/',
|
|
14
|
+
LOGIN_URL: 'http://192.168.90.250:8886'
|
|
13
15
|
},
|
|
14
16
|
// cicd构建时生产环境
|
|
15
17
|
prod: {
|
|
16
18
|
API_HOST: 'http://dev-drama-admin-api.skitoon.com',
|
|
17
19
|
OA_HOST: 'https://oa.kingnet.com',
|
|
18
|
-
OA_MENU_HOST:'//micro-front.kingnet.com/oa-menu/'
|
|
20
|
+
OA_MENU_HOST:'//micro-front.kingnet.com/oa-menu/',
|
|
21
|
+
LOGIN_URL: 'https://oa.kingnet.com'
|
|
19
22
|
},
|
|
20
23
|
};
|
|
21
24
|
|
|
@@ -28,29 +31,14 @@ const API_PROXY= {
|
|
|
28
31
|
'^/api': '/', // rewrite path
|
|
29
32
|
},
|
|
30
33
|
},
|
|
31
|
-
'/
|
|
32
|
-
target: 'http://192.168.90.250:8886/
|
|
34
|
+
'/oaApi/**': {
|
|
35
|
+
target: 'http://192.168.90.250:8886/',
|
|
33
36
|
changeOrigin: true,
|
|
34
37
|
logLevel: 'debug',
|
|
35
38
|
pathRewrite: {
|
|
36
|
-
'^/
|
|
39
|
+
'^/oaApi': '/', // rewrite path
|
|
37
40
|
},
|
|
38
41
|
},
|
|
39
|
-
'/file/':{
|
|
40
|
-
target:'http://192.168.90.250:8886/file/',
|
|
41
|
-
changeOrigin:true,
|
|
42
|
-
pathRewrite: {
|
|
43
|
-
'^/file': '/', // rewrite path
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
'/oa-menu/**': {
|
|
47
|
-
target: 'http://192.168.90.250:8020/oa-menu/',
|
|
48
|
-
changeOrigin: true,
|
|
49
|
-
logLevel: 'debug',
|
|
50
|
-
pathRewrite: {
|
|
51
|
-
'^/oa-menu': '/', // rewrite path
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
42
|
};
|
|
55
43
|
|
|
56
44
|
const env = process.env.build_env||'localdebug';
|
|
@@ -21,6 +21,14 @@ sh dev.sh
|
|
|
21
21
|
构建方式:执行仓库下 sh frontend_build.sh
|
|
22
22
|
部署方式:将构建完成的文件夹下的 `release` 内的内容部署到目标服务器
|
|
23
23
|
参考应用:oa-app
|
|
24
|
+
其它要求:nginx添加对index.html的缓存策略,配置如下:
|
|
25
|
+
expires 0;
|
|
26
|
+
add_header Cache-Control "max-age=0";
|
|
27
|
+
add_header Cache-Control "private";
|
|
28
|
+
add_header Cache-Control "no-store";
|
|
29
|
+
add_header Cache-Control "no-cache";
|
|
30
|
+
add_header Cache-Control "must-revalidate";
|
|
31
|
+
add_header Cache-Control "proxy-revalidate";
|
|
24
32
|
|
|
25
33
|
```
|
|
26
34
|
2. 进入CICD,构建相应环境
|
|
Binary file
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import styles from './index.less';
|
|
4
|
-
import Popup from '@/components/Popup/index.jsx';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const useToast = () => {
|
|
8
|
-
|
|
9
|
-
const ref = useRef();
|
|
10
|
-
|
|
11
|
-
const runNext = (props) => {
|
|
12
|
-
console.log(props.popup.dom);
|
|
13
|
-
ReactDOM.render(
|
|
14
|
-
<Toast {...props} />,
|
|
15
|
-
props.popup.dom
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const Toast = ({ children }) => {
|
|
20
|
-
return (
|
|
21
|
-
<section className={styles.wrap}>
|
|
22
|
-
<div className={styles.content + ` animate__animated animate__fast`}>
|
|
23
|
-
{children}
|
|
24
|
-
</div>
|
|
25
|
-
</section>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const hiddenToast = () => {
|
|
30
|
-
ref.current.destory();
|
|
31
|
-
}
|
|
32
|
-
const showToast = props => {
|
|
33
|
-
props = { children: props }
|
|
34
|
-
return new Promise((resolve) => {
|
|
35
|
-
let popup = Popup(resolve);
|
|
36
|
-
ref.current = popup;
|
|
37
|
-
props.popup = popup;
|
|
38
|
-
runNext(props);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
showToast, hiddenToast
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default useToast;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
@import '~@/_variable.less';
|
|
2
|
-
|
|
3
|
-
.wrap{
|
|
4
|
-
position: fixed;
|
|
5
|
-
left:0;
|
|
6
|
-
top:0;
|
|
7
|
-
width:100vw;
|
|
8
|
-
height:100vh;
|
|
9
|
-
display: flex;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
align-items: center;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
z-index: 1000;
|
|
14
|
-
.content{
|
|
15
|
-
position: fixed;
|
|
16
|
-
left:0;
|
|
17
|
-
top:0;
|
|
18
|
-
width:100vw;
|
|
19
|
-
height:100vh;
|
|
20
|
-
|
|
21
|
-
background: rgba(0,0,0,.8);
|
|
22
|
-
padding:var(--padding-default);
|
|
23
|
-
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
align-items: center;
|
|
28
|
-
|
|
29
|
-
font-size: 14px;
|
|
30
|
-
color: #FFFFFF;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useState, useEffect,useMemo} from 'react';
|
|
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
|
-
}
|
|
15
|
-
|
|
16
|
-
useDictionary.SetConfig({SelectOption})
|
|
17
|
-
|
|
18
|
-
|
|
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;
|
|
28
|
-
}
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export const useTaskState= useDictionary.createDictionary({
|
|
34
|
-
defaultTypes:[
|
|
35
|
-
{label:'进行中',id:'1',name:'run'},
|
|
36
|
-
{label:'已完成',id:'5',name:'complete'},
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useState,useMemo } from 'react';
|
|
2
|
-
import { createContainer } from "unstated-next"
|
|
3
|
-
import {GET_MENU} from '@/services/auth';
|
|
4
|
-
|
|
5
|
-
const useProvider=() =>{
|
|
6
|
-
const [menus,setMenus]= useState([]);
|
|
7
|
-
|
|
8
|
-
const reload= async ()=>{
|
|
9
|
-
await GET_MENU();
|
|
10
|
-
}
|
|
11
|
-
const action=useMemo(()=>{
|
|
12
|
-
return {
|
|
13
|
-
menus,setMenus
|
|
14
|
-
}
|
|
15
|
-
},[menus,setMenus]);
|
|
16
|
-
return action
|
|
17
|
-
}
|
|
18
|
-
const App = createContainer(useProvider);
|
|
19
|
-
|
|
20
|
-
export default App;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {GET_DEFAULT,PUT_DEFAULT,POST_DEFAULT,API_ROOT} from './index.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export function GET_USER(){
|
|
6
|
-
return GET_DEFAULT(`${HOST}/user`);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function SET_USER(params={
|
|
10
|
-
name:'',
|
|
11
|
-
age:''
|
|
12
|
-
}){
|
|
13
|
-
return POST_DEFAULT(`${HOST}/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
|
-
}
|