kn-cli 1.0.93 → 1.0.95
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/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/topMenu/index.jsx +28 -15
- package/templates/template_admin/public/src/components/table/index.jsx +62 -0
- package/templates/template_admin/public/src/dictionary/index.js +45 -3
- package/templates/template_admin/public/src/mock/demo.js +184 -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 +20 -10
- package/templates/template_admin/public/src/provider/menu.jsx +58 -173
- package/templates/template_admin/public/src/route.jsx +19 -25
- 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/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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import {GET_DEFAULT,POST_DEFAULT,API_ROOT,RESPONSE_STRUCT} from './index.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export function GET_LIST(params) {
|
|
8
|
+
return GET_DEFAULT(`${API_ROOT}/api/demo/list`,params);
|
|
9
|
+
}
|
|
10
|
+
export function GET_DETAIL(params) {
|
|
11
|
+
return GET_DEFAULT(`${API_ROOT}/api/demo/detail`,params);
|
|
12
|
+
}
|
|
13
|
+
export function CREATE(params) {
|
|
14
|
+
return POST_DEFAULT(`${API_ROOT}/api/demo/create`,params)
|
|
15
|
+
}
|
|
16
|
+
export function UPDATE(params) {
|
|
17
|
+
return POST_DEFAULT(`${API_ROOT}/api/demo/update`,params)
|
|
18
|
+
}
|
|
19
|
+
export function GET_USER_INFO(){
|
|
20
|
+
return GET_DEFAULT(`${API_ROOT}/api/demo/userInfo`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function GET_ENUM_TYPE(){
|
|
24
|
+
return GET_DEFAULT(`${API_ROOT}/api/demo/enumType`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const FormatTableService = (response)=>{
|
|
28
|
+
let req={
|
|
29
|
+
code:response[RESPONSE_STRUCT.CODE]||0,
|
|
30
|
+
data:response[RESPONSE_STRUCT.DATA]||null,
|
|
31
|
+
msg:response[RESPONSE_STRUCT.MSG]||''
|
|
32
|
+
};
|
|
33
|
+
if(response[RESPONSE_STRUCT.PAGINATION]){
|
|
34
|
+
req.page = response[RESPONSE_STRUCT.PAGINATION]
|
|
35
|
+
}
|
|
36
|
+
return req;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export function Login(params={
|
|
41
|
+
username:'',
|
|
42
|
+
password:'',
|
|
43
|
+
}){
|
|
44
|
+
return POST_DEFAULT(`${API_ROOT}/api/demo/login`,params)
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function KssoLogin(params={
|
|
49
|
+
code:'',
|
|
50
|
+
redirectUri:'',
|
|
51
|
+
}){
|
|
52
|
+
return POST_DEFAULT(`${API_ROOT}/api/demo/ksso/auth`,params)
|
|
53
|
+
|
|
54
|
+
}
|
|
@@ -13,6 +13,15 @@ export const API_ROOT = API_HOST;
|
|
|
13
13
|
const tokenMode='header';//header,cookie
|
|
14
14
|
const tokenName='Authorization';
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const RESPONSE_STRUCT={
|
|
19
|
+
CODE:'code',
|
|
20
|
+
MSG:'msg',
|
|
21
|
+
DATA:'data',
|
|
22
|
+
PAGINATION:'pagination'
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
let Modal = {
|
|
17
26
|
error: (options) => {
|
|
18
27
|
message.error(options.content);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* 格式化为货币格式
|
|
4
|
+
* @param {string|number} value - 数值
|
|
5
|
+
* @param {number} decimal=2 - 格式化到小数点后几位
|
|
6
|
+
* @param {object} extra - 扩展参数
|
|
7
|
+
* @returns {string} 格式化后的字符串
|
|
8
|
+
*/
|
|
9
|
+
export const formatMoney=(value,decimal=2,extra={noValue:'-',carry:false})=>{
|
|
10
|
+
const {noValue='-',carry=false}=extra;
|
|
11
|
+
try{
|
|
12
|
+
value = parseFloat(`${value}`);
|
|
13
|
+
if(Number.isNaN(value)){
|
|
14
|
+
value='';
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if(carry){
|
|
18
|
+
value = value.toFixed(decimal);
|
|
19
|
+
}else{
|
|
20
|
+
value = value.toFixed(decimal+1);
|
|
21
|
+
value = value.slice(0,-1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch(ex){
|
|
25
|
+
value='';
|
|
26
|
+
}finally{
|
|
27
|
+
if(value===''){
|
|
28
|
+
return noValue||'';
|
|
29
|
+
}
|
|
30
|
+
return `${value}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const formatText=(value,extra={noValue:'-'})=>{
|
|
35
|
+
const {noValue='-'}= extra;
|
|
36
|
+
if(!value){
|
|
37
|
+
if(noValue)return noValue;
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export const formatPhone=(value,extra={noValue:'-'})=>{
|
|
44
|
+
const {noValue='-'}= extra;
|
|
45
|
+
if(!value){
|
|
46
|
+
if(noValue)return noValue;
|
|
47
|
+
}
|
|
48
|
+
return value.replace(/(\d)(?=(\d{4})+$)/g, '$1-');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
//必填
|
|
2
|
+
const rule_required = { validator: async (rule,value)=>{
|
|
3
|
+
if(value===null||value===undefined||value===Number.NaN){
|
|
4
|
+
throw new Error('请填写');
|
|
5
|
+
}
|
|
6
|
+
if(!/\S+/.test(value)){
|
|
7
|
+
throw new Error('请填写');
|
|
8
|
+
}
|
|
9
|
+
return true;
|
|
10
|
+
}, message: '请填写' };
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
//整数
|
|
14
|
+
const rule_number = { pattern: /^\d*$/, message: '请填写整数数字' };
|
|
15
|
+
//可以带小数
|
|
16
|
+
const rule_float = {
|
|
17
|
+
pattern: /^([1-9]\d*$|\d+[.]\d{1,5}$)|0$/,
|
|
18
|
+
message: '请填写数字可以带小数,小数点后最长5位',
|
|
19
|
+
};
|
|
20
|
+
// pattern:/^\d+[.]{0,1}\d+$/};
|
|
21
|
+
|
|
22
|
+
const rule_xss = {
|
|
23
|
+
validator: async (rule, value) => {
|
|
24
|
+
if (/<script>/gi.test(value) || /%3Cscript/gi.test(value)) {
|
|
25
|
+
throw new Error('不能包含<script>');
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
},
|
|
29
|
+
message: '不能包含<script>',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const rule_max_title = { max: 32, message: '长度不能超过32位' };
|
|
33
|
+
const rule_max_normal = { max: 128, message: '长度不能超过128位'};
|
|
34
|
+
const rule_max_textarea = { max: 20480, message: '长度不能超过20480位' };
|
|
35
|
+
const rule_max_number = { pattern: /^\d{0,12}$/, message: '长度不能超过12位' };
|
|
36
|
+
const rule_max_weight = { pattern: /^\d{0,4}$/, message: '长度不能超过4位' };
|
|
37
|
+
const rule_max_numberStr = { pattern: /^\S{0,13}$/, message: '长度不能超过12位' };
|
|
38
|
+
|
|
39
|
+
const RULE_INPUT = [rule_required, rule_max_normal];
|
|
40
|
+
const RULE_INPUT_NR = [rule_max_normal];
|
|
41
|
+
|
|
42
|
+
const RULE_TITLE = [rule_required, rule_max_title];
|
|
43
|
+
const RULE_TEXTAREA = [rule_required, rule_max_textarea];
|
|
44
|
+
const RULE_INPUT_NUMBER = [rule_required, rule_number, rule_max_number];
|
|
45
|
+
const RULE_INPUT_NUMBER_NR = [rule_number, rule_max_number];
|
|
46
|
+
const RULE_INPUT_FLOAT = [rule_required, rule_float, rule_max_numberStr];
|
|
47
|
+
|
|
48
|
+
const RULE_INPUT_WEIGHT_NUMBER = [rule_required, rule_number, rule_max_weight];
|
|
49
|
+
const RULE_INPUT_WEIGHT_NUMBER_NR = [rule_number, rule_max_weight];
|
|
50
|
+
|
|
51
|
+
const RULE_SELECT = [{ required: true, message: '请选择' }];
|
|
52
|
+
const RULE_UPLOAD = [{ required: true, message: '请上传' }];
|
|
53
|
+
const rule_max_link = { max: 1024, message: '长度不能超过1024位' };
|
|
54
|
+
|
|
55
|
+
const RULE_LINK = [rule_required, rule_max_link];
|
|
56
|
+
const RULE_LINK_NR = [rule_max_link];
|
|
57
|
+
|
|
58
|
+
const rule_pwd = {
|
|
59
|
+
pattern: /^\w{6,16}$/,
|
|
60
|
+
type: 'string',
|
|
61
|
+
message: '请输入6-16位字母、下划线、数字任意组合的字符',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const RULE_PWD = [rule_required, rule_pwd];
|
|
65
|
+
const RULE_PWD_NR = [rule_pwd];
|
|
66
|
+
|
|
67
|
+
const rule_account = {
|
|
68
|
+
pattern: /^\w{1,12}$/,
|
|
69
|
+
type: 'string',
|
|
70
|
+
message: '请输入1-12位字母、下划线、数字任意组合的字符',
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const RULE_ACCOUNT = [rule_required, rule_account];
|
|
74
|
+
const RULE_ACCOUNT_NR = [rule_account];
|
|
75
|
+
|
|
76
|
+
const rule_nickname = {
|
|
77
|
+
pattern: /^[\u4E00-\u9FA5A-Za-z0-9`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]{2,16}$/,
|
|
78
|
+
message: '请输入2-16为可见字符',
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const RULE_NICKNAME = [rule_required, rule_nickname];
|
|
82
|
+
|
|
83
|
+
const RULE_NICKNAME_NR = [rule_nickname];
|
|
84
|
+
|
|
85
|
+
const rule_phone = { pattern: /^1\d{10}$/, message: '请输入正确的手机格式' };
|
|
86
|
+
const RULE_PHONE_NR = [rule_phone];
|
|
87
|
+
const RULE_PHONE = [rule_required, rule_phone];
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
export const CUSTOM={
|
|
91
|
+
INPUT:(options)=>{
|
|
92
|
+
const {required=true,max=false,min=false,noSpace=false} = options;
|
|
93
|
+
let ret=[];
|
|
94
|
+
if(required){ret.push(rule_required)}
|
|
95
|
+
|
|
96
|
+
if(noSpace){
|
|
97
|
+
ret.push({
|
|
98
|
+
validator:async (rule,value='')=>{
|
|
99
|
+
let temp = value.trim();
|
|
100
|
+
if (/\s+/g.test(temp)) {
|
|
101
|
+
throw new Error('字符串中间不能包含空格');
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
},
|
|
105
|
+
message:`字符串中间不能包含空格`
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
if(max===false){
|
|
109
|
+
ret.push(rule_max_normal);
|
|
110
|
+
}else{
|
|
111
|
+
ret.push({
|
|
112
|
+
validator:async (rule,value='')=>{
|
|
113
|
+
let temp = value.trim();
|
|
114
|
+
if(temp.length <= max) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
throw new Error(`最多不能超过${max}个字`);
|
|
118
|
+
},
|
|
119
|
+
message:`最多不能超过${max}个字`
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
if(min){
|
|
123
|
+
ret.push({
|
|
124
|
+
validator:async (rule,value='')=>{
|
|
125
|
+
let temp = value.trim();
|
|
126
|
+
if (temp.length>=min) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
throw new Error(`最少需要${min}个字`);
|
|
130
|
+
},
|
|
131
|
+
message:`最少需要${min}个字`
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
return ret;
|
|
135
|
+
},
|
|
136
|
+
NUMBER:(options)=>{
|
|
137
|
+
const {required=true,max=false,min=false} = options;
|
|
138
|
+
let ret=[];
|
|
139
|
+
if(required){ret.push(rule_required)}
|
|
140
|
+
if(max){
|
|
141
|
+
ret.push({
|
|
142
|
+
validator:async (rule,value='')=>{
|
|
143
|
+
if ( +value <= max ) {
|
|
144
|
+
return true
|
|
145
|
+
}
|
|
146
|
+
throw new Error(`数值必须小于${max}`);
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
if(min){
|
|
151
|
+
ret.push({
|
|
152
|
+
validator:async (rule,value='')=>{
|
|
153
|
+
if ( +value >= min ) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
throw new Error(`数值必须大于${min}`);
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
return ret;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const list = {
|
|
165
|
+
INPUT: RULE_INPUT,
|
|
166
|
+
INPUT_NR: RULE_INPUT_NR,
|
|
167
|
+
SELECT: RULE_SELECT,
|
|
168
|
+
UPLOAD: RULE_UPLOAD,
|
|
169
|
+
TEXTAREA: RULE_TEXTAREA,
|
|
170
|
+
NUMBER: RULE_INPUT_NUMBER,
|
|
171
|
+
NUMBER_NR: RULE_INPUT_NUMBER_NR,
|
|
172
|
+
TITLE: RULE_TITLE,
|
|
173
|
+
FLOAT: RULE_INPUT_FLOAT,
|
|
174
|
+
LINK: RULE_LINK,
|
|
175
|
+
LINK_NR: RULE_LINK_NR,
|
|
176
|
+
PWD: RULE_PWD,
|
|
177
|
+
PWD_NR: RULE_PWD_NR,
|
|
178
|
+
ACCOUNT: RULE_ACCOUNT,
|
|
179
|
+
ACCOUNT_NR: RULE_ACCOUNT_NR,
|
|
180
|
+
NICKNAME: RULE_NICKNAME,
|
|
181
|
+
NICKNAME_NR: RULE_NICKNAME_NR,
|
|
182
|
+
PHONE: RULE_PHONE,
|
|
183
|
+
PHONE_NR: RULE_PHONE_NR,
|
|
184
|
+
WEIGHT: RULE_INPUT_WEIGHT_NUMBER,
|
|
185
|
+
WEIGHT_NR: RULE_INPUT_WEIGHT_NUMBER_NR,
|
|
186
|
+
};
|
|
187
|
+
Object.keys(list).forEach((key) => {
|
|
188
|
+
const rule = list[key];
|
|
189
|
+
list[key] = [rule_xss, ...rule];
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
export const validate=async (value,rules)=>{
|
|
194
|
+
for(let i=0;i<rules.length;i++){
|
|
195
|
+
let rule = rules[i];
|
|
196
|
+
let type =rule.type||'string';
|
|
197
|
+
let pattern = rule.pattern||'';
|
|
198
|
+
|
|
199
|
+
let numberValue;
|
|
200
|
+
let textValue;
|
|
201
|
+
if(type=='number'){
|
|
202
|
+
numberValue = Number(value);
|
|
203
|
+
}else{
|
|
204
|
+
textValue= `${value}`.trim();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if(pattern){
|
|
208
|
+
if(!pattern.test(value)){
|
|
209
|
+
return {success:false,message:rule.message};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// 必填
|
|
213
|
+
if(rule.required){
|
|
214
|
+
pattern = /\S+/
|
|
215
|
+
if(!pattern.test(textValue)){
|
|
216
|
+
return {success:false,message:rule.message};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// 字符长度
|
|
220
|
+
if(rule.len && type == 'string'){
|
|
221
|
+
pattern = `^.{${rule.len}}$`;
|
|
222
|
+
pattern = new RegExp(pattern);
|
|
223
|
+
if(!pattern.test(textValue)){
|
|
224
|
+
return {success:false,message:rule.message};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if(rule.max){
|
|
229
|
+
if(type=='number'){ // 最大数值
|
|
230
|
+
if(numberValue > +rule.max){
|
|
231
|
+
return {success:false,message:rule.message};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else if(type=='string'){ // 最大字符串长度
|
|
235
|
+
pattern = `^.{0,${rule.max}}$`;
|
|
236
|
+
pattern = new RegExp(pattern);
|
|
237
|
+
if(!pattern.test(textValue)){
|
|
238
|
+
return {success:false,message:rule.message};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if(rule.min){
|
|
243
|
+
if(type=='number'){
|
|
244
|
+
if(numberValue < +rule.min){ // 最小数值
|
|
245
|
+
return {success:false,message:rule.message};;
|
|
246
|
+
}
|
|
247
|
+
}else if(type=='string'){// 最小字符串长度
|
|
248
|
+
pattern = `^.{${rule.min},}$`;
|
|
249
|
+
pattern = new RegExp(pattern);
|
|
250
|
+
if(!pattern.test(textValue)){
|
|
251
|
+
return {success:false,message:rule.message};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if(rule.enum){
|
|
256
|
+
if(!rule.enum.includes(textValue)){
|
|
257
|
+
return {success:false,message:rule.message};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if(rule.validator){
|
|
261
|
+
try{
|
|
262
|
+
let req = await rule.validator(null,value);
|
|
263
|
+
}catch(ex){
|
|
264
|
+
return {success:false,message:ex.message}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return {success:true};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
export default list;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {waitTime,REP_SUCCESS} from './utils.js';
|
|
2
|
-
import qs from 'qs';
|
|
3
|
-
import {GET_REQUEST} from './utils';
|
|
4
|
-
|
|
5
|
-
async function GET_MENU(req,res){
|
|
6
|
-
await waitTime();
|
|
7
|
-
const MenuRoute=[
|
|
8
|
-
{
|
|
9
|
-
name:'顶部菜单',
|
|
10
|
-
url:'/video',
|
|
11
|
-
children:[
|
|
12
|
-
{
|
|
13
|
-
name:'内容管理',
|
|
14
|
-
icon:'AppstoreOutlined',
|
|
15
|
-
children:[
|
|
16
|
-
{name:'剧集管理',url:'/video'},
|
|
17
|
-
{name:'素材管理',url:'/material'},
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name:'数据管理',
|
|
23
|
-
icon:'AppstoreOutlined',
|
|
24
|
-
children:[
|
|
25
|
-
{name:'订单数据',url:'/order'},
|
|
26
|
-
{name:'用户数据',url:'/userData'},
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name:'用户管理',
|
|
31
|
-
icon:'UserOutlined',
|
|
32
|
-
url:'/user'
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name:'客诉管理',
|
|
36
|
-
icon:'CustomerServiceOutlined',
|
|
37
|
-
url:'/suggest'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name:'权限配置',
|
|
41
|
-
icon:'CrownOutlined',
|
|
42
|
-
url:'/permission'
|
|
43
|
-
},
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
return {code:0,data:MenuRoute}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function LOGIN(req,res){
|
|
51
|
-
await waitTime();
|
|
52
|
-
return {code:0,data:{
|
|
53
|
-
authorities:['admin'],
|
|
54
|
-
token:'token',
|
|
55
|
-
userId:'1',
|
|
56
|
-
username:'cx',
|
|
57
|
-
realName:'cx',
|
|
58
|
-
name:'cx'
|
|
59
|
-
|
|
60
|
-
}}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function KSSOLOGIN(req,res){
|
|
64
|
-
await waitTime();
|
|
65
|
-
return {code:0,data:{
|
|
66
|
-
authorities:['admin'],
|
|
67
|
-
token:'token',
|
|
68
|
-
userId:'1',
|
|
69
|
-
username:'cx',
|
|
70
|
-
realName:'cx',
|
|
71
|
-
name:'cx'
|
|
72
|
-
|
|
73
|
-
}}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
async function LOGOUT(req,res){
|
|
78
|
-
await waitTime();
|
|
79
|
-
return {code:0}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
LOGOUT
|
|
84
|
-
export default {
|
|
85
|
-
'/api/menu/nav':{get:GET_MENU},
|
|
86
|
-
'/api/login':{post:LOGIN},
|
|
87
|
-
'/api/ksso/auth':{post:KSSOLOGIN},
|
|
88
|
-
'/api/logout':{post:LOGOUT},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {waitTime,REP_SUCCESS} from './utils.js';
|
|
2
|
-
import qs from 'qs';
|
|
3
|
-
import {GET_REQUEST} from './utils';
|
|
4
|
-
async function GET_USER(req,res){
|
|
5
|
-
const query = qs.parse(req.url.split('?')[1]);
|
|
6
|
-
const {name} = query;
|
|
7
|
-
await waitTime();
|
|
8
|
-
return {code:0,data:{name}}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function SET_USER(req,res){
|
|
12
|
-
const query = JSON.parse(req.body);
|
|
13
|
-
const {name,age}= query;
|
|
14
|
-
await waitTime();
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
"code": 0,
|
|
18
|
-
"data":{name,age}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function GET_USER_LIST(req,res){
|
|
23
|
-
const {current,pageSize} = GET_REQUEST(req,res);
|
|
24
|
-
const MAX_TOTAL=98;
|
|
25
|
-
let data=[];
|
|
26
|
-
let idx=(current-1)*pageSize;
|
|
27
|
-
|
|
28
|
-
for(let i=0;i<pageSize;i++){
|
|
29
|
-
if(idx>=MAX_TOTAL)break;
|
|
30
|
-
data.push({
|
|
31
|
-
name:`${idx++}小朋友`
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
code:0,
|
|
36
|
-
data:{
|
|
37
|
-
list:data,
|
|
38
|
-
page:{
|
|
39
|
-
pageNum:current,
|
|
40
|
-
pageSize:pageSize,
|
|
41
|
-
total:MAX_TOTAL
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function GET_USER_TYPE(req,res){
|
|
48
|
-
let data=[];
|
|
49
|
-
for(let i=0;i<10;i++){
|
|
50
|
-
data.push({
|
|
51
|
-
label:`标题${i}`,
|
|
52
|
-
value:i,
|
|
53
|
-
key:`title${i}`
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
code:0,
|
|
58
|
-
data:data
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export default {
|
|
66
|
-
'/userType':{get:GET_USER_TYPE},
|
|
67
|
-
'/userList':{get:GET_USER_LIST},
|
|
68
|
-
'/user':{get:GET_USER,post:SET_USER},
|
|
69
|
-
|
|
70
|
-
}
|
|
@@ -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;
|