@yeeyoon/library 3.6.3 → 3.6.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.
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import ls from 'local-storage';
3
+ import PropTypes from 'prop-types';
4
+ import styles from './styles.less';
5
+
6
+ const NewVersion = (props) => {
7
+ const { onClose, data, toVersionCenter } = props;
8
+
9
+ const handleToVersionCenter = () => {
10
+ ls.set('Yyun-Version', data.version);
11
+ toVersionCenter();
12
+ onClose();
13
+ };
14
+
15
+ return (
16
+ <div className={styles.container}>
17
+ <img
18
+ alt="rocket"
19
+ className={styles.rocket}
20
+ src="https://prod-yeeyoon-oss.oss-cn-zhangjiakou.aliyuncs.com/newbie/version-rocket.png"
21
+ />
22
+ <div className={styles.title}>{data.title}</div>
23
+ <div className={styles.mark}>{data.mark}</div>
24
+ <div className={styles.footer}>
25
+ 更多功能更新,请前往
26
+ <a onClick={() => handleToVersionCenter()}>版本中心</a>
27
+ 查看
28
+ </div>
29
+ </div>
30
+ );
31
+ };
32
+
33
+ NewVersion.propTypes = {
34
+ data: PropTypes.object,
35
+ onClose: PropTypes.func,
36
+ toVersionCenter: PropTypes.func,
37
+ };
38
+
39
+ export default NewVersion;
@@ -0,0 +1,44 @@
1
+ .container {
2
+ padding: 32px 50px 24px;
3
+ text-align: center;
4
+ }
5
+
6
+ .rocket {
7
+ width: 170px;
8
+ height: 170px;
9
+ }
10
+
11
+ .title {
12
+ margin-top: 32px;
13
+ font-weight: 500;
14
+ font-size: 15px;
15
+ line-height: 24px;
16
+ color: #4b4b4b;
17
+ }
18
+
19
+ .mark {
20
+ margin-top: 16px;
21
+ white-space: pre-line;
22
+ font-weight: 400;
23
+ font-size: 14px;
24
+ line-height: 21px;
25
+ text-align: left;
26
+ color: #6e6b7b;
27
+ }
28
+
29
+ .footer {
30
+ margin-top: 56px;
31
+ font-weight: 400;
32
+ font-size: 14px;
33
+ line-height: 14px;
34
+ text-align: center;
35
+ color: #b9b9c3;
36
+ }
37
+
38
+ .modal {
39
+ :global {
40
+ .ant-modal-content {
41
+ border-radius: 6px;
42
+ }
43
+ }
44
+ }
@@ -11,6 +11,7 @@ import {
11
11
  // import Notification from '../Notification/recent';
12
12
  import ProductListMenu from './components/ProductListMenu/';
13
13
  import PlatformModal from './components/PlatformModal/';
14
+ import { openVersionModal } from './utils';
14
15
 
15
16
  import {
16
17
  IconTodo,
@@ -18,6 +19,7 @@ import {
18
19
  IconMore,
19
20
  IconQunZuGuanLi,
20
21
  IconVersion,
22
+ IconNew,
21
23
  } from '../Icons/';
22
24
 
23
25
  import {
@@ -44,6 +46,7 @@ import LogoBpm from './assets/bpm.svg';
44
46
  import LogoWms from './assets/mms.svg';
45
47
 
46
48
  import styles from './index.less';
49
+ import { getVersionData } from './utils';
47
50
 
48
51
  let currentProduct = [];
49
52
  let allProduct = [];
@@ -83,6 +86,7 @@ const Header = (props) => {
83
86
  const [platformsModalShow, setPlatformsModalShow] = useState(false);
84
87
  const [avatarProps, setAvatarProps] = useState({});
85
88
  const [redirectUrl, setRedirectUrl] = useState('');
89
+ const [hasNewVersion, setHasNewVersion] = useState(false);
86
90
 
87
91
  const menu = (
88
92
  <Menu>
@@ -121,8 +125,17 @@ const Header = (props) => {
121
125
  </Menu>
122
126
  );
123
127
 
124
- useEffect(() => {
128
+ useEffect(async () => {
125
129
  getUserInfo();
130
+ const [hasNew, newData] = await getVersionData(productName);
131
+ setHasNewVersion(hasNew);
132
+ if (hasNew) {
133
+ openVersionModal({
134
+ data: newData,
135
+ setHasNewVersion,
136
+ toVersionCenter,
137
+ });
138
+ }
126
139
  }, []);
127
140
 
128
141
  useEffect(() => {
@@ -241,6 +254,20 @@ const Header = (props) => {
241
254
  }
242
255
  };
243
256
 
257
+ const toVersionCenter = () => {
258
+ setHasNewVersion(false);
259
+ let system = '';
260
+ switch (productName) {
261
+ case 'bpm':
262
+ system = 'bpm';
263
+ break;
264
+ case 'wms':
265
+ system = 'wms';
266
+ break;
267
+ }
268
+ window.location.href = `${HOST_OFFICIAL}/version?system=${system}&token=${token}`;
269
+ };
270
+
244
271
  return (
245
272
  <div className={styles['comp-header-wrapper']}>
246
273
  <div className={styles['comp-header']}>
@@ -311,21 +338,17 @@ const Header = (props) => {
311
338
  productName === 'profile') && (
312
339
  <span
313
340
  className={styles['comp-header__icon']}
314
- onClick={() => {
315
- let system = '';
316
- switch (productName) {
317
- case 'bpm':
318
- system = 'bpm';
319
- break;
320
- case 'wms':
321
- system = 'wms';
322
- break;
323
- }
324
- window.location.href = `${HOST_OFFICIAL}/version?system=${system}&token=${token}`;
325
- }}
341
+ onClick={() => toVersionCenter()}
326
342
  >
327
343
  <IconVersion style={IconStyle} />
328
- 版本中心
344
+ <div className={styles['comp-header__badge']}>
345
+ 版本中心
346
+ {hasNewVersion && (
347
+ <div className={styles['comp-header__new']}>
348
+ <IconNew />
349
+ </div>
350
+ )}
351
+ </div>
329
352
  </span>
330
353
  )}
331
354
  {/* {systemUserInfo && (
@@ -20,7 +20,7 @@
20
20
  &__logo__name {
21
21
  font-size: 24px;
22
22
  margin-left: 5px;
23
- color: rgba(0, 0, 0, .85);
23
+ color: rgba(0, 0, 0, 0.85);
24
24
  }
25
25
 
26
26
  &__icon {
@@ -42,14 +42,14 @@
42
42
  margin-right: 18px;
43
43
  }
44
44
  a {
45
- color: rgba(0, 0, 0, .85);
45
+ color: rgba(0, 0, 0, 0.85);
46
46
  &:hover {
47
47
  color: #3ed09c;
48
48
  }
49
49
  }
50
50
  :global {
51
51
  .ant-divider-vertical {
52
- border-color: rgba(0, 0, 0, .85);
52
+ border-color: rgba(0, 0, 0, 0.85);
53
53
  height: 1em;
54
54
  margin: 0 22px 0 12px;
55
55
  }
@@ -58,5 +58,17 @@
58
58
  &__slot {
59
59
  margin-left: 25px;
60
60
  }
61
+
62
+ &__badge {
63
+ position: relative;
64
+ }
65
+
66
+ &__new {
67
+ width: 21px;
68
+ height: 10.5px;
69
+ position: absolute;
70
+ right: -21px;
71
+ top: -6px;
72
+ }
61
73
  }
62
74
  }
@@ -0,0 +1,59 @@
1
+ /*
2
+ * @Author: Erlin
3
+ * @Date: 2022-06-24 11:33:21
4
+ * @LastEditors: Erlin
5
+ * @LastEditTime: 2022-06-24 17:34:39
6
+ * @Description:
7
+ */
8
+ import React from 'react';
9
+ import { Modal } from 'antd';
10
+ import lodash from 'lodash';
11
+ import ls from 'local-storage';
12
+ import request from '.././../utils/request';
13
+ import NewVersion from './components/NewVersion';
14
+ import styles from './components/NewVersion/styles.less';
15
+
16
+ export const openVersionModal = async (props) => {
17
+ const { data, setHasNewVersion, toVersionCenter, ...reset } = props;
18
+ const modal = Modal.warning({
19
+ centered: true,
20
+ width: 400,
21
+ title: null,
22
+ icon: null,
23
+ closable: true,
24
+ keyboard: false,
25
+ maskClosable: false,
26
+ okButtonProps: { style: { display: 'none' } },
27
+ bodyStyle: { padding: 0 },
28
+ className: styles.modal,
29
+ content: (
30
+ <NewVersion
31
+ modal={modal}
32
+ data={data}
33
+ toVersionCenter={toVersionCenter}
34
+ onClose={() => modal.destroy()}
35
+ />
36
+ ),
37
+ onCancel: () => {
38
+ setHasNewVersion(false);
39
+ ls.set('Yyun-Version', data.version);
40
+ },
41
+ ...reset,
42
+ });
43
+ };
44
+
45
+ export const getVersionData = async (productName) => {
46
+ const systems = ['bpm', 'wms', 'bee'];
47
+ if (systems.indexOf(productName) > -1) {
48
+ const oldData = ls.get('Yyun-Version');
49
+ const res = await request(
50
+ 'https://prod-yeeyoon-oss.oss-cn-zhangjiakou.aliyuncs.com/newbie/version-center.json',
51
+ { prefix: '' }
52
+ );
53
+ const items = lodash.find(res, (item) => item.key == productName);
54
+ const newData = items?.content?.[0] || {};
55
+ const hasNew = oldData !== newData?.version;
56
+ return [hasNew, newData];
57
+ }
58
+ return [false, {}];
59
+ };
@@ -38,6 +38,22 @@ const IconQunZuGuanLi = (args) => {
38
38
  const IconVersion = (args) => {
39
39
  return <Icons type="icon-tag" {...args} />;
40
40
  };
41
+ const IconNew = () => {
42
+ return (
43
+ <svg
44
+ width="21"
45
+ height="11"
46
+ viewBox="0 0 21 11"
47
+ fill="none"
48
+ xmlns="http://www.w3.org/2000/svg"
49
+ >
50
+ <path
51
+ d="M19.0908 0.25H1.90908C0.859068 0.25 0 1.10914 0 2.15912V8.8409C0 9.89091 0.859068 10.75 1.90908 10.75H19.0908C20.1409 10.75 21 9.89091 21 8.8409V2.15912C21 1.10914 20.1409 0.25 19.0908 0.25ZM6.68181 7.40909C6.68181 7.60941 6.54817 7.79092 6.35726 7.85789C6.30969 7.87704 6.25243 7.88641 6.20453 7.88641C6.06152 7.88641 5.9182 7.80999 5.82271 7.68609L3.81817 5.03247V7.40913C3.81817 7.66705 3.60814 7.88645 3.34089 7.88645C3.07363 7.88645 2.86365 7.66705 2.86365 7.40913V3.61004C2.86365 3.40979 2.99729 3.22829 3.1882 3.16124C3.38882 3.09457 3.59881 3.16124 3.72275 3.33312C4.39094 4.21459 5.0591 5.09614 5.72729 5.97733V3.61004C5.72729 3.35249 5.93728 3.14217 6.20457 3.14217C6.47186 3.14217 6.68185 3.35249 6.68185 3.61004L6.68181 7.40909ZM10.0227 5.0228C10.29 5.0228 10.5 5.23275 10.5 5.50005C10.5 5.76734 10.29 5.97729 10.0227 5.97729H8.5909V6.93185H10.0227C10.29 6.93185 10.5 7.14187 10.5 7.40913C10.5 7.67642 10.29 7.88645 10.0227 7.88645H8.11362C7.84636 7.88645 7.63634 7.67642 7.63634 7.40913V3.59096C7.63634 3.32371 7.84633 3.11372 8.11362 3.11372H10.0227C10.29 3.11372 10.5 3.32367 10.5 3.59096C10.5 3.85825 10.29 4.06824 10.0227 4.06824H8.5909V5.02284L10.0227 5.0228ZM17.9836 3.7152C17.5126 4.96243 17.0417 6.20971 16.5709 7.45702C16.5379 7.54689 16.4781 7.62443 16.3996 7.67909C16.321 7.73374 16.2275 7.76286 16.1318 7.76247C15.9409 7.76247 15.7597 7.63823 15.6927 7.45702C15.3682 6.59796 15.0436 5.73882 14.7191 4.87945C14.3945 5.73885 14.07 6.59796 13.7455 7.45702C13.6118 7.81974 13.0009 7.81974 12.8673 7.45702C12.3965 6.20971 11.9256 4.96243 11.4545 3.7152C11.3688 3.47639 11.4833 3.2091 11.7315 3.11368C11.9797 3.01823 12.247 3.14213 12.3327 3.39031C12.6572 4.24971 12.9818 5.10881 13.3064 5.96792C13.6309 5.10873 13.9555 4.24953 14.28 3.39031C14.4136 3.0276 15.0245 3.0276 15.1581 3.39031C15.4827 4.24971 15.8073 5.10881 16.1318 5.96792C16.4563 5.10881 16.7809 4.24971 17.1054 3.39031C17.1915 3.14213 17.4681 3.0276 17.7069 3.11368C17.9551 3.19973 18.0791 3.46702 17.9836 3.7152Z"
52
+ fill="#EA5455"
53
+ />
54
+ </svg>
55
+ );
56
+ };
41
57
 
42
58
  export {
43
59
  IconBell,
@@ -49,4 +65,5 @@ export {
49
65
  IconTuijianchanpin,
50
66
  IconQunZuGuanLi,
51
67
  IconVersion,
68
+ IconNew,
52
69
  };
@@ -28,7 +28,7 @@ const TenantSelector = (props) => {
28
28
  if (appId) {
29
29
  tenants = tenants.filter((item) => {
30
30
  const { applications } = item;
31
- return applications.filter((item) => item.id === appId).length;
31
+ return applications?.filter((item) => item.id === appId).length;
32
32
  });
33
33
  }
34
34
  if (!tenants.length) {
package/lib/config/env.js CHANGED
@@ -1,4 +1,4 @@
1
- // const REACT_APP_ENV = REACT_APP_ENV || 'prod';
1
+ // const REACT_APP_ENV = REACT_APP_ENV || 'dev';
2
2
 
3
3
  const envApi = {
4
4
  // IAM