@yeeyoon/library 2.4.4 → 2.4.9

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,12 +1,12 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Menu, Image, Modal } from 'antd';
3
- import { AppstoreOutlined } from '@ant-design/icons';
4
3
  import PropTypes from 'prop-types';
5
4
  import PlatformModal from '../PlatformModal';
6
5
  import { getCollabRedirectUrl } from '../../env';
7
6
  import ls from 'local-storage';
8
7
  import styles from './index.less';
9
8
  import { fetchSystemToken } from '../../service';
9
+ import { IconWodechanpin, IconTuijianchanpin } from '../../../Icons';
10
10
 
11
11
  const { SubMenu } = Menu;
12
12
 
@@ -54,7 +54,12 @@ const ProductListMenu = (props) => {
54
54
  return (
55
55
  <div className={styles['product-menu']}>
56
56
  <Menu mode="inline" openKeys={openKeys} style={{ width: 256 }}>
57
- <SubMenu key="sub1" icon={<AppstoreOutlined />} title="我的产品">
57
+ <SubMenu
58
+ key="sub1"
59
+ icon={<IconWodechanpin style={{ fontSize: '16px' }} />}
60
+ title="我的产品"
61
+ style={{ fontSize: '16px' }}
62
+ >
58
63
  {productList.length ? (
59
64
  productList.map((item) => {
60
65
  return (
@@ -78,7 +83,11 @@ const ProductListMenu = (props) => {
78
83
  <Menu.Item key={1}>暂无数据</Menu.Item>
79
84
  )}
80
85
  </SubMenu>
81
- <SubMenu key="sub2" icon={<AppstoreOutlined />} title="推荐产品">
86
+ <SubMenu
87
+ key="sub2"
88
+ icon={<IconTuijianchanpin style={{ fontSize: '16px' }} />}
89
+ title="推荐产品"
90
+ >
82
91
  {recommendProductList.length ? (
83
92
  recommendProductList.map((item) => {
84
93
  return (
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import _xorBy from 'lodash/xorBy';
4
+ import ls from 'local-storage';
4
5
  import { Menu, Dropdown, Tooltip, Avatar, Drawer, Modal, Divider } from 'antd';
5
6
  import {
6
7
  UserOutlined,
@@ -46,6 +47,9 @@ const IconStyle = {
46
47
  display: 'inline-block',
47
48
  };
48
49
 
50
+ const DEFAULT_AVATAR_URL =
51
+ 'https://demo-yeeyoon-fm.oss-cn-zhangjiakou.aliyuncs.com/userCenter/userAvatar/user_avatar3.png';
52
+
49
53
  const Header = (props) => {
50
54
  const {
51
55
  token,
@@ -59,9 +63,8 @@ const Header = (props) => {
59
63
  const [systemUserInfo, setSystemUserInfo] = useState(null);
60
64
  const [tenants, setTenants] = useState([]);
61
65
  const [userId, setUserId] = useState([]);
62
- const [productListMenuDrawerShow, setProductListMenuDrawerShow] = useState(
63
- false
64
- );
66
+ const [productListMenuDrawerShow, setProductListMenuDrawerShow] =
67
+ useState(false);
65
68
  const [platformsModalShow, setPlatformsModalShow] = useState(false);
66
69
  const [avatarProps, setAvatarProps] = useState({});
67
70
  const [redirectUrl, setRedirectUrl] = useState('');
@@ -134,7 +137,8 @@ const Header = (props) => {
134
137
  const resp = await fetchUserInfo();
135
138
  const { success, data } = resp;
136
139
  if (success) {
137
- const { platforms, tenants, id } = data;
140
+ const { platforms, tenants, id, name } = data;
141
+ ls.set('X-Auth-Username', name);
138
142
  if (platforms.filter((item) => item.id === CY_PLATFORM_ID).length) {
139
143
  getCySystemToken();
140
144
  }
@@ -142,14 +146,7 @@ const Header = (props) => {
142
146
  setPlatforms(platforms);
143
147
  setTenants(tenants);
144
148
  setUserId(id);
145
- setAvatarProps(
146
- data.headUrl
147
- ? { src: data.headUrl }
148
- : {
149
- src:
150
- 'https://demo-yeeyoon-fm.oss-cn-zhangjiakou.aliyuncs.com/userCenter/userAvatar/user_avatar3.png',
151
- }
152
- );
149
+ setAvatarProps({ src: data.headUrl || DEFAULT_AVATAR_URL });
153
150
  currentProduct = tenants[0].applications || [];
154
151
  getProductList(id);
155
152
  } else {
@@ -2,7 +2,10 @@ import React from 'react';
2
2
  import { createFromIconfontCN } from '@ant-design/icons';
3
3
 
4
4
  const Icons = createFromIconfontCN({
5
- scriptUrl: '//at.alicdn.com/t/font_2716486_dpnjwgvqpfn.js',
5
+ scriptUrl: [
6
+ '//at.alicdn.com/t/font_2716486_dpnjwgvqpfn.js',
7
+ '//at.alicdn.com/t/font_2832661_kmrn4o901g.js',
8
+ ],
6
9
  });
7
10
 
8
11
  const IconBell = (args) => {
@@ -17,5 +20,18 @@ const IconConsole = (args) => {
17
20
  const IconMore = (args) => {
18
21
  return <Icons type="icon-more" {...args} />;
19
22
  };
23
+ const IconWodechanpin = (args) => {
24
+ return <Icons type="icon-icon_wodechanpin" {...args} />;
25
+ };
26
+ const IconTuijianchanpin = (args) => {
27
+ return <Icons type="icon-icon_tuijianchanpin" {...args} />;
28
+ };
20
29
 
21
- export { IconBell, IconTodo, IconConsole, IconMore };
30
+ export {
31
+ IconBell,
32
+ IconTodo,
33
+ IconConsole,
34
+ IconMore,
35
+ IconWodechanpin,
36
+ IconTuijianchanpin,
37
+ };
@@ -1,9 +1,11 @@
1
1
  import request from '../../utils/request';
2
- import { getApiHost } from './env';
2
+ // import { getApiHost } from './env';
3
+ import { API_ZHONGTAI_CY } from '../../config/env';
3
4
 
4
5
  export async function queryLatestMessageList(params, userInfo) {
5
6
  let data = {
6
- prefix: getApiHost(),
7
+ // prefix: getApiHost(),
8
+ prefix: API_ZHONGTAI_CY,
7
9
  params,
8
10
  };
9
11
  if (userInfo) {
@@ -14,9 +14,14 @@ const TenantSelector = (props) => {
14
14
  useEffect(async () => {
15
15
  const resp = await fetchUserInfo();
16
16
  const { data, success } = resp;
17
+ let id;
17
18
  if (success) {
18
19
  const { tenants } = data;
19
- const id = tenantId || tenants[0].id;
20
+ if (tenants.filter((item) => item.id === tenantId).length) {
21
+ id = tenantId;
22
+ } else {
23
+ id = tenants[0].id;
24
+ }
20
25
  setTenantList(tenants);
21
26
  setCurrentTenantId(id);
22
27
  tenantIdChangeCb(id);
package/lib/config/env.js CHANGED
@@ -38,6 +38,21 @@ const envApi = {
38
38
  bpm: {},
39
39
  };
40
40
 
41
+ const envHost = {
42
+ zhongtai_cy: {
43
+ testing: 'testing-zhongtai',
44
+ demo: 'demo',
45
+ staging: 'uat',
46
+ prod: 'zhongtai',
47
+ },
48
+
49
+ zhongtai_xlt: {
50
+ testing: 'xlttest',
51
+ staging: 'staging-xlt',
52
+ prod: 'xlt',
53
+ },
54
+ };
55
+
41
56
  const devHostPortMap = {
42
57
  iam: 8001,
43
58
  profile: 8003,
@@ -51,9 +66,13 @@ function getEnvHost(product, path = '') {
51
66
  const prefix = 'https://';
52
67
  const suffix = '.yeeyoon.com';
53
68
  const devPort = devHostPortMap[product];
69
+ const env = REACT_APP_ENV === 'dev' ? 'testing' : REACT_APP_ENV;
54
70
  if (REACT_APP_ENV === 'dev') {
55
71
  return `http://localhost:${devPort}/${path}`;
56
72
  }
73
+ if (product === 'zhongtai_cy' || product === 'zhongtai_xlt') {
74
+ return `${prefix}${envHost[product][env]}${suffix}`;
75
+ }
57
76
  if (product === 'official' && REACT_APP_ENV === 'demo') {
58
77
  return `${prefix}demonstration${suffix}`;
59
78
  }
@@ -102,6 +121,8 @@ export const HOST_PROFILE_MESSAGE = getEnvHost(
102
121
  'profile',
103
122
  '/message-center/home/list'
104
123
  );
124
+ export const HOST_ZHONGTAI_XLT = getEnvHost('zhongtai_cy');
125
+ export const HOST_ZHONGTAI_CY = getEnvHost('zhongtai_xlt');
105
126
 
106
127
  // API
107
128
  export const API_IAM = getEnvApi('iam');
@@ -119,6 +140,8 @@ console.log(
119
140
  `HOST_PROFILE_USER: ${HOST_PROFILE_USER}\n`,
120
141
  `HOST_PROFILE_PASSWORD: ${HOST_PROFILE_PASSWORD}\n`,
121
142
  `HOST_PROFILE_MESSAGE: ${HOST_PROFILE_MESSAGE}\n`,
143
+ `HOST_ZHONGTAI_XLT: ${HOST_ZHONGTAI_XLT}\n`,
144
+ `HOST_ZHONGTAI_CY: ${HOST_ZHONGTAI_CY}\n`,
122
145
  `------------------------------------\n`,
123
146
  `API_IAM: ${API_IAM}\n`,
124
147
  `API_ZHONGTAI_CY: ${API_ZHONGTAI_CY}\n`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "2.4.4",
3
+ "version": "2.4.9",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -8,11 +8,7 @@ import PageLoading from '../../lib/components/PageLoading/';
8
8
  export default function () {
9
9
  return (
10
10
  <>
11
- <Header
12
- productName="profile"
13
- tenantId="053a033a063711ecb0c00c42a1ff8370"
14
- token="ZmI1YzU4NzEyOTdlNDM2MTg2YjI0N2IyZGQzOGI3NDg1NDE2MzI2MjU4NjMzNzY="
15
- />
11
+ <Header productName="profile" />
16
12
  {/* <TenantSelector
17
13
  tenantId="14bfb5d71d1011eca9820c42a1f6bf88"
18
14
  tenantIdChangeCb={(id) => console.log(id)}