kn-cli 1.0.97 → 1.0.99
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 +39 -41
- 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
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import JSZip from 'jszip';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import moment from 'moment';
|
|
2
5
|
/**
|
|
3
6
|
* 打开一个第三方链接
|
|
4
7
|
* @param {string} link - 链接地址
|
|
@@ -68,6 +71,8 @@ export const jumpUrl=(url,options={})=>{
|
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
|
|
74
|
+
|
|
75
|
+
|
|
71
76
|
// 关闭页面
|
|
72
77
|
export const closeWindow = () => {
|
|
73
78
|
// @ts-ignore
|
|
@@ -79,4 +84,211 @@ export const closeWindow = () => {
|
|
|
79
84
|
window.close();
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
|
-
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
export const px2rem=(px)=>{
|
|
91
|
+
px=+px/100+'rem';
|
|
92
|
+
return px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 获取字符串字节数(中文字符字节数由编码方式角色,utf-8是3个字节)
|
|
97
|
+
*/
|
|
98
|
+
export const getStrByteLen=(str)=>{
|
|
99
|
+
if(!str){
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
const len=encodeURIComponent(str).replace(/%../g,"a").length;
|
|
103
|
+
return len;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 下载文件
|
|
108
|
+
* @param {string} url - 文件地址
|
|
109
|
+
* @param {string} [filename] - 文件名
|
|
110
|
+
*/
|
|
111
|
+
export const downloadFile = (url,filename)=> {
|
|
112
|
+
// 使用fetch API获取资源
|
|
113
|
+
fetch(url)
|
|
114
|
+
.then(response => {
|
|
115
|
+
return response.blob();
|
|
116
|
+
}) // 将响应转换为Blob对象
|
|
117
|
+
.then(blob => {
|
|
118
|
+
// 创建一个指向该Blob的URL
|
|
119
|
+
const blobUrl=window.URL.createObjectURL(blob);
|
|
120
|
+
// 创建一个<a>标签用于下载
|
|
121
|
+
const link=document.createElement('a');
|
|
122
|
+
link.href=blobUrl;
|
|
123
|
+
link.download=filename||''; // 设置下载文件名,如果没有览器将使用URL的最后一部分作为文件名
|
|
124
|
+
link.style.display='none';
|
|
125
|
+
// 触发下载
|
|
126
|
+
document.body.appendChild(link);
|
|
127
|
+
link.click();
|
|
128
|
+
|
|
129
|
+
// 清理并移除<a>标签
|
|
130
|
+
document.body.removeChild(link);
|
|
131
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
132
|
+
})
|
|
133
|
+
.catch(error => {
|
|
134
|
+
console.error('下载资源失败:',error);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* 下载多个文件并打包成zip
|
|
140
|
+
* @param {Array} urls - 文件地址数组
|
|
141
|
+
* @param {string} [zipName] - zip文件名
|
|
142
|
+
*/
|
|
143
|
+
export const downloadFilesAsZip = async(urls, zipName) => {
|
|
144
|
+
const zip=new JSZip();
|
|
145
|
+
|
|
146
|
+
await Promise.all(
|
|
147
|
+
urls.map(async (item) =>(
|
|
148
|
+
fetch(item?.url)
|
|
149
|
+
.then(response => response.blob())
|
|
150
|
+
.then(blob => {
|
|
151
|
+
const fileName=item?.name;
|
|
152
|
+
zip.file(fileName,blob);
|
|
153
|
+
})
|
|
154
|
+
))
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// 生成ZIP Blob对象
|
|
158
|
+
const zipBlob=await zip.generateAsync({type: 'blob'});
|
|
159
|
+
// 创建一个指向ZIP Blob的URL
|
|
160
|
+
const blobUrl=window.URL.createObjectURL(zipBlob);
|
|
161
|
+
const link=document.createElement('a');
|
|
162
|
+
link.href=blobUrl;
|
|
163
|
+
link.download=zipName??'download';
|
|
164
|
+
link.style.display='none';
|
|
165
|
+
document.body.appendChild(link);
|
|
166
|
+
link.click();
|
|
167
|
+
document.body.removeChild(link);
|
|
168
|
+
URL.revokeObjectURL(blobUrl);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
const CONSOLE_CONFIG={
|
|
173
|
+
'useRouteMenu':false,
|
|
174
|
+
'ProviderTimelines':true,
|
|
175
|
+
'Websocket':true,
|
|
176
|
+
'EventBus':true,
|
|
177
|
+
'MessageWall':true,
|
|
178
|
+
'ProviderApp':true
|
|
179
|
+
}
|
|
180
|
+
export const CONSOLE_LOG=(moduleName, txt, ...other)=>{
|
|
181
|
+
if(!CONSOLE_CONFIG[moduleName]){return;}
|
|
182
|
+
console.log(`[${moduleName}]${txt}`, ...other)
|
|
183
|
+
}
|
|
184
|
+
CONSOLE_LOG.warn = (moduleName, txt, ...other)=>{
|
|
185
|
+
if(!CONSOLE_CONFIG[moduleName]){return;}
|
|
186
|
+
console.warn(`[${moduleName}]${txt}`, ...other)
|
|
187
|
+
}
|
|
188
|
+
CONSOLE_LOG.error = (moduleName, txt, ...other)=>{
|
|
189
|
+
if(!CONSOLE_CONFIG[moduleName]){return;}
|
|
190
|
+
console.error(`[${moduleName}]${txt}`, ...other)
|
|
191
|
+
}
|
|
192
|
+
CONSOLE_LOG.info = (moduleName, txt, ...other)=>{
|
|
193
|
+
if(!CONSOLE_CONFIG[moduleName]){return;}
|
|
194
|
+
console.info(`[${moduleName}]${txt}`, ...other)
|
|
195
|
+
}
|
|
196
|
+
CONSOLE_LOG.log = (moduleName, txt, ...other)=>{
|
|
197
|
+
if(!CONSOLE_CONFIG[moduleName]){return;}
|
|
198
|
+
console.log(`[${moduleName}]${txt}`, ...other)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const WriteLog=(text)=>{
|
|
202
|
+
let log = localStorage.getItem('nebulaLog');
|
|
203
|
+
let logs=[];
|
|
204
|
+
text = `[${moment().format('MM-DD HH:mm:ss')}]:${text}`;
|
|
205
|
+
if(log){
|
|
206
|
+
logs = log.split('\n');
|
|
207
|
+
}else{
|
|
208
|
+
log = text;
|
|
209
|
+
}
|
|
210
|
+
logs.splice(0,0,text);
|
|
211
|
+
localStorage.setItem('nebulaLog',logs.join('\n'));
|
|
212
|
+
}
|
|
213
|
+
export const Storage={
|
|
214
|
+
/**
|
|
215
|
+
* @param {string} name
|
|
216
|
+
* @returns {object|null}
|
|
217
|
+
*/
|
|
218
|
+
get:(name)=>{
|
|
219
|
+
let req = localStorage.getItem(name);
|
|
220
|
+
try{
|
|
221
|
+
if(req){
|
|
222
|
+
req = JSON.parse(req);
|
|
223
|
+
return req;
|
|
224
|
+
}
|
|
225
|
+
}catch(ex){
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
/**
|
|
230
|
+
* @param {string} name
|
|
231
|
+
* @param {object} item
|
|
232
|
+
*/
|
|
233
|
+
set:(name,item)=>{
|
|
234
|
+
let value='';
|
|
235
|
+
if(item){
|
|
236
|
+
value = JSON.stringify(item);
|
|
237
|
+
}
|
|
238
|
+
localStorage.setItem(name,value);
|
|
239
|
+
},
|
|
240
|
+
clear:(name)=>{
|
|
241
|
+
localStorage.removeItem(name);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
export const StorageName={
|
|
245
|
+
UserListFilterMenu:'userListFilterMenu',
|
|
246
|
+
AccountConfig:'AccountConfig'
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* 给返回Promise的函数增加节流功能
|
|
253
|
+
* @param {(any)=>Promise} fn
|
|
254
|
+
* @param {number} ms - 防抖时间
|
|
255
|
+
* @returns {Function}
|
|
256
|
+
*/
|
|
257
|
+
export function throttlePromise(fn, ms) {
|
|
258
|
+
const pendingPromises = new Map();
|
|
259
|
+
return function(params) {
|
|
260
|
+
const key = JSON.stringify(params);
|
|
261
|
+
|
|
262
|
+
if (pendingPromises.has(key)) {
|
|
263
|
+
return pendingPromises.get(key);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const promise = new Promise((resolve, reject) => {
|
|
267
|
+
setTimeout(() => {
|
|
268
|
+
pendingPromises.delete(key);
|
|
269
|
+
fn(params).then(resolve).catch(reject);
|
|
270
|
+
}, ms);
|
|
271
|
+
});
|
|
272
|
+
pendingPromises.set(key, promise);
|
|
273
|
+
return promise;
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
export const delayLoader=(loader,ms=5000)=>{
|
|
279
|
+
return new Promise(resolve=>{
|
|
280
|
+
loader.then(req=>{
|
|
281
|
+
setTimeout(()=>{
|
|
282
|
+
resolve(req);
|
|
283
|
+
},ms)
|
|
284
|
+
})
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export const delay=(ms=1000)=>{
|
|
289
|
+
return new Promise(resolve=>{
|
|
290
|
+
setTimeout(()=>{
|
|
291
|
+
resolve();
|
|
292
|
+
},ms)
|
|
293
|
+
})
|
|
294
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<title></title>
|
|
13
13
|
<script>
|
|
14
14
|
var url = location.protocol + '//' + location.host+'/#/login';
|
|
15
|
-
location.replace('https://ksso.kingnet.com/oauth2/auth?client_id=
|
|
15
|
+
location.replace('https://ksso.kingnet.com/oauth2/auth?client_id=30000716&response_type=code&redirect_uri=' + encodeURIComponent(url));
|
|
16
16
|
</script>
|
|
17
17
|
</head>
|
|
18
18
|
|
|
@@ -5,17 +5,24 @@ const configs = {
|
|
|
5
5
|
},
|
|
6
6
|
// cicd构建时研发环境
|
|
7
7
|
dev: {
|
|
8
|
-
API_HOST: '
|
|
8
|
+
API_HOST: 'https://dev-nebula-api.kingnet.com',
|
|
9
|
+
DEVICE_HOST: 'wss://dev-nebula-adb.kyhub.cn',
|
|
10
|
+
ADB_HOST: 'https://dev-nebula-adb.kyhub.cn',
|
|
11
|
+
WS_HOST: 'wss://dev-nebula-connector.kingnet.com/ws',
|
|
9
12
|
},
|
|
10
13
|
// cicd构建时生产环境
|
|
11
14
|
prod: {
|
|
12
|
-
API_HOST: '
|
|
15
|
+
API_HOST: 'https://nebula-api.kingnet.com',
|
|
16
|
+
DEVICE_HOST: 'wss://nebula-adb.kingnet.com',
|
|
17
|
+
ADB_HOST: 'https://nebula-adb.kingnet.com',
|
|
18
|
+
WS_HOST: 'wss://nebula-connector.kingnet.com/ws',
|
|
13
19
|
},
|
|
14
20
|
};
|
|
15
21
|
|
|
22
|
+
|
|
16
23
|
const API_PROXY= {
|
|
17
24
|
'/api/**': {
|
|
18
|
-
target: 'http://
|
|
25
|
+
target: 'http://192.168.92.117:8080',
|
|
19
26
|
changeOrigin: true,
|
|
20
27
|
logLevel: 'debug',
|
|
21
28
|
pathRewrite: {
|
|
@@ -24,6 +31,7 @@ const API_PROXY= {
|
|
|
24
31
|
},
|
|
25
32
|
};
|
|
26
33
|
|
|
34
|
+
// @ts-ignore
|
|
27
35
|
const env = process.env.build_env||'localdebug';
|
|
28
36
|
|
|
29
37
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import styles from './index.less';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 居中定位的layout
|
|
9
|
-
* @param {object} props
|
|
10
|
-
* @param {string} [props.className] - 扩展类样式
|
|
11
|
-
* @param {string} [props.layout='normal'] - 布局样式,xy-center|x-center|y-center
|
|
12
|
-
* @param {JSX.Element|string} [props.children] - 容器内的子组件
|
|
13
|
-
*
|
|
14
|
-
* @returns {JSX.Element}
|
|
15
|
-
*/
|
|
16
|
-
const LayoutCenterBody=(props)=>{
|
|
17
|
-
const {className,layout='normal'} = props;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<section data-layout={layout} className={ className?`${styles.contentBody} ${className}`:styles.contentBody }>
|
|
21
|
-
{props.children}
|
|
22
|
-
</section>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
export default LayoutCenterBody;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
@import '~@/_variable.less';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.contentBody{
|
|
5
|
-
width:100%;
|
|
6
|
-
height:100%;
|
|
7
|
-
&[data-layout='xy-center']{
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
align-items: center;
|
|
12
|
-
}
|
|
13
|
-
&[data-layout='x-center']{
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
align-items: center;
|
|
17
|
-
}
|
|
18
|
-
&[data-layout='y-center']{
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
body[data-debug-layout]{
|
|
26
|
-
.contentBody{
|
|
27
|
-
border:1px solid red;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
@import '~@/_variable.less';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.nav{
|
|
5
|
-
width: var(--nav-width);
|
|
6
|
-
height:100%;
|
|
7
|
-
background-color: var(--color-primary-dark);
|
|
8
|
-
transition: all .2s;
|
|
9
|
-
z-index: var(--z-nav-mobile);
|
|
10
|
-
overflow-y: auto;
|
|
11
|
-
&[data-nav-hide='true']{
|
|
12
|
-
display: none;
|
|
13
|
-
}
|
|
14
|
-
&[data-nav-mode='mobile']{
|
|
15
|
-
position: fixed;
|
|
16
|
-
z-index: var(--z-nav-mobile);
|
|
17
|
-
box-shadow: 0 0 20px #444;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import React, { useState,useEffect, useRef} from 'react';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import { useLocation,useNavigate } from 'react-router-dom';
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import { LogoutOutlined, UserOutlined } from '@ant-design/icons';
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
import { Menu,Dropdown,Badge } from 'antd';
|
|
9
|
-
|
|
10
|
-
import ProviderApp from '@/provider/app';
|
|
11
|
-
import ProviderMenu from '@/provider/menu';
|
|
12
|
-
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
import imgAvatar from '@/assets/images/avatar.png';
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
import styles from './index.less';
|
|
17
|
-
|
|
18
|
-
const TopMenu=()=>{
|
|
19
|
-
const app = ProviderApp.useContainer();
|
|
20
|
-
const providerMenu = ProviderMenu.useContainer();
|
|
21
|
-
const navigate = useNavigate();
|
|
22
|
-
|
|
23
|
-
const [menus,setMenus]=useState([]);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const translateMenu=(list)=>{
|
|
27
|
-
if(!list||list.length<=0)return [];
|
|
28
|
-
let req=list.map(menu=>{
|
|
29
|
-
const {key,name:label,icon,url,msgCount}=menu;
|
|
30
|
-
|
|
31
|
-
let item={
|
|
32
|
-
key,label,icon,url
|
|
33
|
-
}
|
|
34
|
-
if(msgCount&&msgCount>0){
|
|
35
|
-
item.label=<span>{label}<Badge size='small' count={msgCount} offset={[5,-5]} /></span>
|
|
36
|
-
}
|
|
37
|
-
if(menu.children){
|
|
38
|
-
item.children = translateMenu(menu.children)
|
|
39
|
-
}
|
|
40
|
-
return item;
|
|
41
|
-
})
|
|
42
|
-
return req;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const reload= async ()=>{
|
|
47
|
-
providerMenu.reload();
|
|
48
|
-
}
|
|
49
|
-
useEffect(()=>{
|
|
50
|
-
let menuList = translateMenu(providerMenu.topMenu);
|
|
51
|
-
menuList.forEach(menu=>{
|
|
52
|
-
menu.children=null;//顶级菜单这里设计为不需要展示子菜单
|
|
53
|
-
})
|
|
54
|
-
setMenus(menuList);
|
|
55
|
-
},[providerMenu.topMenu]);
|
|
56
|
-
|
|
57
|
-
useEffect(()=>{
|
|
58
|
-
providerMenu.setUserAuth(app.user.authorities||[]);
|
|
59
|
-
},[app.user])
|
|
60
|
-
|
|
61
|
-
useEffect(()=>{
|
|
62
|
-
reload();
|
|
63
|
-
},[])
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// 推出登录
|
|
67
|
-
const onAvatarClick = (key)=>{
|
|
68
|
-
if(key==='user'){
|
|
69
|
-
app.updateUserInfo();
|
|
70
|
-
}
|
|
71
|
-
else if (key === 'logout') {
|
|
72
|
-
app.logout();
|
|
73
|
-
}else if(key=='relogin'){
|
|
74
|
-
navigate('/superAdminLogin')
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const onHome=()=>{
|
|
78
|
-
navigate('/');
|
|
79
|
-
}
|
|
80
|
-
const onClickMenuItem=(e)=>{
|
|
81
|
-
const { item, key, keyPath, domEvent } = e;
|
|
82
|
-
let menu = providerMenu.findMenuData(key);
|
|
83
|
-
navigate(menu.url);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<section className={styles.topMenu}>
|
|
89
|
-
<div className={styles.left}>
|
|
90
|
-
<span className={styles.title} onClick={onHome}>后管系统</span>
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
<div className={styles.center}>
|
|
94
|
-
{
|
|
95
|
-
menus&&menus.length>=1&&
|
|
96
|
-
<Menu
|
|
97
|
-
items={menus}
|
|
98
|
-
mode="horizontal"
|
|
99
|
-
onClick={onClickMenuItem}
|
|
100
|
-
selectedKeys={providerMenu.selectMenus.keys}
|
|
101
|
-
className={styles.menu}
|
|
102
|
-
/>
|
|
103
|
-
}
|
|
104
|
-
</div>
|
|
105
|
-
<div className={styles.right}>
|
|
106
|
-
|
|
107
|
-
<span className={styles.username}>Hi,{app?.user?.username||''}!</span>
|
|
108
|
-
<Dropdown menu={{items:[
|
|
109
|
-
{
|
|
110
|
-
key:'user',
|
|
111
|
-
label:<span onClick={onAvatarClick.bind(this,'user')}><UserOutlined />刷新用户权限</span>
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
key:'relogin',
|
|
115
|
-
label:<span onClick={onAvatarClick.bind(this,'relogin')}><UserOutlined />重新登录</span>
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
key:'logout',
|
|
119
|
-
label:<span onClick={onAvatarClick.bind(this,'logout')}><LogoutOutlined />退出登录</span>
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
]}}>
|
|
123
|
-
<img className={styles.avatar} src={imgAvatar}/>
|
|
124
|
-
</Dropdown>
|
|
125
|
-
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
</section>
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export default TopMenu;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
@import '~@/_variable.less';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.topMenu{
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: space-between;
|
|
8
|
-
height: var(--topMenu-height);
|
|
9
|
-
width:100%;
|
|
10
|
-
z-index:var(--z-top-menu);
|
|
11
|
-
background-color: var(--color-primary-dark);
|
|
12
|
-
.left{
|
|
13
|
-
padding-left: 16px;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
width: var(--nav-width);
|
|
17
|
-
.logo{
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
width: 110px;
|
|
20
|
-
height: 32px;
|
|
21
|
-
margin-right: 7px;
|
|
22
|
-
color:white;
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
font-size: 32px;
|
|
26
|
-
}
|
|
27
|
-
.title {
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
color: #fff;
|
|
30
|
-
font-size: 16px;
|
|
31
|
-
padding: 0 55px 0 7px;
|
|
32
|
-
font-weight: var(--weight-Light);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
.center{
|
|
36
|
-
height: 100%;
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
flex:1;
|
|
40
|
-
}
|
|
41
|
-
.right{
|
|
42
|
-
display: flex;
|
|
43
|
-
align-items: center;
|
|
44
|
-
flex:1;
|
|
45
|
-
justify-content: flex-end;
|
|
46
|
-
.username{
|
|
47
|
-
color:white;
|
|
48
|
-
}
|
|
49
|
-
.avatar{
|
|
50
|
-
width: 40px;
|
|
51
|
-
height: 40px;
|
|
52
|
-
border-radius: 50%;
|
|
53
|
-
margin: 0 24px 0 24px;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.menu:global(.ant-menu){
|
|
58
|
-
line-height: var(--topMenu-height);
|
|
59
|
-
background-color: inherit;
|
|
60
|
-
border-bottom: none;
|
|
61
|
-
flex:1;
|
|
62
|
-
// min-width: 100px;
|
|
63
|
-
|
|
64
|
-
:global{
|
|
65
|
-
.ant-menu-item,
|
|
66
|
-
.ant-menu-item a{
|
|
67
|
-
color:rgba(104,114,126,1);
|
|
68
|
-
font-weight: var(--weight-Medium);
|
|
69
|
-
}
|
|
70
|
-
.ant-menu-item:hover a,
|
|
71
|
-
.ant-menu-item:hover,
|
|
72
|
-
.ant-menu-item-selected a{
|
|
73
|
-
color: rgba(255,255,255,.8);
|
|
74
|
-
}
|
|
75
|
-
.ant-menu-item-selected{
|
|
76
|
-
color: white;
|
|
77
|
-
}
|
|
78
|
-
.ant-menu-item:hover:after,
|
|
79
|
-
.ant-menu-item-selected:after{
|
|
80
|
-
border-bottom: 2px solid #fff;
|
|
81
|
-
}
|
|
82
|
-
.ant-menu-item{
|
|
83
|
-
padding: 0 24px;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
.avatarMenu{
|
|
89
|
-
min-width: 100px;
|
|
90
|
-
:global(.anticon) {
|
|
91
|
-
margin-right: 8px;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:global(.ant-dropdown-menu-item) {
|
|
95
|
-
min-width: 100px;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.navShow{
|
|
100
|
-
font-size: 26px;
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
&:hover{
|
|
103
|
-
color: var(--color-text-hover);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import { useParams,useNavigate } from 'react-router-dom';
|
|
4
|
-
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import {Button} from 'antd';
|
|
7
|
-
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
import styles from '@/pages/demo/index.less';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const Detail=()=>{
|
|
14
|
-
const {id} = useParams();
|
|
15
|
-
const navigate= useNavigate();
|
|
16
|
-
const onBack=()=>{
|
|
17
|
-
window.history.back();
|
|
18
|
-
}
|
|
19
|
-
return (
|
|
20
|
-
<section className={styles.contentWrap}>
|
|
21
|
-
<p>id:{id}</p>
|
|
22
|
-
<Button type='primary' onClick={onBack}>返回</Button>
|
|
23
|
-
</section>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default Detail;
|