cfel-base-components 2.0.4 → 2.0.6

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.
@@ -32,6 +32,13 @@
32
32
  account: "15957797376",
33
33
  roleInfo: []
34
34
  },
35
+ custom: {
36
+ id: 1727864976691109890,
37
+ name: "\u6D6A\u5473\u4ED9",
38
+ type: "\u4E2A\u4EBA",
39
+ isCompleted: 1,
40
+ isAudited: 1
41
+ },
35
42
  logoutUrl: "\/sso\/logout?back=http%3A%2F%2Flios-iot-obee-daily.chengfengerlai.com%2Fdelivery",
36
43
  switchTenantUrl: "https:\/\/cfel-sso-daily.chengfengerlai.com\/tenant\/switch?fakeAccountId=1676424765496406018\u0026redirect=http:\/\/lios-iot-obee-daily.chengfengerlai.com\/sso\/login?back=http%3A%2F%2Flios-iot-obee-daily.chengfengerlai.com%2Fdelivery",
37
44
  productCode: "lios-iot-obee",
@@ -26,126 +26,25 @@ const App = () => {
26
26
  },
27
27
  ],
28
28
  },
29
- {
30
- label: '设备中心',
31
- key: 'device',
32
- icon: <SwapOutlined />,
33
- children: [
34
- {
35
- label: '设备管理',
36
- key: 'device-list',
37
- },
38
- ],
39
- },
40
- {
41
- label: '设备中心',
42
- key: 'device',
43
- icon: <SwapOutlined />,
44
- children: [
45
- {
46
- label: '设备管理',
47
- key: 'device-list',
48
- },
49
- ],
50
- },
51
- {
52
- label: '设备中心',
53
- key: 'device',
54
- icon: <SwapOutlined />,
55
- children: [
56
- {
57
- label: '设备管理',
58
- key: 'device-list',
59
- },
60
- ],
61
- },
62
- {
63
- label: '设备中心',
64
- key: 'device',
65
- icon: <SwapOutlined />,
66
- children: [
67
- {
68
- label: '设备管理',
69
- key: 'device-list',
70
- },
71
- ],
72
- },
73
- {
74
- label: '设备中心',
75
- key: 'device',
76
- icon: <SwapOutlined />,
77
- children: [
78
- {
79
- label: '设备管理',
80
- key: 'device-list',
81
- },
82
- ],
83
- },
84
- {
85
- label: '空间中心',
86
- key: 'space',
87
- icon: <SwapOutlined />,
88
- children: [
89
- {
90
- label: '空间管理',
91
- key: 'space-list',
92
- },
93
- {
94
- label: '空间类型',
95
- key: 'space-type',
96
- },
97
- ],
98
- },
99
- {
100
- label: '应用中心',
101
- key: 'packet',
102
- icon: <SwapOutlined />,
103
- children: [
104
- {
105
- label: 'OTA任务列表',
106
- key: 'packet-list',
107
- },
108
- {
109
- label: '桌牌推送',
110
- key: 'card-push',
111
- },
112
- {
113
- label: '会议室列表',
114
- key: 'room-intelligence',
115
- },
116
- ],
117
- },
118
- {
119
- label: '权限管理',
120
- key: 'authority',
121
- icon: <SwapOutlined />,
122
- children: [
123
- {
124
- label: '账号列表',
125
- key: 'account-list',
126
- },
127
- {
128
- label: '角色列表',
129
- key: 'role-list',
130
- },
131
- ],
132
- },
133
- {
134
- label: '规则模板',
135
- key: 'rule-template',
136
- icon: <i className="iconfont icon-moban" />
137
- },
138
- {
139
- label: '规则实例',
140
- key: 'rule-instance',
141
- icon: <i className="iconfont icon-guize" />
142
- },
143
-
144
29
  ]}
145
30
  logoData={{
146
31
  type:'img',
147
32
  content:'运营平台'
148
33
  }}
34
+ user={{
35
+ name: (window)?.g_config?.user?.name,
36
+ avatar: (window)?.g_config?.user?.avatar,
37
+ tenantName: (window)?.g_config?.tenant?.name,
38
+ role: (window)?.g_config?.user?.roleInfo,
39
+ }}
40
+ custom={{
41
+ type:(window)?.g_config?.custom?.type,
42
+ isCompleted:(window)?.g_config?.custom?.isCompleted,
43
+ isAudited:(window)?.g_config?.custom?.isAudited,
44
+ hrefUrl='/web/user-info'
45
+ }}
46
+ logoutUrl={(window)?.g_config?.logoutUrl}
47
+ switchTenantUrl={(window)?.g_config?.switchTenantUrl}
149
48
  >
150
49
  <Account></Account>
151
50
  </Layout>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -188,7 +188,6 @@ body {
188
188
 
189
189
  .user-info {
190
190
  display: flex;
191
- margin-bottom: 12px;
192
191
 
193
192
  .author {
194
193
  width: 72px;
@@ -227,7 +226,7 @@ body {
227
226
 
228
227
  .tenant-label {
229
228
  font-size: 12px;
230
- color: rgba(0, 0, 0, .65);
229
+ color: rgba(0, 0, 0, .5);
231
230
  }
232
231
  .tenant-switch{
233
232
  display: flex;
@@ -251,6 +250,41 @@ body {
251
250
  }
252
251
 
253
252
 
253
+ }
254
+ .lios-userInfo{
255
+ padding: 10px 0px;
256
+ margin: 10px 0px;
257
+ border-top: 1px solid rgba(5, 5, 5, 0.06);
258
+ border-bottom: 1px solid rgba(5, 5, 5, 0.06);
259
+ .li-flex{
260
+ display: flex;
261
+ .lios-value{
262
+ flex: 1;
263
+ }
264
+ }
265
+ .lios-li{
266
+ .lios-key{
267
+ font-size: 12px;
268
+ color: rgba(0, 0, 0, .5);
269
+ display: inline-block;
270
+ }
271
+ .lios-value{
272
+ padding-left: 8px;
273
+ display: inline-block;
274
+ font-size: 12px;
275
+ color: rgba(0, 0, 0, .85);
276
+ }
277
+ .lios-icon{
278
+ width: 40px;
279
+ text-align: center;
280
+ color: rgba(0, 0, 0, .45);
281
+ }
282
+ .lios-icon:hover{
283
+ cursor: pointer;
284
+ color: rgba(0, 0, 0, .85);
285
+ }
286
+ }
287
+
254
288
  }
255
289
 
256
290
 
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { Layout, Menu, MenuProps, Popover } from 'antd';
3
- import { SwapOutlined, } from '@ant-design/icons';
3
+ import { SwapOutlined, FormOutlined } from '@ant-design/icons';
4
4
  import "./index.scss"
5
5
 
6
6
  export interface LiosLayoutlProps {
@@ -17,13 +17,19 @@ export interface LiosLayoutlProps {
17
17
  tenantName: string,
18
18
  role: any[]
19
19
  };
20
+ custom?: {
21
+ type: string,
22
+ isCompleted: number,
23
+ isAudited: number,
24
+ hrefUrl:string
25
+ }
20
26
  logoutUrl?: string,
21
27
  switchTenantUrl?: string,
22
28
  defaultOpenKeys?: string[],
23
29
  productList?: any[],
24
- logoData?:{
25
- type:string,
26
- content:string
30
+ logoData?: {
31
+ type: string,
32
+ content: string
27
33
  }
28
34
  }
29
35
 
@@ -35,6 +41,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
35
41
  selectedKeys,
36
42
  actions,
37
43
  user,
44
+ custom,
38
45
  logoutUrl,
39
46
  switchTenantUrl,
40
47
  defaultOpenKeys,
@@ -48,15 +55,20 @@ export default function LiosLayout(props: LiosLayoutlProps) {
48
55
  tenantName,
49
56
  role,
50
57
  } = user || {}
58
+ const {
59
+ isCompleted,
60
+ isAudited,
61
+ hrefUrl
62
+ } = custom || {}
51
63
  const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || []);
52
64
  const [currentProduct, setCurrentProduct] = useState<any>({});
53
-
65
+
54
66
  const { Sider } = Layout;
55
67
 
56
68
  const [collapsed, setCollapsed] = useState(false);
57
69
 
58
70
  useEffect(() => {
59
- if(!productList)return
71
+ if (!productList) return
60
72
  let cp = productList?.filter((i: any) => i.productCode == productCode)[0]
61
73
  setCurrentProduct(cp)
62
74
  }, [productList])
@@ -64,11 +76,15 @@ export default function LiosLayout(props: LiosLayoutlProps) {
64
76
  const onOpenChange: MenuProps['onOpenChange'] = (keys) => {
65
77
  setOpenKeys(keys);
66
78
  };
67
-
79
+ const editUserInfo = () => {
80
+ const { origin } = window.location
81
+ window.location.href = origin + hrefUrl
82
+ }
68
83
  const UserCard = () => {
69
84
  return <div className='lios-user-card'>
70
85
  <div className='user-info'>
71
86
  <img
87
+
72
88
  className="author"
73
89
  src={avatar}
74
90
  />
@@ -82,6 +98,26 @@ export default function LiosLayout(props: LiosLayoutlProps) {
82
98
  </div>
83
99
  </div>
84
100
 
101
+ {
102
+ custom && <div className='lios-userInfo'>
103
+ <div className='lios-li li-flex'>
104
+ <div className='lios-key'>客户类型</div>
105
+ <div className='lios-value'>{custom.type || ''}</div>
106
+ <div className='lios-icon' onClick={(() => { editUserInfo() })}>
107
+ <FormOutlined />
108
+ </div>
109
+ </div>
110
+ <div className='lios-li'>
111
+ <div className='lios-key'>是否审核</div>
112
+ <div className='lios-value'>{isAudited ? '是' : '否'}</div>
113
+ </div>
114
+ <div className='lios-li'>
115
+ <div className='lios-key'>是否资料完备</div>
116
+ <div className='lios-value'>{isCompleted ? '是' : '否'}</div>
117
+ </div>
118
+ </div>
119
+ }
120
+
85
121
  {tenantName && <div className='lios-tenant'>
86
122
  <div className='tenant-label'>租户</div>
87
123
  <div className='tenant-switch'>
@@ -121,78 +157,78 @@ export default function LiosLayout(props: LiosLayoutlProps) {
121
157
  })}
122
158
  </div>
123
159
  }
124
- const MenuStyle={
125
- width:collapsed?80:256
160
+ const MenuStyle = {
161
+ width: collapsed ? 80 : 256
126
162
  }
127
163
  return (
128
- <Layout className="layoutWarp">
129
- <div className="lios-header">
164
+ <Layout className="layoutWarp">
165
+ <div className="lios-header">
130
166
 
131
- <div className="background">
132
- <img className="background-img" src="https://pic.imgdb.cn/item/64813de01ddac507cc192a6e.jpg" alt="" />
133
- <div className="background-mask" />
134
- </div>
167
+ <div className="background">
168
+ <img className="background-img" src="https://pic.imgdb.cn/item/64813de01ddac507cc192a6e.jpg" alt="" />
169
+ <div className="background-mask" />
170
+ </div>
135
171
 
136
- <strong className="lios-logo">
137
- {
138
- logoData?.type == "img" ?
139
- <img className="img" src={logoData?.content || ''}/>
140
- :
141
- <div className="text">
142
- {logoData?.content || ''}
143
- </div>
144
- }
145
- <div className="interval" />
146
- <div className="app-list">
172
+ <strong className="lios-logo">
147
173
  {
148
- productList ?
149
- <Popover placement="bottom" content={<ProductListFunc />} arrow={false} trigger="click">
174
+ logoData?.type == "img" ?
175
+ <img className="img" src={logoData?.content || ''} />
176
+ :
177
+ <div className="text">
178
+ {logoData?.content || ''}
179
+ </div>
180
+ }
181
+ <div className="interval" />
182
+ <div className="app-list">
183
+ {
184
+ productList ?
185
+ <Popover placement="bottom" content={<ProductListFunc />} arrow={false} trigger="click">
186
+ <div className="app-list-current">
187
+ {currentProduct?.logoUrl && <img src={currentProduct?.logoUrl || ""} alt="" />}
188
+ <div>
189
+ {currentProduct?.productName || "请选择应用"}
190
+ </div>
191
+ </div>
192
+ </Popover> :
150
193
  <div className="app-list-current">
151
194
  {currentProduct?.logoUrl && <img src={currentProduct?.logoUrl || ""} alt="" />}
152
195
  <div>
153
- {currentProduct?.productName || "请选择应用"}
196
+ {currentProduct?.productName}
154
197
  </div>
155
198
  </div>
156
- </Popover> :
157
- <div className="app-list-current">
158
- {currentProduct?.logoUrl && <img src={currentProduct?.logoUrl || ""} alt="" />}
159
- <div>
160
- {currentProduct?.productName}
161
- </div>
162
- </div>
163
- }
199
+ }
200
+ </div>
201
+ </strong>
202
+ <div className='lios-header-fill' />
203
+
204
+ <div className='lios-header-actions'>
205
+ {actions?.map((item, index) => {
206
+ return <div className='actions-item' key={index}>
207
+ {item}
208
+ </div>
209
+ })}
164
210
  </div>
165
- </strong>
166
- <div className='lios-header-fill' />
167
211
 
168
- <div className='lios-header-actions'>
169
- {actions?.map((item, index) => {
170
- return <div className='actions-item' key={index}>
171
- {item}
212
+ <Popover placement="bottom" content={<UserCard />} arrow={false} trigger="click">
213
+ <div className="lios-header-user">
214
+ <img
215
+ className="author"
216
+ src={avatar}
217
+ />
218
+ <div className="name">
219
+ {name}
220
+ </div>
172
221
  </div>
173
- })}
222
+ </Popover>
174
223
  </div>
175
224
 
176
- <Popover placement="bottom" content={<UserCard />} arrow={false} trigger="click">
177
- <div className="lios-header-user">
178
- <img
179
- className="author"
180
- src={avatar}
181
- />
182
- <div className="name">
183
- {name}
184
- </div>
185
- </div>
186
- </Popover>
187
- </div>
188
-
189
- <div className="lios-main">
225
+ <div className="lios-main">
190
226
  <Sider
191
227
  className="lios-side"
192
- theme={"light"}
193
- collapsible
194
- collapsed={collapsed}
195
- width={collapsed?60:256}
228
+ theme={"light"}
229
+ collapsible
230
+ collapsed={collapsed}
231
+ width={collapsed ? 60 : 256}
196
232
  onCollapse={(value) => setCollapsed(value)}>
197
233
  <Menu
198
234
  mode="inline"
@@ -206,10 +242,10 @@ export default function LiosLayout(props: LiosLayoutlProps) {
206
242
  selectedKeys={selectedKeys}
207
243
  />
208
244
  </Sider>
209
- <div className="lios-content">
210
- {props.children}
245
+ <div className="lios-content">
246
+ {props.children}
247
+ </div>
211
248
  </div>
212
- </div>
213
- </Layout>
249
+ </Layout>
214
250
  )
215
251
  }
@@ -123,7 +123,7 @@ export default function index({
123
123
  >
124
124
  {
125
125
  formDom.map((item: any, index: number) => {
126
- return showCom(item)
126
+ return <div key={index}>{showCom(item)}</div>
127
127
  })
128
128
  }
129
129
  </Form>