@yeeyoon/library 2.9.5 → 2.9.9
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.
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
2
2
|
import { Menu, Image, Modal } from 'antd';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import PlatformModal from '../PlatformModal';
|
5
|
-
import { getCollabRedirectUrl } from '../../env';
|
5
|
+
import { getCollabRedirectUrl, getBpmRedirectUrl } from '../../env';
|
6
6
|
import ls from 'local-storage';
|
7
7
|
import styles from './index.less';
|
8
8
|
import { fetchSystemToken } from '../../service';
|
@@ -15,6 +15,9 @@ const ProductListMenu = (props) => {
|
|
15
15
|
const [openKeys] = useState(['sub1', 'sub2']);
|
16
16
|
const [platModal, setPlatModal] = useState(false);
|
17
17
|
const [platforms, setPlatforms] = useState([]);
|
18
|
+
const [visibleApplet, setVisibleApplet] = useState(false);
|
19
|
+
const [appletSrc, setAppletSrc] = useState('');
|
20
|
+
|
18
21
|
const enterDetail = (item) => {
|
19
22
|
let _link = document.createElement('a');
|
20
23
|
let link = document.body.appendChild(_link);
|
@@ -27,13 +30,35 @@ const ProductListMenu = (props) => {
|
|
27
30
|
)}&tenantId=${tenantId}`
|
28
31
|
);
|
29
32
|
link.click();
|
30
|
-
|
33
|
+
return;
|
34
|
+
} else if (item.platforms.length > 1) {
|
31
35
|
setPlatModal(true);
|
32
36
|
setPlatforms(item.platforms);
|
33
|
-
} else if (item.platforms
|
34
|
-
|
37
|
+
} else if (item.platforms.length == 1) {
|
38
|
+
if (item.code == 200000730 || item.code == 200000731) {
|
39
|
+
openModal(item.platforms[0].forwardDomainName);
|
40
|
+
} else {
|
41
|
+
if (item.code == 200000729 || item.code == 200000728) {
|
42
|
+
let url = '';
|
43
|
+
if (item.code == 200000729) url = getCollabRedirectUrl();
|
44
|
+
if (item.code == 200000728) url = getBpmRedirectUrl();
|
45
|
+
link.setAttribute(
|
46
|
+
'href',
|
47
|
+
`${url}?token=${ls.get('X-Auth-Token')}&tenantId=${tenantId}`
|
48
|
+
);
|
49
|
+
link.click();
|
50
|
+
} else {
|
51
|
+
getSystemToken(item.platforms[0]);
|
52
|
+
}
|
53
|
+
}
|
35
54
|
}
|
36
55
|
};
|
56
|
+
const openModal = (src) => {
|
57
|
+
setAppletSrc(src);
|
58
|
+
setTimeout(() => {
|
59
|
+
setVisibleApplet(true);
|
60
|
+
}, 300);
|
61
|
+
};
|
37
62
|
const getSystemToken = async (item) => {
|
38
63
|
const resp = await fetchSystemToken({ platformId: item.id });
|
39
64
|
const { success, data } = resp;
|
@@ -122,6 +147,17 @@ const ProductListMenu = (props) => {
|
|
122
147
|
>
|
123
148
|
<PlatformModal platforms={platforms} tenantId={tenantId} />
|
124
149
|
</Modal>
|
150
|
+
{/* 点击小程序弹框 */}
|
151
|
+
<Modal
|
152
|
+
visible={visibleApplet}
|
153
|
+
onCancel={() => setVisibleApplet(false)}
|
154
|
+
centered
|
155
|
+
footer={null}
|
156
|
+
maskClosable={false}
|
157
|
+
width="auto"
|
158
|
+
>
|
159
|
+
<Image preview={false} src={appletSrc} />
|
160
|
+
</Modal>
|
125
161
|
</div>
|
126
162
|
);
|
127
163
|
};
|
@@ -112,3 +112,17 @@ export function getCollabRedirectUrl() {
|
|
112
112
|
return 'https://collab.yeeyoon.com';
|
113
113
|
}
|
114
114
|
}
|
115
|
+
|
116
|
+
export function getBpmRedirectUrl() {
|
117
|
+
switch (host) {
|
118
|
+
case 'localhost:8003':
|
119
|
+
case 'localhost:8000':
|
120
|
+
case 'testing-profile.yeeyoon.com':
|
121
|
+
return 'https://testing-bpm.yeeyoon.com';
|
122
|
+
case 'staging-profile.yeeyoon.com':
|
123
|
+
return 'https://staging-bpm.yeeyoon.com';
|
124
|
+
case 'profile.yeeyoon.com':
|
125
|
+
default:
|
126
|
+
return 'https://bpm.yeeyoon.com';
|
127
|
+
}
|
128
|
+
}
|
@@ -163,11 +163,11 @@ const Header = (props) => {
|
|
163
163
|
setAvatarProps({ src: data.headUrl || DEFAULT_AVATAR_URL });
|
164
164
|
currentProduct = tenants[0].applications || [];
|
165
165
|
getProductList(id);
|
166
|
-
} else {
|
166
|
+
} /*else {
|
167
167
|
setTimeout(() => {
|
168
168
|
backToIam();
|
169
169
|
}, 4500);
|
170
|
-
}
|
170
|
+
}*/
|
171
171
|
};
|
172
172
|
|
173
173
|
const getProductList = async (userId) => {
|
package/lib/config/env.js
CHANGED
package/lib/utils/request.js
CHANGED
@@ -4,6 +4,8 @@ import qs from 'qs';
|
|
4
4
|
import ls from 'local-storage';
|
5
5
|
import { notification } from 'antd';
|
6
6
|
|
7
|
+
import { HOST_IAM } from '../config/env';
|
8
|
+
|
7
9
|
const TOKEN_KEY = 'X-Auth-Token';
|
8
10
|
const ID_KEY = 'X-Auth-Id';
|
9
11
|
const REST_KEY = 'Login-Rest-Info';
|
@@ -40,6 +42,11 @@ rest && ls.set(REST_KEY, JSON.stringify(rest));
|
|
40
42
|
// };
|
41
43
|
/** 异常处理程序 */
|
42
44
|
|
45
|
+
const backToIam = () => {
|
46
|
+
const { origin, pathname } = window.location;
|
47
|
+
window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
|
48
|
+
};
|
49
|
+
|
43
50
|
const errorHandler = (error) => {
|
44
51
|
const { response } = error;
|
45
52
|
|
@@ -78,7 +85,10 @@ request.interceptors.response.use(async (response) => {
|
|
78
85
|
if (code !== 200 && code !== 201 && !success) {
|
79
86
|
m !== '操作过于频繁' &&
|
80
87
|
m.indexOf('存在重复的物资') < 0 &&
|
81
|
-
notification.error({
|
88
|
+
notification.error({
|
89
|
+
message: m,
|
90
|
+
maxCount: 1,
|
91
|
+
});
|
82
92
|
if (
|
83
93
|
code === 401 ||
|
84
94
|
code === 402 ||
|
@@ -86,6 +96,7 @@ request.interceptors.response.use(async (response) => {
|
|
86
96
|
m === 'token不一致'
|
87
97
|
) {
|
88
98
|
window.top.postMessage('tcTokenExpired', '*'); // 通知宿主窗口
|
99
|
+
backToIam();
|
89
100
|
}
|
90
101
|
return resp;
|
91
102
|
} else if (success && (!code || code === 200)) {
|