@yeeyoon/library 3.6.2 → 3.6.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,37 @@
1
+ .container {
2
+ padding: 40px 125px;
3
+ text-align: center;
4
+ min-height: 440px;
5
+ }
6
+
7
+ .rocket {
8
+ width: 170px;
9
+ height: 170px;
10
+ }
11
+
12
+ .title {
13
+ margin-top: 32px;
14
+ font-weight: 500;
15
+ font-size: 15px;
16
+ line-height: 24px;
17
+ color: #4b4b4b;
18
+ }
19
+
20
+ .mark {
21
+ margin-top: 16px;
22
+ white-space: pre-line;
23
+ font-weight: 400;
24
+ font-size: 14px;
25
+ line-height: 21px;
26
+ text-align: center;
27
+ color: #6e6b7b;
28
+ }
29
+
30
+ .footer {
31
+ margin-top: 32px;
32
+ font-weight: 400;
33
+ font-size: 14px;
34
+ line-height: 14px;
35
+ text-align: center;
36
+ color: #b9b9c3;
37
+ }
@@ -2,7 +2,16 @@ import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import _xorBy from 'lodash/xorBy';
4
4
  import ls from 'local-storage';
5
- import { Menu, Dropdown, Tooltip, Avatar, Drawer, Modal, Divider } from 'antd';
5
+ import {
6
+ Menu,
7
+ Dropdown,
8
+ Tooltip,
9
+ Avatar,
10
+ Drawer,
11
+ Modal,
12
+ Divider,
13
+ Badge,
14
+ } from 'antd';
6
15
  import {
7
16
  UserOutlined,
8
17
  SettingOutlined,
@@ -11,6 +20,7 @@ import {
11
20
  // import Notification from '../Notification/recent';
12
21
  import ProductListMenu from './components/ProductListMenu/';
13
22
  import PlatformModal from './components/PlatformModal/';
23
+ import { openVersionModal } from './utils';
14
24
 
15
25
  import {
16
26
  IconTodo,
@@ -44,6 +54,7 @@ import LogoBpm from './assets/bpm.svg';
44
54
  import LogoWms from './assets/mms.svg';
45
55
 
46
56
  import styles from './index.less';
57
+ import { getVersionData } from './utils';
47
58
 
48
59
  let currentProduct = [];
49
60
  let allProduct = [];
@@ -83,6 +94,7 @@ const Header = (props) => {
83
94
  const [platformsModalShow, setPlatformsModalShow] = useState(false);
84
95
  const [avatarProps, setAvatarProps] = useState({});
85
96
  const [redirectUrl, setRedirectUrl] = useState('');
97
+ const [hasNewVersion, setHasNewVersion] = useState(false);
86
98
 
87
99
  const menu = (
88
100
  <Menu>
@@ -121,8 +133,20 @@ const Header = (props) => {
121
133
  </Menu>
122
134
  );
123
135
 
124
- useEffect(() => {
136
+ useEffect(async () => {
125
137
  getUserInfo();
138
+ const [hasNew, newData] = await getVersionData(productName);
139
+
140
+ setHasNewVersion(hasNew);
141
+ if (hasNew) {
142
+ openVersionModal({
143
+ centered: true,
144
+ width: 510,
145
+ data: newData,
146
+ setHasNewVersion,
147
+ toVersionCenter,
148
+ });
149
+ }
126
150
  }, []);
127
151
 
128
152
  useEffect(() => {
@@ -241,6 +265,20 @@ const Header = (props) => {
241
265
  }
242
266
  };
243
267
 
268
+ const toVersionCenter = () => {
269
+ setHasNewVersion(false);
270
+ let system = '';
271
+ switch (productName) {
272
+ case 'bpm':
273
+ system = 'bpm';
274
+ break;
275
+ case 'wms':
276
+ system = 'wms';
277
+ break;
278
+ }
279
+ window.location.href = `${HOST_OFFICIAL}/version?system=${system}&token=${token}`;
280
+ };
281
+
244
282
  return (
245
283
  <div className={styles['comp-header-wrapper']}>
246
284
  <div className={styles['comp-header']}>
@@ -311,21 +349,15 @@ const Header = (props) => {
311
349
  productName === 'profile') && (
312
350
  <span
313
351
  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
- }}
352
+ onClick={() => toVersionCenter()}
326
353
  >
327
- <IconVersion style={IconStyle} />
328
- 版本中心
354
+ <Badge
355
+ className={styles['comp-header__badge']}
356
+ count={hasNewVersion ? 'new' : null}
357
+ >
358
+ <IconVersion style={IconStyle} />
359
+ 版本中心
360
+ </Badge>
329
361
  </span>
330
362
  )}
331
363
  {/* {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,15 @@
58
58
  &__slot {
59
59
  margin-left: 25px;
60
60
  }
61
+
62
+ &__badge {
63
+ :global {
64
+ .ant-badge-count {
65
+ color: #ff4d4f;
66
+ background: transparent;
67
+ box-shadow: none;
68
+ }
69
+ }
70
+ }
61
71
  }
62
72
  }
@@ -0,0 +1,56 @@
1
+ /*
2
+ * @Author: Erlin
3
+ * @Date: 2022-06-24 11:33:21
4
+ * @LastEditors: Erlin
5
+ * @LastEditTime: 2022-06-24 13:37:54
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
+
15
+ export const openVersionModal = async (props) => {
16
+ const { width, data, setHasNewVersion, toVersionCenter, ...reset } = props;
17
+ const modal = Modal.warning({
18
+ title: null,
19
+ icon: null,
20
+ closable: true,
21
+ keyboard: false,
22
+ maskClosable: false,
23
+ width: width,
24
+ okButtonProps: { style: { display: 'none' } },
25
+ bodyStyle: { padding: 0 },
26
+ content: (
27
+ <NewVersion
28
+ modal={modal}
29
+ data={data}
30
+ toVersionCenter={toVersionCenter}
31
+ onClose={() => modal.destroy()}
32
+ />
33
+ ),
34
+ onCancel: () => {
35
+ setHasNewVersion(false);
36
+ ls.set('Yyun-Version', data.version);
37
+ },
38
+ ...reset,
39
+ });
40
+ };
41
+
42
+ export const getVersionData = async (productName) => {
43
+ const systems = ['bpm', 'wms', 'bee'];
44
+ if (systems.indexOf(productName) > -1) {
45
+ const oldData = ls.get('Yyun-Version');
46
+ const res = await request(
47
+ 'https://prod-yeeyoon-oss.oss-cn-zhangjiakou.aliyuncs.com/formily/bpm/officialweb/common/default/default/officialweb-officialweb@v0.0.1.json',
48
+ { prefix: '' }
49
+ );
50
+ const items = lodash.find(res, (item) => item.key == productName);
51
+ const newData = items?.content?.[0] || {};
52
+ const hasNew = oldData !== newData?.version;
53
+ return [hasNew, newData];
54
+ }
55
+ return [false, {}];
56
+ };
@@ -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) {
@@ -43,11 +43,14 @@ const TenantSelector = (props) => {
43
43
  id = tenants[0].id;
44
44
  name = tenants[0].name;
45
45
  }
46
- if (!isSharePlatform) {
47
- tenants = tenants.filter(
48
- (item) => !shareTenantIdList.includes(item.id)
49
- );
50
- } else {
46
+ // if (!isSharePlatform) {
47
+ // tenants = tenants.filter(
48
+ // (item) => !shareTenantIdList.includes(item.id)
49
+ // );
50
+ // } else {
51
+ // tenants = tenants.filter((item) => shareTenantIdList.includes(item.id));
52
+ // }
53
+ if (isSharePlatform) {
51
54
  tenants = tenants.filter((item) => shareTenantIdList.includes(item.id));
52
55
  }
53
56
  setTenantList(tenants);
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "3.6.2",
3
+ "version": "3.6.5",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {