cfel-base-components 2.5.76 → 2.5.78
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/src/apiRequest/config.ts +54 -36
- package/src/components/layout/index.tsx +0 -1
- package/src/index.tsx +0 -4
- package/src/components/layout-cloud/index-cloud.scss +0 -886
- package/src/components/layout-cloud/index.tsx +0 -753
- package/src/components/layout-cloud/user-card/index.scss +0 -180
- package/src/components/layout-cloud/user-card/index.tsx +0 -162
- package/src/components/layout-console/index-console.scss +0 -943
- package/src/components/layout-console/index.tsx +0 -742
- package/src/components/layout-console/user-card/index.scss +0 -180
- package/src/components/layout-console/user-card/index.tsx +0 -162
package/package.json
CHANGED
package/src/apiRequest/config.ts
CHANGED
|
@@ -1,75 +1,93 @@
|
|
|
1
|
-
import axios, { AxiosRequestHeaders } from
|
|
2
|
-
import { notification } from
|
|
1
|
+
import axios, { AxiosRequestHeaders } from 'axios'
|
|
2
|
+
import { notification } from 'antd'
|
|
3
3
|
|
|
4
|
-
let UMI_APP_BASEURL: any = window.location.origin || process.env
|
|
5
|
-
const instance = axios.create({ baseURL: UMI_APP_BASEURL })
|
|
4
|
+
let UMI_APP_BASEURL: any = window.location.origin || process.env
|
|
5
|
+
const instance = axios.create({ baseURL: UMI_APP_BASEURL })
|
|
6
6
|
|
|
7
7
|
instance.interceptors.request.use(
|
|
8
8
|
(config: any) => {
|
|
9
9
|
config.headers = {
|
|
10
10
|
...config.headers,
|
|
11
|
-
} as AxiosRequestHeaders
|
|
11
|
+
} as AxiosRequestHeaders
|
|
12
12
|
|
|
13
13
|
config.params = {
|
|
14
14
|
...config.params,
|
|
15
15
|
productCode: (window as any)?.g_config?.productCode,
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
return config
|
|
18
|
+
return config
|
|
19
19
|
},
|
|
20
20
|
(error: any) => Promise.reject(error)
|
|
21
|
-
)
|
|
21
|
+
)
|
|
22
22
|
|
|
23
23
|
instance.interceptors.response.use(
|
|
24
24
|
//状态码为2xx的时候执行
|
|
25
25
|
(response: any) => {
|
|
26
|
-
const { data = {} } = response
|
|
27
|
-
const { success, content, errorCode, errorMsg } = data
|
|
26
|
+
const { data = {} } = response
|
|
27
|
+
const { success, content, errorCode, errorMsg } = data
|
|
28
28
|
|
|
29
29
|
if (!success) {
|
|
30
30
|
notification.error({
|
|
31
31
|
message: errorMsg,
|
|
32
|
-
})
|
|
33
|
-
return Promise.reject(data)
|
|
32
|
+
})
|
|
33
|
+
return Promise.reject(data)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
return content
|
|
36
|
+
return content
|
|
37
37
|
},
|
|
38
38
|
//状态码不为2xx的时候执行
|
|
39
39
|
(error: any) => {
|
|
40
|
-
const { response = {} } = error
|
|
41
|
-
const { status } = response
|
|
40
|
+
const { response = {} } = error
|
|
41
|
+
const { status } = response
|
|
42
42
|
|
|
43
|
-
if (error.code ===
|
|
44
|
-
return Promise.reject(error)
|
|
43
|
+
if (error.code === 'ERR_CANCELED') {
|
|
44
|
+
return Promise.reject(error)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
enum CodeMessage {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
'发出的请求有错误,服务器没有进行新建或修改数据的操作。' = 400,
|
|
49
|
+
'用户未登录。' = 401,
|
|
50
|
+
'用户未得到授权,访问是被禁止的。' = 403,
|
|
51
|
+
'发出的请求针对的是不存在的记录,服务器没有进行操作。' = 404,
|
|
52
|
+
'请求的格式不可得。' = 406,
|
|
53
|
+
'请求的资源被永久删除,且不会再得到的。' = 410,
|
|
54
|
+
'当创建一个对象时,发生一个验证错误。' = 422,
|
|
55
|
+
'服务器发生错误,请检查服务器。' = 500,
|
|
56
|
+
'网关错误。' = 502,
|
|
57
|
+
'服务不可用,服务器暂时过载或维护。' = 503,
|
|
58
|
+
'网关超时。' = 504,
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
notification.error({
|
|
62
|
-
message:
|
|
63
|
-
|
|
64
|
-
CodeMessage[status] ||
|
|
65
|
-
"服务暂不可用,请检查网络",
|
|
66
|
-
});
|
|
62
|
+
message: response?.data?.errorMsg || CodeMessage[status] || '服务暂不可用,请检查网络',
|
|
63
|
+
})
|
|
67
64
|
|
|
68
65
|
if (status === 401) {
|
|
69
66
|
}
|
|
70
67
|
|
|
71
|
-
return Promise.reject(error)
|
|
68
|
+
return Promise.reject(error)
|
|
72
69
|
}
|
|
73
|
-
)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
export default instance
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 通用请求方法,支持类型推断
|
|
76
|
+
*/
|
|
77
|
+
export function request<T = any>(config: Parameters<typeof instance.request>[0]) {
|
|
78
|
+
return instance.request<T, T>(config)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* GET 请求,支持类型推断
|
|
83
|
+
*/
|
|
84
|
+
export function get<T = any>(url: string, config?: Omit<Parameters<typeof instance.get>[1], 'url'>) {
|
|
85
|
+
return instance.get<T, T>(url, config)
|
|
86
|
+
}
|
|
74
87
|
|
|
75
|
-
|
|
88
|
+
/**
|
|
89
|
+
* POST 请求,支持类型推断
|
|
90
|
+
*/
|
|
91
|
+
export function post<T = any>(url: string, data?: any, config?: Omit<Parameters<typeof instance.post>[2], 'url' | 'data'>) {
|
|
92
|
+
return instance.post<T, T>(url, data, config)
|
|
93
|
+
}
|
|
@@ -238,7 +238,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
238
238
|
>
|
|
239
239
|
{!collapsed && <img className={`logo-base current-logo`} src={logo || logoUrl} />}
|
|
240
240
|
{collapsed && <img className={`logo-sub`} src={subLogo || subLogoUrl} />}
|
|
241
|
-
{/* {collapsed && <img className={`logo-base sub-logo`} src={logo || subLogoUrl} />} */}
|
|
242
241
|
</div>
|
|
243
242
|
{!collapsed && (
|
|
244
243
|
<div
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import LiosLayout, { LiosLayoutlProps } from './components/layout'
|
|
2
|
-
import LiosLayoutConsole from './components/layout-console/index'
|
|
3
|
-
import LiosLayoutCloud from './components/layout-cloud/index'
|
|
4
2
|
import PageContainer from './components/base-component/PageContainer'
|
|
5
3
|
import CopyRight from './components/base-component/CopyRight'
|
|
6
4
|
import QueryFilter from './components/base-component/QueryFilter'
|
|
@@ -21,8 +19,6 @@ import { getUrlParams, downloadFile, timeFormatter } from './utils/index'
|
|
|
21
19
|
export {
|
|
22
20
|
LiosLayout,
|
|
23
21
|
LiosLayoutlProps,
|
|
24
|
-
LiosLayoutConsole,
|
|
25
|
-
LiosLayoutCloud,
|
|
26
22
|
CopyRight,
|
|
27
23
|
PageContainer,
|
|
28
24
|
QueryFilter,
|