module-menu 0.2.26 → 0.2.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "module-menu",
3
- "version": "0.2.26",
3
+ "version": "0.2.28",
4
4
  "description": "城市大数据平台公共头部及尾部",
5
5
  "main": "src/pages/index.jsx",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- export const menuList = (stash) => [
1
+ export const menuList = (stash = '') => [
2
2
  {
3
3
  name: '首页',
4
4
  url: require('../../assets/home.svg'),
@@ -10,7 +10,7 @@ export const menuList = (stash) => [
10
10
  children: [
11
11
  {
12
12
  childName: '数据集成',
13
- path: stash ? '/datacollect' : '/datacollection',
13
+ path: stash === 'integration' ? '/datacollect' : '/datacollection',
14
14
  url: require('../../assets/datacollection_slogo.svg'),
15
15
  },
16
16
  ],
@@ -21,7 +21,7 @@ export const menuList = (stash) => [
21
21
  children: [
22
22
  {
23
23
  childName: '数据治理',
24
- path: stash ? '/datamanage' : '/dataManager',
24
+ path: stash === 'integration' ? '/datamanage' : '/dataManager',
25
25
  url: require('../../assets/datamanager_slogo.svg'),
26
26
  },
27
27
  {
@@ -31,7 +31,7 @@ export const menuList = (stash) => [
31
31
  },
32
32
  {
33
33
  childName: '数据质量',
34
- path: stash ? '/quality' : '/quality/',
34
+ path: stash === 'integration' ? '/quality' : '/quality/',
35
35
  url: require('../../assets/quality_slogo.svg'),
36
36
  },
37
37
  ],
@@ -42,7 +42,7 @@ export const menuList = (stash) => [
42
42
  children: [
43
43
  {
44
44
  childName: '离线开发',
45
- path: stash ? '/datadev' : '/datadev/',
45
+ path: stash === 'integration' ? '/datadev' : '/datadev/',
46
46
  url: require('../../assets/datadev_slogo.svg'),
47
47
  },
48
48
  {
@@ -55,7 +55,7 @@ export const menuList = (stash) => [
55
55
  {
56
56
  name: '数据共享',
57
57
  url: require('../../assets/ic_shujukaifang_m.svg'),
58
- children: stash
58
+ children: stash === 'integration'
59
59
  ? [
60
60
  {
61
61
  childName: '数据服务',
@@ -130,7 +130,7 @@ export const menuList = (stash) => [
130
130
  {
131
131
  name: '公共模块',
132
132
  url: require('../../assets/ic_gonggongmokuai_m.svg'),
133
- children: stash
133
+ children: stash === 'integration'
134
134
  ? [
135
135
  {
136
136
  childName: '运维中心',
@@ -162,7 +162,34 @@ export const menuList = (stash) => [
162
162
  url: require('../../assets/ic_zonglan.png'),
163
163
  },
164
164
  ]
165
- : [
165
+ : (stash === 'GZW'?
166
+ [
167
+ {
168
+ childName: '运维中心',
169
+ path: '/operate',
170
+ url: require('../../assets/operate_slogo.svg'),
171
+ },
172
+ {
173
+ childName: '系统管理',
174
+ path: '/data-platform/#/admin/user/index',
175
+ url: require('../../assets/admin_slogo.svg'),
176
+ },
177
+ {
178
+ childName: '工单管理',
179
+ url: require('../../assets/workorder_slogo.svg'),
180
+ },
181
+ {
182
+ childName: '消息中心',
183
+ path: '/alert',
184
+ url: require('../../assets/alert_slogo.svg'),
185
+ },
186
+ {
187
+ childName: '数据安全',
188
+ path: '/datasecurity',
189
+ url: require('../../assets/datasecurity_slogo.png'),
190
+ },
191
+ ] :
192
+ [
166
193
  {
167
194
  childName: '运维中心',
168
195
  path: '/operate',
@@ -187,7 +214,7 @@ export const menuList = (stash) => [
187
214
  path: '/datasecurity',
188
215
  url: require('../../assets/datasecurity_slogo.png'),
189
216
  },
190
- ],
217
+ ]),
191
218
  },
192
219
  ];
193
220
  export const menuIconSrc = require('../../assets/menuIcon.svg');
@@ -5,30 +5,25 @@ import HeaderDropdown from '../ModuleUser/HeaderDropdown';
5
5
  import Axios from '../util/axios';
6
6
  import _ from 'lodash';
7
7
  import './index.less';
8
-
9
- const ModuleMenu = ({ sysName, stash }) => {
8
+ /*
9
+ *stash
10
+ 一体化 integration
11
+ 轻量级 不传
12
+ 轻量级-国资委 GZW
13
+ *
14
+ */
15
+ const ModuleMenu = ({ sysName, stash = '' }) => {
10
16
  const [sessionMenu, setSessionMenu] = useState([]);
11
17
  const [showMenuList, setshowMenuList] = useState(false);
12
18
  const [menuList, setMenuList] = useState([]);
13
19
  const [canOperatExchange, setCanOperatExchange] = useState(false); //是否具有政务共享平台权限
14
-
15
20
  useEffect(() => {
21
+ localStorage.setItem('stash', stash)
16
22
  getSessionMenu();
17
23
  }, []);
18
24
 
19
25
  const getSessionMenu = () => {
20
- if (!stash) {
21
- const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
22
- let menuGet = menuObj?.content || [];
23
- setSessionMenu(menuGet);
24
- const menuLists = getNewMenuList(menuGet);
25
- setMenuList(menuLists);
26
- let exchangeInfo =
27
- menuGet && menuGet.find((item) => item.path === '/exchange');
28
- if (exchangeInfo) {
29
- setCanOperatExchange(true);
30
- }
31
- } else {
26
+ if(stash === 'integration'){
32
27
  Axios(
33
28
  'get',
34
29
  '/admin-api/system/user/get-user-menu-List?menuName=数据平台',
@@ -55,6 +50,17 @@ const ModuleMenu = ({ sysName, stash }) => {
55
50
  }
56
51
  })
57
52
  .catch((e) => console.log('e', e));
53
+ }else{
54
+ const menuObj = JSON.parse(sessionStorage.getItem('bigdata-menu'));
55
+ let menuGet = menuObj?.content || [];
56
+ setSessionMenu(menuGet);
57
+ const menuLists = getNewMenuList(menuGet);
58
+ setMenuList(menuLists);
59
+ let exchangeInfo =
60
+ menuGet && menuGet.find((item) => item.path === '/exchange');
61
+ if (exchangeInfo) {
62
+ setCanOperatExchange(true);
63
+ }
58
64
  }
59
65
  };
60
66
 
@@ -161,7 +167,7 @@ const ModuleMenu = ({ sysName, stash }) => {
161
167
  // 跳转首页
162
168
  const toHomePage = (index) => {
163
169
  if (index === 0) {
164
- window.location.href = !stash ? '/#/index' : '/dataadmin/#/index';
170
+ window.location.href = stash === 'integration'? '/dataadmin/#/index' : (stash === 'GZW' ? '/data-platform/#/index' : '/#/index')
165
171
  }
166
172
  };
167
173
  const getNewMenuList = (menuGet) => {
@@ -12,25 +12,21 @@ import Axios from '../util/axios';
12
12
  import getStore, { getUserName } from '../util/userInfo';
13
13
  import './index.less';
14
14
  // stash存在则为一体化,否则为轻量级
15
- const ModuleUser = ({ stash }) => {
15
+ const ModuleUser = ({ stash = '' }) => {
16
16
  const [tenantList, setTenantList] = useState([]);
17
17
  const [haveAppSystemPermission, setHaveAppSystemPermission] = useState(false);
18
18
  useEffect(() => {
19
- if (stash) {
19
+ localStorage.setItem('stash', stash)
20
+ if (stash === 'integration') {
20
21
  getTenantList();
21
22
  allSystemList();
22
23
  }
23
24
  }, []);
24
25
  const handleClickmenu = (url) => {
25
26
  window.location.href = url;
26
- };
27
+ };
27
28
  const handleClickSysManage = () => {
28
- if (!stash) {
29
- const menuList = getStore({name: 'menu'});
30
- const sysManagePath= menuList?.find(item=>item.name === '权限管理').children[0].path
31
- window.location.href = '/#'+ sysManagePath
32
- // '/#/admin/user/index';
33
- } else {
29
+ if(stash === 'integration'){
34
30
  Axios('get', '/admin-api/system/auth/homePage', '', {})
35
31
  .then((res) => {
36
32
  if (res.data.code === 0) {
@@ -40,6 +36,10 @@ const ModuleUser = ({ stash }) => {
40
36
  }
41
37
  })
42
38
  .catch((e) => console.log('e', e));
39
+ }else{
40
+ const menuList = getStore({name: 'menu'});
41
+ const sysManagePath= menuList?.find(item=>item.name === '权限管理').children[0].path
42
+ window.location.href = stash === 'GZW' ? '/data-platform/#'+ sysManagePath : '/#'+ sysManagePath
43
43
  }
44
44
  };
45
45
  const {
@@ -50,20 +50,20 @@ const ModuleUser = ({ stash }) => {
50
50
  AppSystemSrc,
51
51
  } = userMenuIcon;
52
52
 
53
- const isHaveSystemManagementPermission = stash
53
+ const isHaveSystemManagementPermission = (stash === 'integration')
54
54
  ? true
55
55
  : getStore({ name: 'isHaveSystemManagementPermission' });
56
- const DEFAULT_LOGOUT_URL = !stash ? '/#/login' : '/admin-ui/login';
56
+ const DEFAULT_LOGOUT_URL = (stash === 'integration') ? '/admin-ui/login' : (stash === 'GZW'? '/data-platform/#/login' : '/#/login');
57
57
 
58
58
  // 跳转服务门户
59
59
  const jumpToExterHome = () => {
60
60
  handleClickmenu('/admin-ui/data-share-portal/homePage');
61
61
  };
62
62
 
63
- const curTenantId = stash
63
+ const curTenantId = stash === 'integration'
64
64
  ? getStore({ name: 'tenantId' }) && parseInt(getStore({ name: 'tenantId' }))
65
65
  : '';
66
- const curTenantName = stash ? getStore({ name: 'tenantName' }) : '';
66
+ const curTenantName = stash === 'integration' ? getStore({ name: 'tenantName' }) : '';
67
67
 
68
68
  const getTenantList = () => {
69
69
  Axios('get', '/admin-api/system/user/getUserTenant', '', {})
@@ -111,10 +111,10 @@ const ModuleUser = ({ stash }) => {
111
111
 
112
112
  // 退出登录
113
113
  const logout = () => {
114
- const logoutUrl = !stash
115
- ? '/auth/token/logout'
116
- : '/admin-api/system/auth/logout';
117
- const logouType = !stash ? 'delete' : 'post';
114
+ const logoutUrl = (stash === 'integration')
115
+ ? '/admin-api/system/auth/logout'
116
+ : (stash === 'GZW' ? '/data-platform/auth/token/logout' : '/auth/token/logout');
117
+ const logouType = (stash === 'integration') ? 'post' : 'delete';
118
118
  Axios(logouType, logoutUrl, '', {})
119
119
  .then(() => {
120
120
  console.log('退出登录接口调用成功');
@@ -156,9 +156,9 @@ const ModuleUser = ({ stash }) => {
156
156
  key="personalCenter"
157
157
  onClick={() =>
158
158
  handleClickmenu(
159
- !stash
160
- ? '/#/info/index'
161
- : '/admin-ui/data-share-portal/personal/info',
159
+ stash === 'integration' ?
160
+ '/admin-ui/data-share-portal/personal/info':
161
+ (stash === 'GZW'? '/data-platform/#/info/index' : '/#/info/index')
162
162
  )
163
163
  }
164
164
  >
@@ -167,7 +167,7 @@ const ModuleUser = ({ stash }) => {
167
167
  alt=""
168
168
  style={{ marginRight: '10px', marginTop: '-3px' }}
169
169
  />
170
- <span>{!stash ? '个人中心' : '用户中心'}</span>
170
+ <span>{stash === 'integration' ? '用户中心' : '个人中心'}</span>
171
171
  </Menu.Item>
172
172
  {isHaveSystemManagementPermission && (
173
173
  <Menu.Item key="systemManage" onClick={handleClickSysManage}>
@@ -205,7 +205,7 @@ const ModuleUser = ({ stash }) => {
205
205
 
206
206
  return (
207
207
  <div className="right">
208
- {stash && [
208
+ {stash === 'integration' && [
209
209
  <Button type="link" onClick={jumpToExterHome}>
210
210
  服务门户
211
211
  </Button>,
@@ -4,10 +4,11 @@ import baseCof from './config';
4
4
  import getStore from './userInfo';
5
5
  import { checkToken} from './permessionUtils';
6
6
 
7
- let tokenValue='dfd39d55-4c49-4862-8400-46f2a57f25ac';
8
- // tokenInSessionStor存在为一体化,不存在为轻量级
7
+ let tokenValue='a39090d9-bf94-4342-9a1d-1b885cc5385b';
8
+ // tokenInSessionStor存在为一体化,不存在为轻量级(GZW跳/data-platform/#/login,否则/#/login)
9
9
  const tokenInSessionStor = window.sessionStorage.getItem('bigdata-access_token');
10
- const DEFAULT_LOGOUT_URL = tokenInSessionStor? '/#/login':'/admin-ui/login'
10
+ // stash=GZW为轻量级国资委 stash=integration 为一体化,其余为其他轻量级
11
+ const stash = localStorage.getItem('stash')
11
12
 
12
13
  axios.interceptors.response.use(
13
14
  (response) => {
@@ -24,7 +25,7 @@ axios.interceptors.response.use(
24
25
  message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
25
26
  localStorage.clear();
26
27
  sessionStorage.clear();
27
- window.location.href = DEFAULT_LOGOUT_URL;
28
+ window.location.href = stash==='GZW'?'/data-platform/#/login': '/#/login';
28
29
  }});
29
30
  }
30
31
 
@@ -93,14 +94,14 @@ function Axios(method, api, params, map) {
93
94
  let httpDefult;
94
95
  // 几个外部特殊接口
95
96
  // 退出登录
96
- if(api === '/auth/token/logout'){
97
+ if(api.includes('/auth/token/logout')){
97
98
  httpDefult = {
98
99
  method: method,
99
100
  url: `${baseCof.baseSever}${api}`,
100
101
  params: params,
101
102
  ...map,
102
103
  };
103
- } else if (api === '/admin/social/logoutUri') {
104
+ } else if (api.includes('/admin/social/logoutUri')) {
104
105
  httpDefult = {
105
106
  method: method,
106
107
  url: `${baseCof.baseSever}${api}`,
@@ -9,7 +9,7 @@ export const checkToken = (token) => {
9
9
  message.error({content:'用户凭证已过期,请重新登录', onClose: ()=>{
10
10
  localStorage.clear();
11
11
  sessionStorage.clear();
12
- window.location.href = '/#/login';
12
+ window.location.href = '/admin-ui/login';
13
13
  }});
14
14
  })
15
15
  }