@yeeyoon/library 2.9.2 → 2.9.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.
@@ -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
- } else if (item.platforms?.length > 1) {
33
+ return;
34
+ } else if (item.platforms.length > 1) {
31
35
  setPlatModal(true);
32
36
  setPlatforms(item.platforms);
33
- } else if (item.platforms?.length == 1) {
34
- getSystemToken(item.platforms[0]);
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
+ }
@@ -134,6 +134,7 @@ const Header = (props) => {
134
134
  window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
135
135
  };
136
136
 
137
+ // eslint-disable-next-line no-unused-vars
137
138
  const getCySystemToken = async () => {
138
139
  const resp = await fetchSystemToken({
139
140
  platformId: CY_PLATFORM_ID,
@@ -152,9 +153,9 @@ const Header = (props) => {
152
153
  const { platforms, tenants, id, name } = data;
153
154
  ls.set('X-Auth-Username', name);
154
155
  ls.set('X-Auth-Userid', id);
155
- if (platforms.filter((item) => item.id === CY_PLATFORM_ID).length) {
156
- getCySystemToken();
157
- }
156
+ // if (platforms.filter((item) => item.id === CY_PLATFORM_ID).length) {
157
+ // getCySystemToken();
158
+ // }
158
159
  setUserInfo(data);
159
160
  setPlatforms(platforms);
160
161
  setTenants(tenants);
@@ -21,7 +21,7 @@ const TenantSelector = (props) => {
21
21
  const result = tenants.filter((item) => item.id === tenantId);
22
22
  if (result.length) {
23
23
  id = tenantId;
24
- name = result.name;
24
+ name = result[0].name;
25
25
  } else {
26
26
  id = tenants[0].id;
27
27
  name = tenants[0].name;
@@ -41,10 +41,10 @@ const TenantSelector = (props) => {
41
41
  value={currentTenantId}
42
42
  style={{ width: '215px' }}
43
43
  onChange={(value, option) => {
44
- const { name } = option;
44
+ const { children } = option;
45
45
  setCurrentTenantId(value);
46
46
  if (tenantIdChangeCb) {
47
- tenantIdChangeCb(value, name);
47
+ tenantIdChangeCb(value, children);
48
48
  }
49
49
  }}
50
50
  >
package/lib/config/env.js CHANGED
@@ -1,4 +1,4 @@
1
- // const REACT_APP_ENV = REACT_APP_ENV || 'testing';
1
+ // const REACT_APP_ENV = REACT_APP_ENV || 'prod';
2
2
 
3
3
  const envApi = {
4
4
  // IAM
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "2.9.2",
3
+ "version": "2.9.6",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {