cfel-base-components 2.5.11 → 2.5.12

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.
@@ -1,3 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib"
3
- }
@@ -23,14 +23,13 @@
23
23
  shortName: "\u8FDC\u822A\u8DE8\u56FD\u63A7\u80A1\u96C6\u56E2",
24
24
  },
25
25
  user: {
26
- id: "1676424765496406018",
26
+ id: 1676424765496406018,
27
27
  userId: "01436565094521893533",
28
28
  unionId: "xsU4QrgEfZxxj8YxEWAYJAiEiE",
29
29
  name: "\u5434\u5434\u5434\u5434",
30
- avatar: "https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/puhui-home/userLogo.jpeg",
30
+ avatar: "https://static-legacy.dingtalk.com/media/lQLPM5AkqOufBy7NAyDNAyCwJZ592czMOC4EeIgNJAAGAA_800_800.png",
31
31
  account: "15957797376",
32
- roleInfo: ["\u8D85\u7EA7\u7BA1\u7406\u5458"],
33
- isMaster: false
32
+ roleInfo: []
34
33
  },
35
34
  custom: {
36
35
  id: 1727864976691109890,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.5.11",
3
+ "version": "2.5.12",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -47,7 +47,7 @@ instance.interceptors.response.use(
47
47
  enum CodeMessage {
48
48
  "发出的请求有错误,服务器没有进行新建或修改数据的操作。" = 400,
49
49
  "用户未登录。" = 401,
50
- "用户得到授权,但是访问是被禁止的。" = 403,
50
+ "用户未得到授权,访问是被禁止的。" = 403,
51
51
  "发出的请求针对的是不存在的记录,服务器没有进行操作。" = 404,
52
52
  "请求的格式不可得。" = 406,
53
53
  "请求的资源被永久删除,且不会再得到的。" = 410,
@@ -60,7 +60,7 @@ instance.interceptors.response.use(
60
60
 
61
61
  notification.error({
62
62
  message:
63
- response?.data?.message ||
63
+ response?.data?.errorMsg ||
64
64
  CodeMessage[status] ||
65
65
  "服务暂不可用,请检查网络",
66
66
  });
@@ -56,21 +56,16 @@ 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({
60
- account:false,
61
- id:false,
62
- tenantName:false,
63
- tenantId:false
64
- });
59
+ const [isCopied, setIsCopied] = useState(false);
65
60
 
66
61
  const onOpenChange: MenuProps["onOpenChange"] = (keys) => {
67
62
  setOpenKeys(keys);
68
63
  };
69
64
 
70
- const copyTextToClipboard = async (text:string,key:string) => {
65
+ const copyTextToClipboard = async (text:string) => {
71
66
  try {
72
67
  await navigator.clipboard.writeText(text);
73
- setIsCopied({...isCopied,[key]:true});
68
+ setIsCopied(true);
74
69
  } catch (err) {}
75
70
  };
76
71
 
@@ -164,12 +159,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
164
159
  trigger="click"
165
160
  onOpenChange={(e) => {
166
161
  if (!e) return;
167
- setIsCopied({
168
- account:false,
169
- id:false,
170
- tenantName:false,
171
- tenantId:false
172
- });
162
+ setIsCopied(false);
173
163
  myWalletInfoAction && myWalletInfoAction();
174
164
  }}
175
165
  >
@@ -6,30 +6,12 @@
6
6
  .user-info {
7
7
  display: flex;
8
8
 
9
- .user-avatarBox{
9
+ .user-avatar {
10
10
  width: 72px;
11
11
  height: 72px;
12
+ border-radius: 50%;
13
+ background: rgba(255, 255, 255, 0.3);
12
14
  margin-right: 12px;
13
- position: relative;
14
- .user-avatar {
15
- width: 100%;
16
- height: 100%;
17
- border-radius: 50%;
18
- background: rgba(255, 255, 255, 0.3);
19
- }
20
- .user-mater{
21
- position: absolute;
22
- bottom: 0px;
23
- left: 0px;
24
- right: 0px;
25
- text-align: center;
26
- background-color: rgba(62, 119, 189 ,0.9);
27
- width: 50px;
28
- border-radius: 50px;
29
- color: #fff;
30
- transform: scale(0.9);
31
- margin: auto;
32
- }
33
15
  }
34
16
 
35
17
  .user-info-right {
@@ -100,7 +82,7 @@
100
82
  .li-flex {
101
83
  display: flex;
102
84
  .lios-keyMare {
103
- width: 50px;
85
+ width: 40px;
104
86
  }
105
87
  .lios-value {
106
88
  flex: 1;
@@ -151,8 +133,6 @@
151
133
  }
152
134
  }
153
135
  }
154
- .lios-logoutBox{
155
- display: flex;
156
136
 
157
137
  .lios-logout {
158
138
  cursor: pointer;
@@ -160,21 +140,18 @@
160
140
  justify-content: center;
161
141
  align-items: center;
162
142
  color: rgba(0, 0, 0, 0.45);
163
- border-radius: 2px;
143
+ border-radius: 4px;
164
144
  transition: background 0.3s;
165
145
  padding: 4px;
166
- flex: 1;
167
- border: 1px solid rgba(5, 5, 5, 0.06);
168
- margin: 4px 4px;
146
+
169
147
  &:hover {
170
- background: rgba(0, 0, 0, 0.03);
148
+ background: rgba(0, 0, 0, 0.08);
171
149
  }
172
150
 
173
151
  .logout-icon {
174
152
  width: 16px;
175
153
  height: 16px;
176
- margin-right: 3px;
154
+ margin-right: 8px;
177
155
  }
178
156
  }
179
- }
180
157
  }
@@ -1,10 +1,5 @@
1
1
  import React from "react";
2
- import {
3
- SwapOutlined,
4
- FormOutlined,
5
- CopyOutlined,
6
- LogoutOutlined,
7
- } from "@ant-design/icons";
2
+ import { SwapOutlined, FormOutlined,CopyOutlined } from "@ant-design/icons";
8
3
  import "./index.scss";
9
4
 
10
5
  interface UserType {
@@ -13,7 +8,6 @@ interface UserType {
13
8
  roleInfo: any[];
14
9
  id: string;
15
10
  account: string;
16
- isMaster: boolean;
17
11
  }
18
12
  interface CustomType {
19
13
  type: string;
@@ -51,13 +45,11 @@ export default function UserCard({
51
45
  amountInfo,
52
46
  customAction,
53
47
  isCopied,
54
- copyTextToClipboard,
48
+ copyTextToClipboard
55
49
  }: any) {
56
- const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)
57
- ?.g_config;
50
+ const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)?.g_config;
58
51
 
59
- const { name, avatar, roleInfo, id, account, isMaster }: UserType =
60
- user || {};
52
+ const { name, avatar, roleInfo , id , account }: UserType = user || {};
61
53
 
62
54
  const { isCompleted, isAudited }: CustomType = custom || {};
63
55
 
@@ -69,10 +61,7 @@ export default function UserCard({
69
61
  return (
70
62
  <div className="layout-user-card">
71
63
  <div className="user-info">
72
- <div className="user-avatarBox">
73
- <img className="user-avatar" src={avatar} />
74
- <div className="user-mater">{isMaster ? "主账号" : "子账号"}</div>
75
- </div>
64
+ <img className="user-avatar" src={avatar} />
76
65
  <div className="user-info-right">
77
66
  <span className="name">{name}</span>
78
67
  <div className="role-list">
@@ -84,61 +73,29 @@ export default function UserCard({
84
73
  </div>
85
74
  </div>
86
75
  </div>
87
- <div className="lios-userInfo">
88
- <div className="lios-li li-flex">
89
- <div className="lios-keyMare">账号</div>
90
- <div className="lios-valueMare" title={account}>
91
- {account}
92
- </div>
93
- <div
94
- className={isCopied?.['account'] ? "lios-iconDone" : "lios-icon"}
95
- onClick={() => {
96
- copyTextToClipboard(account,'account');
97
- }}
98
- >
99
- {isCopied?.['account'] ? "已复制" : <CopyOutlined />}
100
- </div>
101
- </div>
102
- <div className="lios-li li-flex">
103
- <div className="lios-keyMare">账号ID</div>
104
- <div className="lios-valueMare" title={id}>{id}</div>
105
- <div
106
- className={isCopied?.['id'] ? "lios-iconDone" : "lios-icon"}
107
- onClick={() => {
108
- copyTextToClipboard(id,'id');
109
- }}
110
- >
111
- {isCopied?.['id'] ? "已复制" : <CopyOutlined />}
112
- </div>
113
- </div>
114
- <div className="lios-li li-flex">
115
- <div className="lios-keyMare">租户名称</div>
116
- <div className="lios-valueMare" title={tenant?.name}>{tenant?.name}</div>
117
- <div
118
- className={"lios-icon"}
119
- onClick={() => {
120
- customAction && customAction();
121
- }}
122
- >
123
- <FormOutlined />
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>
124
91
  </div>
125
- </div>
126
- <div className="lios-li li-flex">
127
- <div className="lios-keyMare">租户ID</div>
128
- <div className="lios-valueMare" title={tenant?.id}>{tenant?.id}</div>
129
- <div
130
- className={isCopied?.['tenantId'] ? "lios-iconDone" : "lios-icon"}
131
- onClick={() => {
132
- copyTextToClipboard(tenant?.id,'tenantId');
133
- }}
134
- >
135
- {isCopied?.['tenantId'] ? "已复制" : <CopyOutlined />}
92
+ <div className="lios-li li-flex">
93
+ <div className="lios-keyMare">账号ID</div>
94
+ <div className="lios-value">{id}
95
+ </div>
136
96
  </div>
137
97
  </div>
138
- </div>
139
-
140
- {/* myWalletInfo */}
141
- { true && (
98
+ {myWalletInfo && (
142
99
  <div className="lios-userInfo">
143
100
  <div className="lios-li">
144
101
  <div className="lios-key">现金余额</div>
@@ -165,26 +122,81 @@ export default function UserCard({
165
122
  )}
166
123
  </div>
167
124
  )}
168
- <div className="lios-logoutBox">
169
- <div
170
- className="lios-logout"
171
- onClick={() => {
172
- location.href = switchTenantUrl;
173
- }}
174
- >
175
- <SwapOutlined className="logout-icon" />
176
- 切换租户
125
+
126
+ {custom && (
127
+ <div className="lios-userInfo">
128
+ <div className="lios-li li-flex">
129
+ <div className="lios-key">客户类型</div>
130
+ <div className="lios-value">{custom.type || ""}</div>
131
+ <div
132
+ className="lios-icon"
133
+ onClick={() => {
134
+ customAction && customAction();
135
+ }}
136
+ >
137
+ <FormOutlined />
138
+ </div>
139
+ </div>
140
+ <div className="lios-li">
141
+ <div className="lios-key">是否审核</div>
142
+ <div className="lios-value">{isAudited ? "是" : "否"}</div>
143
+ </div>
144
+ <div className="lios-li">
145
+ <div className="lios-key">是否资料完备</div>
146
+ <div className="lios-value">{isCompleted ? "是" : "否"}</div>
147
+ </div>
177
148
  </div>
149
+ )}
150
+
151
+ {tenant?.name && (
152
+ <div className="lios-tenant">
153
+ <div className="tenant-label">租户</div>
154
+ <div className="tenant-switch">
155
+ <div className="tenant-value">{tenant?.name}</div>
156
+ {switchTenantUrl && (
157
+ <div
158
+ className="tenant-icon"
159
+ onClick={() => {
160
+ location.href = switchTenantUrl;
161
+ }}
162
+ >
163
+ <SwapOutlined />
164
+ </div>
165
+ )}
166
+ </div>
167
+ </div>
168
+ )}
169
+
170
+ {logoutUrl && (
178
171
  <div
179
172
  className="lios-logout"
180
173
  onClick={() => {
181
174
  location.href = logoutUrl;
182
175
  }}
183
176
  >
184
- <LogoutOutlined className="logout-icon" />
177
+ <svg
178
+ className="logout-icon"
179
+ viewBox="0 0 1024 1024"
180
+ version="1.1"
181
+ xmlns="http://www.w3.org/2000/svg"
182
+ p-id="5022"
183
+ width="16"
184
+ height="16"
185
+ >
186
+ <path
187
+ d="M295.589 239.512c17.942-12.888 42.935-8.79 55.823 9.153 12.888 17.942 8.79 42.935-9.153 55.823C266.667 358.783 221 445.786 221 540.488 221 700.92 351.272 831 512 831s291-130.08 291-290.512c0-94.663-45.63-181.634-121.17-235.935-17.937-12.895-22.026-37.89-9.131-55.827 12.894-17.938 37.889-22.026 55.827-9.132C824.752 308.766 883 419.788 883 540.488 883 745.13 716.884 911 512 911S141 745.13 141 540.488c0-120.75 58.297-231.812 154.589-300.976z"
188
+ fill="currentColor"
189
+ p-id="5023"
190
+ ></path>
191
+ <path
192
+ d="M512 113c21.87 0 39.641 17.552 39.995 39.339L552 153v297c0 22.091-17.909 40-40 40-21.87 0-39.641-17.552-39.995-39.339L472 450V153c0-22.091 17.909-40 40-40z"
193
+ fill="currentColor"
194
+ p-id="5024"
195
+ ></path>
196
+ </svg>
185
197
  退出登录
186
198
  </div>
187
- </div>
199
+ )}
188
200
  </div>
189
201
  );
190
202
  };