@yeeyoon/library 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.
- package/.umirc.js +6 -1
- package/lib/components/Header/index.jsx +22 -24
- package/lib/components/Header/service.js +5 -5
- package/lib/config/env.js +38 -7
- package/package.json +2 -2
- package/src/pages/index.js +11 -5
package/.umirc.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// ref: https://umijs.org/config/
|
|
3
|
+
const { REACT_APP_ENV } = process.env;
|
|
4
|
+
|
|
3
5
|
export default {
|
|
4
6
|
treeShaking: true,
|
|
5
7
|
routes: [
|
|
@@ -19,7 +21,7 @@ export default {
|
|
|
19
21
|
dynamicImport: false,
|
|
20
22
|
title: 'yeeyoon.library',
|
|
21
23
|
dll: false,
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
routes: {
|
|
24
26
|
exclude: [
|
|
25
27
|
/models\//,
|
|
@@ -31,4 +33,7 @@ export default {
|
|
|
31
33
|
},
|
|
32
34
|
}],
|
|
33
35
|
],
|
|
36
|
+
define: {
|
|
37
|
+
REACT_APP_ENV: REACT_APP_ENV || false,
|
|
38
|
+
},
|
|
34
39
|
}
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
BarsOutlined,
|
|
7
7
|
FundProjectionScreenOutlined,
|
|
8
8
|
UserOutlined,
|
|
9
|
-
MoreOutlined,
|
|
10
9
|
SettingOutlined,
|
|
11
10
|
PoweroffOutlined,
|
|
11
|
+
AppstoreOutlined,
|
|
12
12
|
} from '@ant-design/icons';
|
|
13
13
|
import Notification from '../Notification/recent';
|
|
14
14
|
import ProductListMenu from './components/ProductListMenu/';
|
|
@@ -21,10 +21,13 @@ import {
|
|
|
21
21
|
logout,
|
|
22
22
|
} from './service';
|
|
23
23
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
HOST_OFFICIAL,
|
|
25
|
+
HOST_IAM,
|
|
26
|
+
HOST_PROFILE_TASK,
|
|
27
|
+
HOST_PROFILE_DASH_BOARD,
|
|
28
|
+
HOST_PROFILE_USER,
|
|
29
|
+
HOST_PROFILE_PASSWORD,
|
|
30
|
+
} from '../../config/env';
|
|
28
31
|
|
|
29
32
|
import LogoProfile from './assets/profile.svg';
|
|
30
33
|
import LogoCollab from './assets/collab.svg';
|
|
@@ -50,13 +53,11 @@ const Header = (props) => {
|
|
|
50
53
|
const [redirectUrl, setRedirectUrl] = useState('');
|
|
51
54
|
|
|
52
55
|
const menu = (
|
|
53
|
-
<Menu
|
|
56
|
+
<Menu>
|
|
54
57
|
<Menu.Item
|
|
55
58
|
icon={<UserOutlined />}
|
|
56
59
|
onClick={() => {
|
|
57
|
-
window.location.href = `${
|
|
58
|
-
'user-profile/profile/1'
|
|
59
|
-
)}?token=${token}`;
|
|
60
|
+
window.location.href = `${HOST_PROFILE_USER}?token=${token}`;
|
|
60
61
|
}}
|
|
61
62
|
>
|
|
62
63
|
个人中心
|
|
@@ -64,9 +65,7 @@ const Header = (props) => {
|
|
|
64
65
|
<Menu.Item
|
|
65
66
|
icon={<SettingOutlined />}
|
|
66
67
|
onClick={() => {
|
|
67
|
-
window.location.href = `${
|
|
68
|
-
'user-profile/profile/2'
|
|
69
|
-
)}?token=${token}`;
|
|
68
|
+
window.location.href = `${HOST_PROFILE_PASSWORD}?token=${token}`;
|
|
70
69
|
}}
|
|
71
70
|
>
|
|
72
71
|
修改密码
|
|
@@ -100,7 +99,7 @@ const Header = (props) => {
|
|
|
100
99
|
|
|
101
100
|
const backToIam = () => {
|
|
102
101
|
const { origin, pathname } = window.location;
|
|
103
|
-
window.location.href = `${
|
|
102
|
+
window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
|
|
104
103
|
};
|
|
105
104
|
|
|
106
105
|
const getCySystemToken = async () => {
|
|
@@ -176,8 +175,8 @@ const Header = (props) => {
|
|
|
176
175
|
<div className={styles['comp-header']}>
|
|
177
176
|
<div className={styles['comp-header__left-content']}>
|
|
178
177
|
<Tooltip title="更多产品">
|
|
179
|
-
<
|
|
180
|
-
style={{ fontSize: '
|
|
178
|
+
<AppstoreOutlined
|
|
179
|
+
style={{ fontSize: '28px', cursor: 'pointer' }}
|
|
181
180
|
onClick={() => {
|
|
182
181
|
setProductListMenuDrawerShow(true);
|
|
183
182
|
}}
|
|
@@ -186,7 +185,11 @@ const Header = (props) => {
|
|
|
186
185
|
<span
|
|
187
186
|
className={styles['comp-header__logo']}
|
|
188
187
|
onClick={() => {
|
|
189
|
-
|
|
188
|
+
if (productName === 'profile') {
|
|
189
|
+
window.location.href = HOST_OFFICIAL;
|
|
190
|
+
} else {
|
|
191
|
+
window.location.reload();
|
|
192
|
+
}
|
|
190
193
|
}}
|
|
191
194
|
>
|
|
192
195
|
<img
|
|
@@ -211,10 +214,7 @@ const Header = (props) => {
|
|
|
211
214
|
<BarsOutlined
|
|
212
215
|
style={{ fontSize: '20px', color: 'rgba(0, 0, 0, .85)' }}
|
|
213
216
|
onClick={() => {
|
|
214
|
-
|
|
215
|
-
// 'task-center/home/list'
|
|
216
|
-
// )}?token=${subToken}`;
|
|
217
|
-
setRedirectUrl(getProfileRedirectUrl('task-center/home/list'));
|
|
217
|
+
setRedirectUrl(HOST_PROFILE_TASK);
|
|
218
218
|
setPlatformsModalShow(true);
|
|
219
219
|
}}
|
|
220
220
|
/>
|
|
@@ -233,9 +233,7 @@ const Header = (props) => {
|
|
|
233
233
|
<FundProjectionScreenOutlined
|
|
234
234
|
style={{ fontSize: '20px', color: 'rgba(0, 0, 0, .85)' }}
|
|
235
235
|
onClick={() => {
|
|
236
|
-
window.location.href = `${
|
|
237
|
-
'user-profile'
|
|
238
|
-
)}?token=${token}`;
|
|
236
|
+
window.location.href = `${HOST_PROFILE_DASH_BOARD}?token=${token}`;
|
|
239
237
|
}}
|
|
240
238
|
/>
|
|
241
239
|
</Tooltip>
|
|
@@ -249,7 +247,7 @@ const Header = (props) => {
|
|
|
249
247
|
</Dropdown>
|
|
250
248
|
</>
|
|
251
249
|
)}
|
|
252
|
-
{!userInfo && <a href={
|
|
250
|
+
{!userInfo && <a href={HOST_IAM}>去登录</a>}
|
|
253
251
|
</div>
|
|
254
252
|
</div>
|
|
255
253
|
<Drawer
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import request from '../../utils/request';
|
|
2
|
-
import {
|
|
2
|
+
import { API_IAM } from '../../config/env';
|
|
3
3
|
|
|
4
4
|
// 换子系统token
|
|
5
5
|
export async function fetchSystemToken(params) {
|
|
6
6
|
return request('/getSystemToken', {
|
|
7
|
-
prefix: `${
|
|
7
|
+
prefix: `${API_IAM}/api/oidc/v1/user`,
|
|
8
8
|
method: 'post',
|
|
9
9
|
data: params,
|
|
10
10
|
});
|
|
@@ -13,7 +13,7 @@ export async function fetchSystemToken(params) {
|
|
|
13
13
|
// 获取用户信息
|
|
14
14
|
export async function fetchUserInfo() {
|
|
15
15
|
return request('/findOidcUser', {
|
|
16
|
-
prefix: `${
|
|
16
|
+
prefix: `${API_IAM}/api/oidc/v1/oidcuser`,
|
|
17
17
|
method: 'post',
|
|
18
18
|
data: {},
|
|
19
19
|
});
|
|
@@ -22,7 +22,7 @@ export async function fetchUserInfo() {
|
|
|
22
22
|
// 获取用户产品列表
|
|
23
23
|
export async function fetchProductList(params) {
|
|
24
24
|
return request('/findOidcApplicationList', {
|
|
25
|
-
prefix: `${
|
|
25
|
+
prefix: `${API_IAM}/api/oidc/v1/oidcapplication`,
|
|
26
26
|
method: 'post',
|
|
27
27
|
data: params,
|
|
28
28
|
});
|
|
@@ -31,7 +31,7 @@ export async function fetchProductList(params) {
|
|
|
31
31
|
// 登出
|
|
32
32
|
export async function logout(params) {
|
|
33
33
|
return request('/loginOut', {
|
|
34
|
-
prefix: `${
|
|
34
|
+
prefix: `${API_IAM}/api/oidc/v1/user`,
|
|
35
35
|
method: 'post',
|
|
36
36
|
data: params,
|
|
37
37
|
});
|
package/lib/config/env.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const REACT_APP_ENV = REACT_APP_ENV || 'testing';
|
|
2
|
+
|
|
1
3
|
const envApi = {
|
|
2
4
|
// IAM
|
|
3
5
|
iam: {
|
|
@@ -19,11 +21,15 @@ const envApi = {
|
|
|
19
21
|
zhongtai_xlt: {},
|
|
20
22
|
|
|
21
23
|
// Profile
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
profile_cy: {
|
|
25
|
+
testing: 'testing-api',
|
|
26
|
+
demo: 'demo-api',
|
|
27
|
+
staging: 'staging-api',
|
|
28
|
+
prod: 'api',
|
|
29
|
+
},
|
|
30
|
+
profile_xlt: {
|
|
31
|
+
prod: 'xlt-api',
|
|
32
|
+
},
|
|
27
33
|
|
|
28
34
|
// 协同
|
|
29
35
|
collab: {},
|
|
@@ -59,15 +65,40 @@ function getEnvHost(product, path = '') {
|
|
|
59
65
|
return `${prefix}${REACT_APP_ENV}${product}${suffix}${path}`;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
function getEnvApi(product) {
|
|
68
|
+
function getEnvApi(product, path = '') {
|
|
63
69
|
const env = REACT_APP_ENV === 'dev' ? 'testing' : REACT_APP_ENV;
|
|
64
70
|
const api = envApi[product][env];
|
|
65
|
-
return `https://${api}.yeeyoon.com`;
|
|
71
|
+
return `https://${api}.yeeyoon.com${path}`;
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
// HOST
|
|
69
75
|
export const HOST_OFFICIAL = getEnvHost('official');
|
|
76
|
+
export const HOST_IAM = getEnvHost('iam', '/login');
|
|
77
|
+
export const HOST_COLLAB = getEnvHost('collab');
|
|
78
|
+
export const HOST_BPM = getEnvHost('bpm');
|
|
79
|
+
export const HOST_PROFILE_TASK = getEnvHost(
|
|
80
|
+
'profile',
|
|
81
|
+
'/task-center/home/list'
|
|
82
|
+
);
|
|
83
|
+
export const HOST_PROFILE_DASH_BOARD = getEnvHost(
|
|
84
|
+
'profile',
|
|
85
|
+
'/user-profile/home'
|
|
86
|
+
);
|
|
87
|
+
export const HOST_PROFILE_USER = getEnvHost(
|
|
88
|
+
'profile',
|
|
89
|
+
'/user-profile/profile/1'
|
|
90
|
+
);
|
|
91
|
+
export const HOST_PROFILE_PASSWORD = getEnvHost(
|
|
92
|
+
'profile',
|
|
93
|
+
'/user-profile/profile/2'
|
|
94
|
+
);
|
|
95
|
+
export const HOST_PROFILE_MESSAGE = getEnvHost(
|
|
96
|
+
'profile',
|
|
97
|
+
'/message-center/home/list'
|
|
98
|
+
);
|
|
70
99
|
|
|
71
100
|
// API
|
|
72
101
|
export const API_IAM = getEnvApi('iam');
|
|
73
102
|
export const API_ZHONGTAI_CY = getEnvApi('zhongtai_cy');
|
|
103
|
+
export const API_PROFILE_TASK_CY = getEnvApi('profile_cy', '/task');
|
|
104
|
+
export const API_PROFILE_TASK_XLT = getEnvApi('profile_xlt', '/task');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yeeyoon/library",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "宜云前端组件库和通用服务",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "wangmeng",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"scripts": {
|
|
16
|
-
"start": "umi dev",
|
|
16
|
+
"start": "REACT_APP_ENV=dev umi dev",
|
|
17
17
|
"build": "umi build",
|
|
18
18
|
"test": "umi test",
|
|
19
19
|
"lint": "eslint {src,mock,tests}/**/*.{js,jsx} --fix",
|
package/src/pages/index.js
CHANGED
|
@@ -5,10 +5,16 @@ import Header from '../../lib/components/Header/';
|
|
|
5
5
|
export default function () {
|
|
6
6
|
const [tenantId, setTenantId] = useState('');
|
|
7
7
|
useEffect(() => {
|
|
8
|
-
setTimeout(() => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, 3000);
|
|
8
|
+
// setTimeout(() => {
|
|
9
|
+
// setTenantId('053a033a063711ecb0c00c42a1ff8370');
|
|
10
|
+
// // setTenantId('f12a71b6063611ecb0c00c42a1ff8370');
|
|
11
|
+
// }, 3000);
|
|
12
12
|
}, []);
|
|
13
|
-
return
|
|
13
|
+
return (
|
|
14
|
+
<Header
|
|
15
|
+
productName="collab"
|
|
16
|
+
// tenantId={tenantId}
|
|
17
|
+
token="NjIzOWMwMjhkMTM5NDRlZjliZWIzZWMxNTljOGJhMTU1MjE2MzIzNzM2OTcyMDQ="
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
14
20
|
}
|