cfel-base-components 2.5.8 → 2.5.10
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 +25 -20
- package/src/components/layout/index.tsx +11 -0
- package/src/components/layout/user-card/index.scss +17 -4
- package/src/components/layout/user-card/index.tsx +29 -5
- package/src/components/universal-pages/account/index.tsx +1 -1
- package/src/components/universal-pages/accountInfo/index.tsx +1 -1
- package/src/components/universal-pages/cpcAccount/index.tsx +1 -1
- package/src/components/universal-pages/cpcAccountInfo/index.tsx +1 -1
- package/src/components/universal-pages/cpcRoleInfo/index.tsx +1 -1
- package/src/components/universal-pages/roleInfo/index.tsx +1 -1
package/package.json
CHANGED
package/src/apiRequest/config.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import axios, { AxiosRequestHeaders } from
|
|
2
|
-
import { notification } from
|
|
1
|
+
import axios, { AxiosRequestHeaders } from "axios";
|
|
2
|
+
import { notification } from "antd";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
let UMI_APP_BASEURL: any = window.location.origin || process.env
|
|
4
|
+
let UMI_APP_BASEURL: any = window.location.origin || process.env;
|
|
6
5
|
const instance = axios.create({ baseURL: UMI_APP_BASEURL });
|
|
7
6
|
|
|
8
7
|
instance.interceptors.request.use(
|
|
@@ -14,7 +13,7 @@ instance.interceptors.request.use(
|
|
|
14
13
|
config.params = {
|
|
15
14
|
...config.params,
|
|
16
15
|
productCode: (window as any)?.g_config?.productCode,
|
|
17
|
-
}
|
|
16
|
+
};
|
|
18
17
|
|
|
19
18
|
return config;
|
|
20
19
|
},
|
|
@@ -29,7 +28,7 @@ instance.interceptors.response.use(
|
|
|
29
28
|
|
|
30
29
|
if (!success) {
|
|
31
30
|
notification.error({
|
|
32
|
-
message: errorMsg
|
|
31
|
+
message: errorMsg,
|
|
33
32
|
});
|
|
34
33
|
return Promise.reject(data);
|
|
35
34
|
}
|
|
@@ -41,30 +40,36 @@ instance.interceptors.response.use(
|
|
|
41
40
|
const { response = {} } = error;
|
|
42
41
|
const { status } = response;
|
|
43
42
|
|
|
43
|
+
if (error.code === "ERR_CANCELED") {
|
|
44
|
+
return Promise.reject(error);
|
|
45
|
+
}
|
|
46
|
+
|
|
44
47
|
enum CodeMessage {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
"发出的请求有错误,服务器没有进行新建或修改数据的操作。" = 400,
|
|
49
|
+
"用户未登录。" = 401,
|
|
50
|
+
"用户得到授权,但是访问是被禁止的。" = 403,
|
|
51
|
+
"发出的请求针对的是不存在的记录,服务器没有进行操作。" = 404,
|
|
52
|
+
"请求的格式不可得。" = 406,
|
|
53
|
+
"请求的资源被永久删除,且不会再得到的。" = 410,
|
|
54
|
+
"当创建一个对象时,发生一个验证错误。" = 422,
|
|
55
|
+
"服务器发生错误,请检查服务器。" = 500,
|
|
56
|
+
"网关错误。" = 502,
|
|
57
|
+
"服务不可用,服务器暂时过载或维护。" = 503,
|
|
58
|
+
"网关超时。" = 504,
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
notification.error({
|
|
59
|
-
message:
|
|
62
|
+
message:
|
|
63
|
+
response?.data?.message ||
|
|
64
|
+
CodeMessage[status] ||
|
|
65
|
+
"服务暂不可用,请检查网络",
|
|
60
66
|
});
|
|
61
67
|
|
|
62
68
|
if (status === 401) {
|
|
63
|
-
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
return Promise.reject(error);
|
|
67
72
|
}
|
|
68
73
|
);
|
|
69
74
|
|
|
70
|
-
export default instance;
|
|
75
|
+
export default instance;
|
|
@@ -56,11 +56,19 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
56
56
|
const [collapsed, setCollapsed] = useState(
|
|
57
57
|
localStorage.getItem("layout_collapsed") === "true"
|
|
58
58
|
);
|
|
59
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
59
60
|
|
|
60
61
|
const onOpenChange: MenuProps["onOpenChange"] = (keys) => {
|
|
61
62
|
setOpenKeys(keys);
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
const copyTextToClipboard = async (text:string) => {
|
|
66
|
+
try {
|
|
67
|
+
await navigator.clipboard.writeText(text);
|
|
68
|
+
setIsCopied(true);
|
|
69
|
+
} catch (err) {}
|
|
70
|
+
};
|
|
71
|
+
|
|
64
72
|
return (
|
|
65
73
|
<Layout className="layout-warp">
|
|
66
74
|
{Array.isArray(menuList) && menuList.length > 0 && (
|
|
@@ -143,12 +151,15 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
143
151
|
myWalletInfo={myWalletInfo}
|
|
144
152
|
amountInfo={amountInfo}
|
|
145
153
|
customAction={customAction}
|
|
154
|
+
isCopied={isCopied}
|
|
155
|
+
copyTextToClipboard={copyTextToClipboard}
|
|
146
156
|
/>
|
|
147
157
|
}
|
|
148
158
|
arrow={false}
|
|
149
159
|
trigger="click"
|
|
150
160
|
onOpenChange={(e) => {
|
|
151
161
|
if (!e) return;
|
|
162
|
+
setIsCopied(false);
|
|
152
163
|
myWalletInfoAction && myWalletInfoAction();
|
|
153
164
|
}}
|
|
154
165
|
>
|
|
@@ -81,22 +81,30 @@
|
|
|
81
81
|
|
|
82
82
|
.li-flex {
|
|
83
83
|
display: flex;
|
|
84
|
-
|
|
84
|
+
.lios-keyMare {
|
|
85
|
+
width: 40px;
|
|
86
|
+
}
|
|
85
87
|
.lios-value {
|
|
86
88
|
flex: 1;
|
|
87
89
|
}
|
|
90
|
+
.lios-valueMare {
|
|
91
|
+
flex: 1;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
.lios-li {
|
|
91
99
|
line-height: 22px;
|
|
92
100
|
|
|
93
|
-
.lios-key {
|
|
101
|
+
.lios-key, .lios-keyMare {
|
|
94
102
|
font-size: 12px;
|
|
95
103
|
color: rgba(0, 0, 0, 0.5);
|
|
96
104
|
display: inline-block;
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
.lios-value {
|
|
107
|
+
.lios-value, .lios-valueMare {
|
|
100
108
|
padding-left: 8px;
|
|
101
109
|
display: inline-block;
|
|
102
110
|
font-size: 12px;
|
|
@@ -106,7 +114,12 @@
|
|
|
106
114
|
padding-left: 5px;
|
|
107
115
|
}
|
|
108
116
|
}
|
|
109
|
-
|
|
117
|
+
.lios-iconDone {
|
|
118
|
+
width: 40px;
|
|
119
|
+
text-align: center;
|
|
120
|
+
color: rgba(0, 0, 0, 0.45);
|
|
121
|
+
font-size: 10px;
|
|
122
|
+
}
|
|
110
123
|
.lios-icon {
|
|
111
124
|
width: 40px;
|
|
112
125
|
text-align: center;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SwapOutlined, FormOutlined } from "@ant-design/icons";
|
|
2
|
+
import { SwapOutlined, FormOutlined,CopyOutlined } from "@ant-design/icons";
|
|
3
3
|
import "./index.scss";
|
|
4
4
|
|
|
5
5
|
interface UserType {
|
|
6
6
|
name: string;
|
|
7
7
|
avatar: string;
|
|
8
8
|
roleInfo: any[];
|
|
9
|
+
id: string;
|
|
10
|
+
account: string;
|
|
9
11
|
}
|
|
10
12
|
interface CustomType {
|
|
11
13
|
type: string;
|
|
@@ -42,11 +44,12 @@ export default function UserCard({
|
|
|
42
44
|
myWalletInfo,
|
|
43
45
|
amountInfo,
|
|
44
46
|
customAction,
|
|
47
|
+
isCopied,
|
|
48
|
+
copyTextToClipboard
|
|
45
49
|
}: any) {
|
|
46
|
-
const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)
|
|
47
|
-
?.g_config;
|
|
50
|
+
const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)?.g_config;
|
|
48
51
|
|
|
49
|
-
const { name, avatar, roleInfo }: UserType = user || {};
|
|
52
|
+
const { name, avatar, roleInfo , id , account }: UserType = user || {};
|
|
50
53
|
|
|
51
54
|
const { isCompleted, isAudited }: CustomType = custom || {};
|
|
52
55
|
|
|
@@ -70,7 +73,28 @@ export default function UserCard({
|
|
|
70
73
|
</div>
|
|
71
74
|
</div>
|
|
72
75
|
</div>
|
|
73
|
-
|
|
76
|
+
<div className="lios-userInfo">
|
|
77
|
+
<div className="lios-li li-flex">
|
|
78
|
+
<div className="lios-keyMare">账号</div>
|
|
79
|
+
<div className="lios-valueMare" title={account}>{account}</div>
|
|
80
|
+
<div
|
|
81
|
+
className={
|
|
82
|
+
isCopied ? 'lios-iconDone' : 'lios-icon'
|
|
83
|
+
}
|
|
84
|
+
onClick={() => {
|
|
85
|
+
copyTextToClipboard(account)
|
|
86
|
+
}}>
|
|
87
|
+
{
|
|
88
|
+
isCopied ? '已复制' : <CopyOutlined />
|
|
89
|
+
}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div className="lios-li li-flex">
|
|
93
|
+
<div className="lios-keyMare">账号ID</div>
|
|
94
|
+
<div className="lios-value">{id}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
74
98
|
{myWalletInfo && (
|
|
75
99
|
<div className="lios-userInfo">
|
|
76
100
|
<div className="lios-li">
|
|
@@ -193,7 +193,7 @@ export default function AccountInfo() {
|
|
|
193
193
|
<Descriptions.Item label="名称">{accountInfo?.name || ''}</Descriptions.Item>
|
|
194
194
|
<Descriptions.Item label="手机号">{accountInfo?.mobile || ''}</Descriptions.Item>
|
|
195
195
|
<Descriptions.Item label="邮箱">{accountInfo?.email || ''}</Descriptions.Item>
|
|
196
|
-
<Descriptions.Item label="
|
|
196
|
+
<Descriptions.Item label="是否主账号">{accountInfo?.isAdmin ? '是' : '否'}</Descriptions.Item>
|
|
197
197
|
<Descriptions.Item label="创建时间">{timeFormatter(accountInfo?.gmtCreate)}</Descriptions.Item>
|
|
198
198
|
<Descriptions.Item label="修改时间">{timeFormatter(accountInfo?.gmtModified)}</Descriptions.Item>
|
|
199
199
|
</Descriptions>
|
|
@@ -386,7 +386,7 @@ export default function AccountInfo({ isShowTab, getAuthTree, getAccountAuthTree
|
|
|
386
386
|
<Descriptions.Item label='名称'>{accountInfo?.name || ''}</Descriptions.Item>
|
|
387
387
|
<Descriptions.Item label='手机号'>{accountInfo?.mobile || ''}</Descriptions.Item>
|
|
388
388
|
<Descriptions.Item label='邮箱'>{accountInfo?.email || ''}</Descriptions.Item>
|
|
389
|
-
<Descriptions.Item label='
|
|
389
|
+
<Descriptions.Item label='是否主账号'>
|
|
390
390
|
{accountInfo?.isAdmin ? '是' : '否'}
|
|
391
391
|
</Descriptions.Item>
|
|
392
392
|
<Descriptions.Item label='创建时间'>
|