@yeeyoon/library 2.9.9 → 3.0.4

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.
@@ -22,16 +22,7 @@ const ProductListMenu = (props) => {
22
22
  let _link = document.createElement('a');
23
23
  let link = document.body.appendChild(_link);
24
24
  link.setAttribute('target', '_blank');
25
- if (item.code == 200000729) {
26
- link.setAttribute(
27
- 'href',
28
- `${getCollabRedirectUrl()}?token=${ls.get(
29
- 'X-Auth-Token'
30
- )}&tenantId=${tenantId}`
31
- );
32
- link.click();
33
- return;
34
- } else if (item.platforms.length > 1) {
25
+ if (item.platforms.length > 1) {
35
26
  setPlatModal(true);
36
27
  setPlatforms(item.platforms);
37
28
  } else if (item.platforms.length == 1) {
@@ -60,6 +60,7 @@ const Header = (props) => {
60
60
  avatar,
61
61
  userName,
62
62
  slot = <></>,
63
+ handleException,
63
64
  } = props;
64
65
  const [platforms, setPlatforms] = useState([]);
65
66
  const [userInfo, setUserInfo] = useState(null);
@@ -151,6 +152,11 @@ const Header = (props) => {
151
152
  const { success, data } = resp;
152
153
  if (success) {
153
154
  const { platforms, tenants, id, name } = data;
155
+ if (!platforms.length || !tenants.length) {
156
+ handleException && handleException();
157
+ return;
158
+ }
159
+
154
160
  ls.set('X-Auth-Username', name);
155
161
  ls.set('X-Auth-Userid', id);
156
162
  // if (platforms.filter((item) => item.id === CY_PLATFORM_ID).length) {
@@ -162,6 +168,10 @@ const Header = (props) => {
162
168
  setUserId(id);
163
169
  setAvatarProps({ src: data.headUrl || DEFAULT_AVATAR_URL });
164
170
  currentProduct = tenants[0].applications || [];
171
+ if (!currentProduct.filter((item) => item.code === 200000728).length) {
172
+ handleException && handleException();
173
+ return;
174
+ }
165
175
  getProductList(id);
166
176
  } /*else {
167
177
  setTimeout(() => {
@@ -339,6 +349,7 @@ Header.propTypes = {
339
349
  avatar: PropTypes.string,
340
350
  userName: PropTypes.string,
341
351
  slot: PropTypes.node,
352
+ handleException: PropTypes.func,
342
353
  };
343
354
 
344
355
  export default Header;
@@ -96,7 +96,9 @@ request.interceptors.response.use(async (response) => {
96
96
  m === 'token不一致'
97
97
  ) {
98
98
  window.top.postMessage('tcTokenExpired', '*'); // 通知宿主窗口
99
- backToIam();
99
+ setTimeout(() => {
100
+ backToIam();
101
+ }, 1000);
100
102
  }
101
103
  return resp;
102
104
  } else if (success && (!code || code === 200)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "2.9.9",
3
+ "version": "3.0.4",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -1,27 +1,7 @@
1
- import React, { useEffect } from 'react';
2
- import { notification } from 'antd';
1
+ import React from 'react';
3
2
  import Header from '../../lib/components/Header/';
4
- import TenantSelector from '../../lib/components/TenantSelector/';
5
- import CustomDefaultFooter from '../../lib/components/DefaultFooter/';
6
- import PageLoading from '../../lib/components/PageLoading/';
7
- // import ModifyPassword from '../../lib/components/ModifyPassword/';
8
3
 
9
4
  // eslint-disable-next-line react/display-name
10
5
  export default function () {
11
- useEffect(() => {
12
- notification.config({ maxCount: 1 });
13
- notification.error({ message: '测试信息' });
14
- }, []);
15
- return (
16
- <>
17
- <Header productName="profile" slot={<div>nasa</div>} />
18
- {/* <TenantSelector
19
- tenantId="14bfb5d71d1011eca9820c42a1f6bf88"
20
- tenantIdChangeCb={(id) => console.log(id)}
21
- /> */}
22
- {/* <CustomDefaultFooter /> */}
23
- {/* <PageLoading /> */}
24
- {/* {<ModifyPassword />} */}
25
- </>
26
- );
6
+ return <Header productName="bpm" slot={<div>nasa</div>} />;
27
7
  }