@yeeyoon/library 1.9.8 → 2.0.1

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.
@@ -3,29 +3,38 @@ import PropTypes from 'prop-types';
3
3
  import { Card, Button, message, Image, Row, Col } from 'antd';
4
4
 
5
5
  import { fetchSystemToken } from '../../service';
6
+ import ls from 'local-storage';
6
7
 
7
8
  const PlatformModal = (props) => {
8
9
  const { platforms, redirectUrl } = props;
9
- const enterProductDetail = (token, userInfo, plat) => {
10
- if (redirectUrl) {
11
- window.open(`${redirectUrl}?token=${token}&userId=${userInfo.userId}`);
12
- } else if (plat.forwardDomainName) {
10
+ const enterProductDetail = (plat) => {
11
+ if (plat.code == '20210811003') {
13
12
  window.open(
14
- `${plat.forwardDomainName}?token=${token}&userInfo=${JSON.stringify(
15
- userInfo
16
- )}`
13
+ `${plat.forwardDomainName}?token=${ls.get(
14
+ 'X-Auth-Token'
15
+ )}&userId=${ls.get('X-Auth-Id')}`
17
16
  );
18
17
  } else {
19
- message.error('该系统尚未开发,敬请期待');
20
- return;
18
+ getSystemToken(plat);
21
19
  }
22
20
  };
23
- const getSystemToken = async (item) => {
24
- const resp = await fetchSystemToken({ platformId: item.id });
21
+ const getSystemToken = async (plat) => {
22
+ const resp = await fetchSystemToken({ platformId: plat.id });
25
23
  const { success, data } = resp;
26
24
  if (success) {
27
25
  const { token, ...rest } = data;
28
- enterProductDetail(token, rest, item);
26
+ if (redirectUrl) {
27
+ window.open(`${redirectUrl}?token=${token}&userId=${rest.userId}`);
28
+ } else if (plat.forwardDomainName) {
29
+ window.open(
30
+ `${plat.forwardDomainName}?token=${token}&userInfo=${JSON.stringify(
31
+ rest
32
+ )}`
33
+ );
34
+ } else {
35
+ message.error('该系统尚未开发,敬请期待');
36
+ return;
37
+ }
29
38
  }
30
39
  };
31
40
  return (
@@ -44,7 +53,7 @@ const PlatformModal = (props) => {
44
53
  >
45
54
  <Image src={item.icon} preview={false} />
46
55
  <Button
47
- onClick={() => getSystemToken(item)}
56
+ onClick={() => enterProductDetail(item)}
48
57
  style={{ marginTop: '15px' }}
49
58
  >
50
59
  开始使用
@@ -276,7 +276,16 @@ const Header = (props) => {
276
276
  setPlatformsModalShow(false);
277
277
  }}
278
278
  >
279
- <PlatformModal platforms={platforms} redirectUrl={redirectUrl} />
279
+ <PlatformModal
280
+ platforms={platforms.filter((item) => {
281
+ const { id } = item;
282
+ return (
283
+ id !== '225ea3ae063711ecb0c00c42a1ff8370' &&
284
+ id !== '14205a67063711ecb0c00c42a1ff8370'
285
+ );
286
+ })}
287
+ redirectUrl={redirectUrl}
288
+ />
280
289
  </Modal>
281
290
  </>
282
291
  );
package/lib/config/env.js CHANGED
@@ -60,6 +60,7 @@ export function getEnvHost(product, env, path = '') {
60
60
  }
61
61
 
62
62
  export function getEnvApi(product, env) {
63
+ env = env === 'dev' ? 'testing' : env;
63
64
  const api = envApi[product][env];
64
65
  return `https://${api}.yeeyoon.com`;
65
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "1.9.8",
3
+ "version": "2.0.1",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {