@yeeyoon/library 1.8.1 → 1.8.5
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/lib/components/Header/assets/bpm.svg +1 -0
- package/lib/components/Header/components/PlatformModal/index.jsx +3 -5
- package/lib/components/Header/components/ProductListMenu/index.jsx +50 -9
- package/lib/components/Header/components/ProductListMenu/index.less +7 -0
- package/lib/components/Header/env.js +20 -3
- package/lib/components/Header/index.jsx +37 -10
- package/lib/components/Notification/env.js +3 -0
- package/lib/components/Notification/recent.jsx +9 -5
- package/lib/components/Notification/service.js +11 -3
- package/package.json +1 -1
- package/src/pages/index.js +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1631872777872" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3042" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><defs><style type="text/css"></style></defs><path d="M621.4144 214.528a351.9488 351.9488 0 0 0-288.7168-98.304h-0.256C170.752 135.7824 40.96 268.8 22.272 433.5616l49.5616 5.7856L0 628.5312l49.408-7.8848c43.0592 101.0176 130.3552 177.92 236.2368 206.1824 23.6032 8.0384 48.8448 12.288 74.6496 12.288h421.632c135.1168 0 244.5312-112.7424 242.0224-251.1872v-0.1024a240.2304 240.2304 0 0 0-45.5168-136.704 236.6976 236.6976 0 0 0-39.4752-43.52 248.6784 248.6784 0 0 0-163.4816-61.3376v49.4592l-96.8192-176.128-21.1968 36.2496a384.1024 384.1024 0 0 0-35.6864-41.0112l-0.2048-0.1536-0.1536-0.2048zM152.576 604.0064l43.9808-7.0144-124.7744-157.696 49.6128 5.8368C134.7584 327.168 228.352 231.3216 344.064 217.2416a253.2864 253.2864 0 0 1 208.0256 70.4512c19.456 19.456 35.9424 41.3696 48.5376 65.28l-23.7568 40.6016 198.6048 3.072V448c37.2736 0 72.192 13.824 98.7136 37.0688l0.256 0.256 0.3072 0.2048c8.4992 7.2704 16.1792 15.7184 22.8864 25.2416l0.2048 0.256 0.1536 0.256c6.6048 9.1136 11.776 18.1248 15.36 27.136l0.2048 0.4096 0.1536 0.4096c6.4 15.1552 10.0864 32.1024 10.4448 50.6368 1.4848 81.2544-62.72 147.5072-142.2336 147.5072H360.2944c-15.4624 0-30.464-2.6112-44.2368-7.424l-1.8432-0.6656-1.8944-0.512a258.3552 258.3552 0 0 1-159.6928-124.7232z" fill="#3ED09C" p-id="3043"></path></svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Card, Button, message, Image, Row, Col } from 'antd';
|
|
4
4
|
|
|
@@ -6,8 +6,7 @@ import { fetchSystemToken } from '../../service';
|
|
|
6
6
|
|
|
7
7
|
const PlatformModal = (props) => {
|
|
8
8
|
const { platforms, redirectUrl } = props;
|
|
9
|
-
const
|
|
10
|
-
const enterProductDetail = (token, userInfo) => {
|
|
9
|
+
const enterProductDetail = (token, userInfo, plat) => {
|
|
11
10
|
if (redirectUrl) {
|
|
12
11
|
window.open(`${redirectUrl}?token=${token}&userId=${userInfo.userId}`);
|
|
13
12
|
} else if (plat.forwardDomainName) {
|
|
@@ -22,12 +21,11 @@ const PlatformModal = (props) => {
|
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
23
|
const getSystemToken = async (item) => {
|
|
25
|
-
setPlat(item);
|
|
26
24
|
const resp = await fetchSystemToken({ platformId: item.id });
|
|
27
25
|
const { success, data } = resp;
|
|
28
26
|
if (success) {
|
|
29
27
|
const { token, ...rest } = data;
|
|
30
|
-
enterProductDetail(token, rest);
|
|
28
|
+
enterProductDetail(token, rest, item);
|
|
31
29
|
}
|
|
32
30
|
};
|
|
33
31
|
return (
|
|
@@ -1,21 +1,54 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Menu, Image } from 'antd';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Menu, Image, Modal } from 'antd';
|
|
3
3
|
import { AppstoreOutlined } from '@ant-design/icons';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import PlatformModal from '../PlatformModal';
|
|
6
|
+
import { getCollabRedirectUrl } from '../../env';
|
|
7
|
+
import ls from 'local-storage';
|
|
8
|
+
import styles from './index.less';
|
|
5
9
|
|
|
6
10
|
const { SubMenu } = Menu;
|
|
7
11
|
|
|
8
12
|
const ProductListMenu = (props) => {
|
|
9
13
|
const { productList, recommendProductList } = props;
|
|
10
14
|
const [openKeys] = useState(['sub1', 'sub2']);
|
|
15
|
+
const [platModal, setPlatModal] = useState(false);
|
|
16
|
+
const [platforms, setPlatforms] = useState([]);
|
|
17
|
+
const [newProductList, setNewProductList] = useState([]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setNewProductList([
|
|
20
|
+
{
|
|
21
|
+
code: 200000729,
|
|
22
|
+
description: '团队协作,任务分配一站式敏捷开发',
|
|
23
|
+
domainName: null,
|
|
24
|
+
icon:
|
|
25
|
+
'https://demo-yeeyoon-fm.oss-cn-zhangjiakou.aliyuncs.com/userCenter/productLogo/yiyunxietong.png',
|
|
26
|
+
id: '9f4f6e1a063711ecb0c00c42a1ff8370',
|
|
27
|
+
isClose: 0,
|
|
28
|
+
level: 1,
|
|
29
|
+
name: '宜云协同',
|
|
30
|
+
parentId: null,
|
|
31
|
+
tenants: null,
|
|
32
|
+
},
|
|
33
|
+
...productList,
|
|
34
|
+
]);
|
|
35
|
+
}, [productList]);
|
|
36
|
+
const enterDetail = (item) => {
|
|
37
|
+
if (item.code == 200000729) {
|
|
38
|
+
window.open(`${getCollabRedirectUrl()}?token=${ls.get('X-Auth-Token')}`);
|
|
39
|
+
} else {
|
|
40
|
+
setPlatModal(true);
|
|
41
|
+
setPlatforms(item.platforms);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
11
44
|
return (
|
|
12
|
-
|
|
45
|
+
<div className={styles['product-menu']}>
|
|
13
46
|
<Menu mode="inline" openKeys={openKeys} style={{ width: 256 }}>
|
|
14
47
|
<SubMenu key="sub1" icon={<AppstoreOutlined />} title="我的产品">
|
|
15
|
-
{
|
|
16
|
-
|
|
48
|
+
{newProductList.length ? (
|
|
49
|
+
newProductList.map((item) => {
|
|
17
50
|
return (
|
|
18
|
-
<Menu.Item key={
|
|
51
|
+
<Menu.Item key={item.code} onClick={() => enterDetail(item)}>
|
|
19
52
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
20
53
|
<Image
|
|
21
54
|
src={item.icon}
|
|
@@ -37,9 +70,9 @@ const ProductListMenu = (props) => {
|
|
|
37
70
|
</SubMenu>
|
|
38
71
|
<SubMenu key="sub2" icon={<AppstoreOutlined />} title="推荐产品">
|
|
39
72
|
{recommendProductList.length ? (
|
|
40
|
-
recommendProductList.map((item
|
|
73
|
+
recommendProductList.map((item) => {
|
|
41
74
|
return (
|
|
42
|
-
<Menu.Item key={
|
|
75
|
+
<Menu.Item key={item.code}>
|
|
43
76
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
44
77
|
<Image
|
|
45
78
|
src={item.icon}
|
|
@@ -60,7 +93,15 @@ const ProductListMenu = (props) => {
|
|
|
60
93
|
)}
|
|
61
94
|
</SubMenu>
|
|
62
95
|
</Menu>
|
|
63
|
-
|
|
96
|
+
<Modal
|
|
97
|
+
visible={platModal}
|
|
98
|
+
title="请选择平台"
|
|
99
|
+
footer={null}
|
|
100
|
+
onCancel={() => setPlatModal(false)}
|
|
101
|
+
>
|
|
102
|
+
<PlatformModal platforms={platforms} />
|
|
103
|
+
</Modal>
|
|
104
|
+
</div>
|
|
64
105
|
);
|
|
65
106
|
};
|
|
66
107
|
|
|
@@ -3,8 +3,9 @@ const { host } = window.location;
|
|
|
3
3
|
export function getIamApiHost() {
|
|
4
4
|
switch (host) {
|
|
5
5
|
case 'localhost:8000':
|
|
6
|
-
case 'localhost:8009':
|
|
7
6
|
case 'localhost:8003':
|
|
7
|
+
case 'localhost:8009':
|
|
8
|
+
case 'localhost:8010':
|
|
8
9
|
case 'testing-collab.yeeyoon.com':
|
|
9
10
|
case 'testing-profile.yeeyoon.com':
|
|
10
11
|
case 'testing-bpm.yeeyoon.com':
|
|
@@ -25,8 +26,9 @@ export function getIamApiHost() {
|
|
|
25
26
|
export function getIamRedirectUrl() {
|
|
26
27
|
switch (host) {
|
|
27
28
|
case 'localhost:8000':
|
|
28
|
-
case 'localhost:8009':
|
|
29
29
|
case 'localhost:8003':
|
|
30
|
+
case 'localhost:8009':
|
|
31
|
+
case 'localhost:8010':
|
|
30
32
|
case 'testing-collab.yeeyoon.com':
|
|
31
33
|
case 'testing-profile.yeeyoon.com':
|
|
32
34
|
case 'testing-bpm.yeeyoon.com':
|
|
@@ -46,8 +48,9 @@ export function getIamRedirectUrl() {
|
|
|
46
48
|
export function getProfileRedirectUrl(path) {
|
|
47
49
|
switch (host) {
|
|
48
50
|
case 'localhost:8000':
|
|
49
|
-
case 'localhost:8009':
|
|
50
51
|
case 'localhost:8003':
|
|
52
|
+
case 'localhost:8009':
|
|
53
|
+
case 'localhost:8010':
|
|
51
54
|
case 'testing-collab.yeeyoon.com':
|
|
52
55
|
case 'testing-profile.yeeyoon.com':
|
|
53
56
|
case 'testing-bpm.yeeyoon.com':
|
|
@@ -87,3 +90,17 @@ export function getOfficialSiteRedirectUrl(sysName) {
|
|
|
87
90
|
}
|
|
88
91
|
window.location.href = url;
|
|
89
92
|
}
|
|
93
|
+
|
|
94
|
+
export function getCollabRedirectUrl() {
|
|
95
|
+
switch (host) {
|
|
96
|
+
case 'localhost:8003':
|
|
97
|
+
case 'localhost:8000':
|
|
98
|
+
case 'testing-profile.yeeyoon.com':
|
|
99
|
+
return 'https://testing-collab.yeeyoon.com';
|
|
100
|
+
case 'staging-profile.yeeyoon.com':
|
|
101
|
+
return 'https://staging-collab.yeeyoon.com';
|
|
102
|
+
case 'profile.yeeyoon.com':
|
|
103
|
+
default:
|
|
104
|
+
return 'https://collab.yeeyoon.com';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -14,7 +14,12 @@ import Notification from '../Notification/recent';
|
|
|
14
14
|
import ProductListMenu from './components/ProductListMenu/';
|
|
15
15
|
import PlatformModal from './components/PlatformModal/';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
fetchSystemToken,
|
|
19
|
+
fetchUserInfo,
|
|
20
|
+
fetchProductList,
|
|
21
|
+
logout,
|
|
22
|
+
} from './service';
|
|
18
23
|
import {
|
|
19
24
|
getProfileRedirectUrl,
|
|
20
25
|
getIamRedirectUrl,
|
|
@@ -23,6 +28,7 @@ import {
|
|
|
23
28
|
|
|
24
29
|
import LogoProfile from './assets/profile.svg';
|
|
25
30
|
import LogoCollab from './assets/collab.svg';
|
|
31
|
+
import LogoBpm from './assets/bpm.svg';
|
|
26
32
|
|
|
27
33
|
import styles from './index.less';
|
|
28
34
|
|
|
@@ -34,6 +40,7 @@ const Header = (props) => {
|
|
|
34
40
|
const { token, tenantId = '', productName = 'profile' } = props;
|
|
35
41
|
const [platforms, setPlatforms] = useState([]);
|
|
36
42
|
const [userInfo, setUserInfo] = useState(null);
|
|
43
|
+
const [systemUserInfo, setSystemUserInfo] = useState(null);
|
|
37
44
|
const [tenants, setTenants] = useState([]);
|
|
38
45
|
const [userId, setUserId] = useState([]);
|
|
39
46
|
const [productListMenuDrawerShow, setProductListMenuDrawerShow] =
|
|
@@ -52,7 +59,7 @@ const Header = (props) => {
|
|
|
52
59
|
)}?token=${token}`;
|
|
53
60
|
}}
|
|
54
61
|
>
|
|
55
|
-
|
|
62
|
+
个人中心
|
|
56
63
|
</Menu.Item>
|
|
57
64
|
<Menu.Item
|
|
58
65
|
icon={<SettingOutlined />}
|
|
@@ -70,12 +77,13 @@ const Header = (props) => {
|
|
|
70
77
|
doLogout(userId);
|
|
71
78
|
}}
|
|
72
79
|
>
|
|
73
|
-
|
|
80
|
+
退出登录
|
|
74
81
|
</Menu.Item>
|
|
75
82
|
</Menu>
|
|
76
83
|
);
|
|
77
84
|
|
|
78
85
|
useEffect(() => {
|
|
86
|
+
getCySystemToken();
|
|
79
87
|
getUserInfo();
|
|
80
88
|
}, []);
|
|
81
89
|
|
|
@@ -96,6 +104,17 @@ const Header = (props) => {
|
|
|
96
104
|
}`;
|
|
97
105
|
};
|
|
98
106
|
|
|
107
|
+
const getCySystemToken = async () => {
|
|
108
|
+
const resp = await fetchSystemToken({
|
|
109
|
+
platformId: 'f12a71b6063611ecb0c00c42a1ff8370',
|
|
110
|
+
});
|
|
111
|
+
const { success, data } = resp;
|
|
112
|
+
if (success) {
|
|
113
|
+
const { token, userId } = data;
|
|
114
|
+
setSystemUserInfo({ token, userId });
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
99
118
|
const getUserInfo = async () => {
|
|
100
119
|
const resp = await fetchUserInfo();
|
|
101
120
|
const { success, data } = resp;
|
|
@@ -145,6 +164,11 @@ const Header = (props) => {
|
|
|
145
164
|
logo: LogoCollab,
|
|
146
165
|
name: '宜云协同',
|
|
147
166
|
};
|
|
167
|
+
case 'bpm':
|
|
168
|
+
return {
|
|
169
|
+
logo: LogoBpm,
|
|
170
|
+
name: '智慧项目',
|
|
171
|
+
};
|
|
148
172
|
}
|
|
149
173
|
};
|
|
150
174
|
|
|
@@ -193,13 +217,16 @@ const Header = (props) => {
|
|
|
193
217
|
}}
|
|
194
218
|
/>
|
|
195
219
|
</Tooltip>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
220
|
+
{systemUserInfo && (
|
|
221
|
+
<Notification
|
|
222
|
+
showLabel={false}
|
|
223
|
+
customStyles={{
|
|
224
|
+
icon: { height: '62px', display: 'flex' },
|
|
225
|
+
list: { top: '44px' },
|
|
226
|
+
}}
|
|
227
|
+
userInfo={systemUserInfo}
|
|
228
|
+
/>
|
|
229
|
+
)}
|
|
203
230
|
<Tooltip title="控制台" className={styles['comp-header__icon']}>
|
|
204
231
|
<FundProjectionScreenOutlined
|
|
205
232
|
style={{ fontSize: '20px', color: 'rgba(0, 0, 0, .85)' }}
|
|
@@ -9,6 +9,7 @@ function getCyWsApiHost() {
|
|
|
9
9
|
case 'localhost:8000':
|
|
10
10
|
case 'localhost:8003':
|
|
11
11
|
case 'localhost:8009':
|
|
12
|
+
case 'localhost:8010':
|
|
12
13
|
case 'testing-task.yeeyoon.com':
|
|
13
14
|
case 'testing-profile.yeeyoon.com':
|
|
14
15
|
case 'demo-task.yeeyoon.com':
|
|
@@ -45,6 +46,7 @@ function getCyMessageApiHost() {
|
|
|
45
46
|
case 'localhost:8000':
|
|
46
47
|
case 'localhost:8003':
|
|
47
48
|
case 'localhost:8009':
|
|
49
|
+
case 'localhost:8010':
|
|
48
50
|
case 'testing-task.yeeyoon.com':
|
|
49
51
|
case 'testing-profile.yeeyoon.com':
|
|
50
52
|
case 'demo-task.yeeyoon.com':
|
|
@@ -97,6 +99,7 @@ export function getEnvVar() {
|
|
|
97
99
|
case 'localhost:8000':
|
|
98
100
|
case 'localhost:8003':
|
|
99
101
|
case 'localhost:8009':
|
|
102
|
+
case 'localhost:8010':
|
|
100
103
|
case 'testing-task.yeeyoon.com':
|
|
101
104
|
case 'testing-profile.yeeyoon.com':
|
|
102
105
|
return 'test';
|
|
@@ -22,16 +22,19 @@ let messageList = [];
|
|
|
22
22
|
let initTotalMsgCount = 0;
|
|
23
23
|
|
|
24
24
|
const RecentNotification = (props) => {
|
|
25
|
-
const { showLabel = true, customStyles = {} } = props;
|
|
25
|
+
const { showLabel = true, customStyles = {}, userInfo = {} } = props;
|
|
26
26
|
const [messageCount, setMessageCount] = useState(0);
|
|
27
27
|
const [msgList, setMsgList] = useState([]);
|
|
28
28
|
const [msgListShow, setMsgListShow] = useState(false);
|
|
29
29
|
|
|
30
30
|
useEffect(async () => {
|
|
31
|
-
const response = await queryLatestMessageList(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const response = await queryLatestMessageList(
|
|
32
|
+
{
|
|
33
|
+
current_page: 1,
|
|
34
|
+
each_page: 5,
|
|
35
|
+
},
|
|
36
|
+
userInfo
|
|
37
|
+
);
|
|
35
38
|
const { data, total_data } = response;
|
|
36
39
|
messageList = data || [];
|
|
37
40
|
setMsgList([...messageList]);
|
|
@@ -176,6 +179,7 @@ const RecentNotification = (props) => {
|
|
|
176
179
|
RecentNotification.propTypes = {
|
|
177
180
|
showLabel: PropTypes.bool,
|
|
178
181
|
customStyles: PropTypes.object,
|
|
182
|
+
userInfo: PropTypes.object,
|
|
179
183
|
};
|
|
180
184
|
|
|
181
185
|
export default RecentNotification;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import request from '../../utils/request';
|
|
2
2
|
import { getApiHost } from './env';
|
|
3
3
|
|
|
4
|
-
export async function queryLatestMessageList(params) {
|
|
5
|
-
|
|
4
|
+
export async function queryLatestMessageList(params, userInfo) {
|
|
5
|
+
let data = {
|
|
6
6
|
prefix: getApiHost(),
|
|
7
7
|
params,
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
|
+
if (userInfo) {
|
|
10
|
+
const { token, userId } = userInfo;
|
|
11
|
+
data.headers = {
|
|
12
|
+
'X-Auth-Token': token,
|
|
13
|
+
'X-Auth-Id': userId,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return request('/v1/notification', data);
|
|
9
17
|
}
|
package/package.json
CHANGED
package/src/pages/index.js
CHANGED