@yeeyoon/library 1.8.7 → 1.8.11

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.
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Menu, Image, Modal } from 'antd';
3
3
  import { AppstoreOutlined } from '@ant-design/icons';
4
4
  import PropTypes from 'prop-types';
@@ -6,6 +6,7 @@ import PlatformModal from '../PlatformModal';
6
6
  import { getCollabRedirectUrl } from '../../env';
7
7
  import ls from 'local-storage';
8
8
  import styles from './index.less';
9
+ import { fetchSystemToken } from '../../service';
9
10
 
10
11
  const { SubMenu } = Menu;
11
12
 
@@ -14,39 +15,30 @@ const ProductListMenu = (props) => {
14
15
  const [openKeys] = useState(['sub1', 'sub2']);
15
16
  const [platModal, setPlatModal] = useState(false);
16
17
  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
18
  const enterDetail = (item) => {
37
19
  if (item.code == 200000729) {
38
20
  window.open(`${getCollabRedirectUrl()}?token=${ls.get('X-Auth-Token')}`);
39
- } else {
21
+ } else if (item.platforms?.length > 1) {
40
22
  setPlatModal(true);
41
23
  setPlatforms(item.platforms);
24
+ } else if (item.platforms?.length == 1) {
25
+ getSystemToken(item.platforms[0]);
26
+ }
27
+ };
28
+ const getSystemToken = async (item) => {
29
+ const resp = await fetchSystemToken({ platformId: item.id });
30
+ const { success, data } = resp;
31
+ if (success) {
32
+ const { token, ...rest } = data;
33
+ window.open(`${item.forwardDomainName}?token=${token}&userInfo=${rest}`);
42
34
  }
43
35
  };
44
36
  return (
45
37
  <div className={styles['product-menu']}>
46
38
  <Menu mode="inline" openKeys={openKeys} style={{ width: 256 }}>
47
39
  <SubMenu key="sub1" icon={<AppstoreOutlined />} title="我的产品">
48
- {newProductList.length ? (
49
- newProductList.map((item) => {
40
+ {productList.length ? (
41
+ productList.map((item) => {
50
42
  return (
51
43
  <Menu.Item key={item.code} onClick={() => enterDetail(item)}>
52
44
  <div style={{ display: 'flex', alignItems: 'center' }}>
@@ -69,21 +69,29 @@ export function getProfileRedirectUrl(path) {
69
69
  }
70
70
  }
71
71
 
72
- export function getOfficialSiteRedirectUrl(sysName) {
73
- if (sysName !== 'profile') return;
72
+ export function getOfficialSiteRedirectUrl() {
74
73
  let url;
75
74
  switch (host) {
75
+ case 'localhost:8000':
76
76
  case 'localhost:8003':
77
+ case 'localhost:8009':
78
+ case 'localhost:8010':
77
79
  case 'testing-profile.yeeyoon.com':
80
+ case 'testing-collab.yeeyoon.com':
81
+ case 'testing-bpm.yeeyoon.com':
78
82
  url = `https://testing.yeeyoon.com`;
79
83
  break;
80
84
  case 'demo-profile.yeeyoon.com':
81
85
  url = `https://demonstration.yeeyoon.com`;
82
86
  break;
83
87
  case 'staging-profile.yeeyoon.com':
88
+ case 'staging-collab.yeeyoon.com':
89
+ case 'staging-bpm.yeeyoon.com':
84
90
  url = `https://staging.yeeyoon.com`;
85
91
  break;
86
92
  case 'profile.yeeyoon.com':
93
+ case 'collab.yeeyoon.com':
94
+ case 'bpm.yeeyoon.com':
87
95
  default:
88
96
  url = `https://yeeyoon.com`;
89
97
  break;
@@ -99,9 +99,8 @@ const Header = (props) => {
99
99
  }, [tenantId]);
100
100
 
101
101
  const backToIam = () => {
102
- window.location.href = `${getIamRedirectUrl()}?redirect=${
103
- window.location.origin
104
- }`;
102
+ const { origin, pathname } = window.location;
103
+ window.location.href = `${getIamRedirectUrl()}?redirect=${origin}${pathname}`;
105
104
  };
106
105
 
107
106
  const getCySystemToken = async () => {
@@ -184,25 +183,28 @@ const Header = (props) => {
184
183
  }}
185
184
  />
186
185
  </Tooltip>
187
- <img
188
- src={getSysBrandConfig().logo}
186
+ <span
189
187
  className={styles['comp-header__logo']}
190
- style={{ height: productName !== 'profile' ? '40px' : '32px' }}
191
188
  onClick={() => {
192
189
  getOfficialSiteRedirectUrl();
193
190
  }}
194
- />
195
- {productName !== 'profile' && (
196
- <span
197
- style={{
198
- color: 'rgba(0, 0, 0, .85)',
199
- fontSize: '24px',
200
- marginLeft: '5px',
201
- }}
202
- >
203
- {getSysBrandConfig().name}
204
- </span>
205
- )}
191
+ >
192
+ <img
193
+ src={getSysBrandConfig().logo}
194
+ style={{ height: productName !== 'profile' ? '40px' : '32px' }}
195
+ />
196
+ {productName !== 'profile' && (
197
+ <span
198
+ style={{
199
+ color: 'rgba(0, 0, 0, .85)',
200
+ fontSize: '24px',
201
+ marginLeft: '5px',
202
+ }}
203
+ >
204
+ {getSysBrandConfig().name}
205
+ </span>
206
+ )}
207
+ </span>
206
208
  </div>
207
209
  <div className={styles['comp-header__right-content']}>
208
210
  <Tooltip title="任务中心" className={styles['comp-header__icon']}>
@@ -9,6 +9,9 @@
9
9
  border-radius: 5px;
10
10
  &__logo {
11
11
  margin-left: 10px;
12
+ cursor: pointer;
13
+ display: flex;
14
+ align-items: center;
12
15
  }
13
16
  &__logo__name {
14
17
  font-size: 24px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "1.8.7",
3
+ "version": "1.8.11",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {