cfel-base-components 2.5.10 → 2.5.11

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.
@@ -23,13 +23,14 @@
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://static-legacy.dingtalk.com/media/lQLPM5AkqOufBy7NAyDNAyCwJZ592czMOC4EeIgNJAAGAA_800_800.png",
30
+ avatar: "https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/puhui-home/userLogo.jpeg",
31
31
  account: "15957797376",
32
- roleInfo: []
32
+ roleInfo: ["\u8D85\u7EA7\u7BA1\u7406\u5458"],
33
+ isMaster: false
33
34
  },
34
35
  custom: {
35
36
  id: 1727864976691109890,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.5.10",
3
+ "version": "2.5.11",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -56,16 +56,21 @@ 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
+ const [isCopied, setIsCopied] = useState({
60
+ account:false,
61
+ id:false,
62
+ tenantName:false,
63
+ tenantId:false
64
+ });
60
65
 
61
66
  const onOpenChange: MenuProps["onOpenChange"] = (keys) => {
62
67
  setOpenKeys(keys);
63
68
  };
64
69
 
65
- const copyTextToClipboard = async (text:string) => {
70
+ const copyTextToClipboard = async (text:string,key:string) => {
66
71
  try {
67
72
  await navigator.clipboard.writeText(text);
68
- setIsCopied(true);
73
+ setIsCopied({...isCopied,[key]:true});
69
74
  } catch (err) {}
70
75
  };
71
76
 
@@ -159,7 +164,12 @@ export default function LiosLayout(props: LiosLayoutlProps) {
159
164
  trigger="click"
160
165
  onOpenChange={(e) => {
161
166
  if (!e) return;
162
- setIsCopied(false);
167
+ setIsCopied({
168
+ account:false,
169
+ id:false,
170
+ tenantName:false,
171
+ tenantId:false
172
+ });
163
173
  myWalletInfoAction && myWalletInfoAction();
164
174
  }}
165
175
  >
@@ -6,12 +6,30 @@
6
6
  .user-info {
7
7
  display: flex;
8
8
 
9
- .user-avatar {
9
+ .user-avatarBox{
10
10
  width: 72px;
11
11
  height: 72px;
12
- border-radius: 50%;
13
- background: rgba(255, 255, 255, 0.3);
14
12
  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
+ }
15
33
  }
16
34
 
17
35
  .user-info-right {
@@ -82,7 +100,7 @@
82
100
  .li-flex {
83
101
  display: flex;
84
102
  .lios-keyMare {
85
- width: 40px;
103
+ width: 50px;
86
104
  }
87
105
  .lios-value {
88
106
  flex: 1;
@@ -133,6 +151,8 @@
133
151
  }
134
152
  }
135
153
  }
154
+ .lios-logoutBox{
155
+ display: flex;
136
156
 
137
157
  .lios-logout {
138
158
  cursor: pointer;
@@ -140,18 +160,21 @@
140
160
  justify-content: center;
141
161
  align-items: center;
142
162
  color: rgba(0, 0, 0, 0.45);
143
- border-radius: 4px;
163
+ border-radius: 2px;
144
164
  transition: background 0.3s;
145
165
  padding: 4px;
146
-
166
+ flex: 1;
167
+ border: 1px solid rgba(5, 5, 5, 0.06);
168
+ margin: 4px 4px;
147
169
  &:hover {
148
- background: rgba(0, 0, 0, 0.08);
170
+ background: rgba(0, 0, 0, 0.03);
149
171
  }
150
172
 
151
173
  .logout-icon {
152
174
  width: 16px;
153
175
  height: 16px;
154
- margin-right: 8px;
176
+ margin-right: 3px;
155
177
  }
156
178
  }
179
+ }
157
180
  }
@@ -1,5 +1,10 @@
1
1
  import React from "react";
2
- import { SwapOutlined, FormOutlined,CopyOutlined } from "@ant-design/icons";
2
+ import {
3
+ SwapOutlined,
4
+ FormOutlined,
5
+ CopyOutlined,
6
+ LogoutOutlined,
7
+ } from "@ant-design/icons";
3
8
  import "./index.scss";
4
9
 
5
10
  interface UserType {
@@ -8,6 +13,7 @@ interface UserType {
8
13
  roleInfo: any[];
9
14
  id: string;
10
15
  account: string;
16
+ isMaster: boolean;
11
17
  }
12
18
  interface CustomType {
13
19
  type: string;
@@ -45,11 +51,13 @@ export default function UserCard({
45
51
  amountInfo,
46
52
  customAction,
47
53
  isCopied,
48
- copyTextToClipboard
54
+ copyTextToClipboard,
49
55
  }: any) {
50
- const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)?.g_config;
56
+ const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)
57
+ ?.g_config;
51
58
 
52
- const { name, avatar, roleInfo , id , account }: UserType = user || {};
59
+ const { name, avatar, roleInfo, id, account, isMaster }: UserType =
60
+ user || {};
53
61
 
54
62
  const { isCompleted, isAudited }: CustomType = custom || {};
55
63
 
@@ -61,7 +69,10 @@ export default function UserCard({
61
69
  return (
62
70
  <div className="layout-user-card">
63
71
  <div className="user-info">
64
- <img className="user-avatar" src={avatar} />
72
+ <div className="user-avatarBox">
73
+ <img className="user-avatar" src={avatar} />
74
+ <div className="user-mater">{isMaster ? "主账号" : "子账号"}</div>
75
+ </div>
65
76
  <div className="user-info-right">
66
77
  <span className="name">{name}</span>
67
78
  <div className="role-list">
@@ -73,29 +84,61 @@ export default function UserCard({
73
84
  </div>
74
85
  </div>
75
86
  </div>
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>
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}
91
92
  </div>
92
- <div className="lios-li li-flex">
93
- <div className="lios-keyMare">账号ID</div>
94
- <div className="lios-value">{id}
95
- </div>
93
+ <div
94
+ className={isCopied?.['account'] ? "lios-iconDone" : "lios-icon"}
95
+ onClick={() => {
96
+ copyTextToClipboard(account,'account');
97
+ }}
98
+ >
99
+ {isCopied?.['account'] ? "已复制" : <CopyOutlined />}
96
100
  </div>
97
101
  </div>
98
- {myWalletInfo && (
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 />
124
+ </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 />}
136
+ </div>
137
+ </div>
138
+ </div>
139
+
140
+ {/* myWalletInfo */}
141
+ { true && (
99
142
  <div className="lios-userInfo">
100
143
  <div className="lios-li">
101
144
  <div className="lios-key">现金余额</div>
@@ -122,81 +165,26 @@ export default function UserCard({
122
165
  )}
123
166
  </div>
124
167
  )}
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>
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>
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
+ 切换租户
167
177
  </div>
168
- )}
169
-
170
- {logoutUrl && (
171
178
  <div
172
179
  className="lios-logout"
173
180
  onClick={() => {
174
181
  location.href = logoutUrl;
175
182
  }}
176
183
  >
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>
184
+ <LogoutOutlined className="logout-icon" />
197
185
  退出登录
198
186
  </div>
199
- )}
187
+ </div>
200
188
  </div>
201
189
  );
202
190
  };