cfel-base-components 2.5.47 → 2.5.49

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.
@@ -0,0 +1,180 @@
1
+ //用户卡片
2
+ .layout-user-card {
3
+ min-width: 182px;
4
+ max-width: 262px;
5
+
6
+ .user-info {
7
+ display: flex;
8
+
9
+ .user-avatarBox{
10
+ width: 72px;
11
+ height: 72px;
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
+ }
33
+ }
34
+
35
+ .user-info-right {
36
+ flex: 1;
37
+ }
38
+
39
+ .name {
40
+ display: inline-block;
41
+ margin-top: 18px;
42
+ }
43
+
44
+ .role-list {
45
+ font-size: 12px;
46
+ line-height: 16px;
47
+ margin-top: 4px;
48
+
49
+ .role-item {
50
+ background: rgba(204, 204, 204, 0.55);
51
+ padding: 2px 8px;
52
+ border-radius: 8px;
53
+ display: inline-block;
54
+ margin-right: 4px;
55
+ margin-bottom: 4px;
56
+ }
57
+ }
58
+ }
59
+
60
+ .lios-tenant {
61
+ padding: 5px 0px;
62
+ margin: 5px 0px;
63
+ border-top: 1px solid rgba(5, 5, 5, 0.06);
64
+
65
+ .tenant-label {
66
+ font-size: 12px;
67
+ color: rgba(0, 0, 0, 0.5);
68
+ }
69
+
70
+ .tenant-switch {
71
+ display: flex;
72
+
73
+ .tenant-value {
74
+ flex: 1;
75
+ font-size: 14px;
76
+ color: rgba(0, 0, 0, 0.85);
77
+ }
78
+
79
+ .tenant-icon {
80
+ width: 40px;
81
+ text-align: center;
82
+ color: rgba(0, 0, 0, 0.45);
83
+ display: flex;
84
+ justify-content: center;
85
+ align-items: center;
86
+ }
87
+
88
+ .tenant-icon:hover {
89
+ cursor: pointer;
90
+ color: rgba(0, 0, 0, 0.85);
91
+ }
92
+ }
93
+ }
94
+
95
+ .lios-userInfo {
96
+ padding: 5px 0px;
97
+ margin: 5px 0px;
98
+ border-top: 1px solid rgba(5, 5, 5, 0.06);
99
+
100
+ .li-flex {
101
+ display: flex;
102
+ .lios-keyMare {
103
+ width: 50px;
104
+ }
105
+ .lios-value {
106
+ flex: 1;
107
+ }
108
+ .lios-valueMare {
109
+ flex: 1;
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ }
113
+
114
+ }
115
+
116
+ .lios-li {
117
+ line-height: 22px;
118
+
119
+ .lios-key, .lios-keyMare {
120
+ font-size: 12px;
121
+ color: rgba(0, 0, 0, 0.5);
122
+ display: inline-block;
123
+ }
124
+
125
+ .lios-value, .lios-valueMare {
126
+ padding-left: 8px;
127
+ display: inline-block;
128
+ font-size: 12px;
129
+ color: rgba(0, 0, 0, 0.85);
130
+
131
+ span {
132
+ padding-left: 5px;
133
+ }
134
+ }
135
+ .lios-iconDone {
136
+ width: 40px;
137
+ text-align: center;
138
+ color: rgba(0, 0, 0, 0.45);
139
+ font-size: 10px;
140
+ }
141
+ .lios-icon {
142
+ width: 40px;
143
+ text-align: center;
144
+ color: rgba(0, 0, 0, 0.45);
145
+ transition: all 0.3s;
146
+ }
147
+
148
+ .lios-icon:hover {
149
+ cursor: pointer;
150
+ color: rgba(0, 0, 0, 0.85);
151
+ }
152
+ }
153
+ }
154
+ .lios-logoutBox{
155
+ display: flex;
156
+
157
+ .lios-logout {
158
+ cursor: pointer;
159
+ display: flex;
160
+ justify-content: center;
161
+ align-items: center;
162
+ color: rgba(0, 0, 0, 0.45);
163
+ border-radius: 2px;
164
+ transition: background 0.3s;
165
+ padding: 4px;
166
+ flex: 1;
167
+ border: 1px solid rgba(5, 5, 5, 0.06);
168
+ margin: 4px 4px;
169
+ &:hover {
170
+ background: rgba(0, 0, 0, 0.03);
171
+ }
172
+
173
+ .logout-icon {
174
+ width: 16px;
175
+ height: 16px;
176
+ margin-right: 3px;
177
+ }
178
+ }
179
+ }
180
+ }
@@ -0,0 +1,162 @@
1
+ import React from "react";
2
+ import {
3
+ SwapOutlined,
4
+ FormOutlined,
5
+ CopyOutlined,
6
+ LogoutOutlined,
7
+ } from "@ant-design/icons";
8
+ import "./index.scss";
9
+
10
+ interface UserType {
11
+ name: string;
12
+ avatar: string;
13
+ roleInfo: any[];
14
+ id: string;
15
+ account: string;
16
+ isMaster: boolean;
17
+ }
18
+ interface CustomType {
19
+ type: string;
20
+ isCompleted: number;
21
+ isAudited: number;
22
+ hrefUrl: string;
23
+ historyAction?: any;
24
+ }
25
+ interface MyWalletInfoType {
26
+ availableCashAmount: string;
27
+ availableAmount: string;
28
+ currency: string;
29
+ }
30
+ interface MyLoginInfoType {
31
+ isAdmin: any;
32
+ }
33
+ interface AmountInfoType {
34
+ residueNum: string;
35
+ currencyCode: string;
36
+ }
37
+
38
+ const renderCurrency = (currency: string) => {
39
+ switch (currency) {
40
+ case "CNY":
41
+ return "¥ ";
42
+ case "USD":
43
+ return "$ ";
44
+ case "JPY":
45
+ return "JP¥ ";
46
+ default:
47
+ return "¥ ";
48
+ }
49
+ };
50
+
51
+ export default function UserCard({
52
+ myWalletInfo,
53
+ MyLoginInfo,
54
+ amountInfo,
55
+ customAction,
56
+ isCopied,
57
+ copyTextToClipboard,
58
+ }: any) {
59
+ const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)
60
+ ?.g_config;
61
+
62
+ const { name, avatar, roleInfo, id, account, isMaster }: UserType =
63
+ user || {};
64
+
65
+ const { isCompleted, isAudited }: CustomType = custom || {};
66
+
67
+ const { isAdmin }: MyLoginInfoType = MyLoginInfo || {};
68
+
69
+ const { residueNum, currencyCode }: AmountInfoType = amountInfo || {};
70
+
71
+ const UserCard = () => {
72
+ return (
73
+ <div className="layout-user-card">
74
+ <div className="user-info">
75
+ <div className="user-avatarBox">
76
+ <img className="user-avatar" src={avatar}/>
77
+ <div className="user-mater">{isAdmin ? "主账号" : "子账号"}</div>
78
+ </div>
79
+ <div className="user-info-right">
80
+ <span className="name">{name}</span>
81
+ <div className="role-list">
82
+ {roleInfo?.map((i) => (
83
+ <span className="role-item" key={i}>
84
+ {i}
85
+ </span>
86
+ ))}
87
+ </div>
88
+ </div>
89
+ </div>
90
+ <div className="lios-userInfo">
91
+ <div className="lios-li li-flex">
92
+ <div className="lios-keyMare">账号ID</div>
93
+ <div className="lios-valueMare" title={id}>{id}</div>
94
+ <div
95
+ className={isCopied?.['id'] ? "lios-iconDone" : "lios-icon"}
96
+ onClick={() => {
97
+ copyTextToClipboard(id, 'id');
98
+ }}
99
+ >
100
+ {isCopied?.['id'] ? "已复制" : <CopyOutlined/>}
101
+ </div>
102
+ </div>
103
+ <div className="lios-li li-flex">
104
+ <div className="lios-keyMare">账号</div>
105
+ <div className="lios-valueMare" title={account}>
106
+ {account}
107
+ </div>
108
+ <div
109
+ className={isCopied?.['account'] ? "lios-iconDone" : "lios-icon"}
110
+ onClick={() => {
111
+ copyTextToClipboard(account, 'account');
112
+ }}
113
+ >
114
+ {isCopied?.['account'] ? "已复制" : <CopyOutlined/>}
115
+ </div>
116
+ </div>
117
+
118
+ <div className="lios-li li-flex">
119
+ <div className="lios-keyMare">租户ID</div>
120
+ <div className="lios-valueMare" title={tenant?.id}>{tenant?.id}</div>
121
+ <div
122
+ className={isCopied?.['tenantId'] ? "lios-iconDone" : "lios-icon"}
123
+ onClick={() => {
124
+ copyTextToClipboard(tenant?.id, 'tenantId');
125
+ }}
126
+ >
127
+ {isCopied?.['tenantId'] ? "已复制" : <CopyOutlined/>}
128
+ </div>
129
+ </div>
130
+ <div className="lios-li li-flex">
131
+ <div className="lios-keyMare">租户</div>
132
+ <div className="lios-valueMare" title={tenant?.name}>{tenant?.name}</div>
133
+ </div>
134
+ </div>
135
+
136
+
137
+ <div className="lios-logoutBox">
138
+ <div
139
+ className="lios-logout"
140
+ onClick={() => {
141
+ location.href = switchTenantUrl;
142
+ }}
143
+ >
144
+ <SwapOutlined className="logout-icon"/>
145
+ 切换租户
146
+ </div>
147
+ <div
148
+ className="lios-logout"
149
+ onClick={() => {
150
+ location.href = logoutUrl;
151
+ }}
152
+ >
153
+ <LogoutOutlined className="logout-icon"/>
154
+ 退出登录
155
+ </div>
156
+ </div>
157
+ </div>
158
+ );
159
+ };
160
+
161
+ return UserCard();
162
+ }
package/src/global.d.ts CHANGED
@@ -47,3 +47,5 @@ export interface Label {
47
47
  value: string
48
48
  children?: Label[]
49
49
  }
50
+
51
+ declare module '*.scss'
package/src/index.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import LiosLayout, { LiosLayoutlProps } from './components/layout'
2
-
2
+ import LiosLayoutConsole from './components/layout-console/index'
3
3
  import PageContainer from './components/base-component/PageContainer'
4
4
  import CopyRight from './components/base-component/CopyRight'
5
5
  import QueryFilter from './components/base-component/QueryFilter'
@@ -18,29 +18,26 @@ import CpcRole from './components/universal-pages/cpcRole' //cpc 角色
18
18
  import CpcRoleInfo from './components/universal-pages/cpcRoleInfo' //cpc角色详情
19
19
  import { getUrlParams, downloadFile, timeFormatter } from './utils/index'
20
20
  export {
21
- LiosLayout,
22
- LiosLayoutlProps,
23
-
24
- CopyRight,
25
- PageContainer,
26
- QueryFilter,
27
- ProTable,
28
- Pagination,
29
-
30
- Account,
31
- AccountInfo,
32
- Role,
33
- RoleInfo,
34
-
35
- request,
36
- iotRequest,
37
- hosts,
38
- getUrlParams,
39
- downloadFile,
40
- timeFormatter,
41
-
42
- CpcAccount,
43
- CpcAccountInfo,
44
- CpcRole,
45
- CpcRoleInfo
46
- }
21
+ LiosLayout,
22
+ LiosLayoutlProps,
23
+ LiosLayoutConsole,
24
+ CopyRight,
25
+ PageContainer,
26
+ QueryFilter,
27
+ ProTable,
28
+ Pagination,
29
+ Account,
30
+ AccountInfo,
31
+ Role,
32
+ RoleInfo,
33
+ request,
34
+ iotRequest,
35
+ hosts,
36
+ getUrlParams,
37
+ downloadFile,
38
+ timeFormatter,
39
+ CpcAccount,
40
+ CpcAccountInfo,
41
+ CpcRole,
42
+ CpcRoleInfo,
43
+ }
@@ -1,3 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib"
3
- }