module-menu 0.2.52 → 0.3.1

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.
Files changed (68) hide show
  1. package/config/config.js +2 -11
  2. package/config/proxy.js +46 -0
  3. package/package.json +47 -47
  4. package/src/.umi/.cache/babel-loader/04699946904e87e3af79b0227ec6477b.json.gz +0 -0
  5. package/src/.umi/.cache/babel-loader/06e17dd38817802e6592a221354e8146.json.gz +0 -0
  6. package/src/.umi/.cache/babel-loader/0fa6e046598cb489763dcffc84d0237b.json.gz +0 -0
  7. package/src/.umi/.cache/babel-loader/152d89235030ec690bef453eede6fad0.json.gz +0 -0
  8. package/src/.umi/.cache/babel-loader/23130dc140dee98798e2acca8157d5b3.json.gz +0 -0
  9. package/src/.umi/.cache/babel-loader/27d0c5c5ee6627b34440cf895da3a62d.json.gz +0 -0
  10. package/src/.umi/.cache/babel-loader/2a0ca0cf14370a9bad40dd1a37a10a22.json.gz +0 -0
  11. package/src/.umi/.cache/babel-loader/2cec271e2f0d40dbff29b2bc4b30e356.json.gz +0 -0
  12. package/src/.umi/.cache/babel-loader/34397b46e1cbdac6da68f971bad2e4bf.json.gz +0 -0
  13. package/src/.umi/.cache/babel-loader/3802abe90374a7ba235cb5e76c17aa5e.json.gz +0 -0
  14. package/src/.umi/.cache/babel-loader/3ba130b85766e1dfc3e79ec8be17d822.json.gz +0 -0
  15. package/src/.umi/.cache/babel-loader/41bff10097f983cc69cea87eae856368.json.gz +0 -0
  16. package/src/.umi/.cache/babel-loader/42324d9b7cea9c08c43feb579b0a6f64.json.gz +0 -0
  17. package/src/.umi/.cache/babel-loader/449f9a823f6da5eb95a57b1b0bfafcc5.json.gz +0 -0
  18. package/src/.umi/.cache/babel-loader/47cd82d0fd26870d5b4d49ba6ffd9791.json.gz +0 -0
  19. package/src/.umi/.cache/babel-loader/48aba1b3b7adbee09fa2eb09768a1725.json.gz +0 -0
  20. package/src/.umi/.cache/babel-loader/4fcbb789c40a1b47b3ff5b4e0ad2adca.json.gz +0 -0
  21. package/src/.umi/.cache/babel-loader/51c59a1c80f6fe9ddf083a1dd0981d55.json.gz +0 -0
  22. package/src/.umi/.cache/babel-loader/528c7e1626d32f9686e681751d6f4447.json.gz +0 -0
  23. package/src/.umi/.cache/babel-loader/532b027338e9e1f4af4f9fc38e659347.json.gz +0 -0
  24. package/src/.umi/.cache/babel-loader/573908e8a098d32c6589d2cbbdf17022.json.gz +0 -0
  25. package/src/.umi/.cache/babel-loader/5a7a8a205a5d77110c45eb7e02049346.json.gz +0 -0
  26. package/src/.umi/.cache/babel-loader/5b9ef06f80fea14c6e0ab456a511689c.json.gz +0 -0
  27. package/src/.umi/.cache/babel-loader/5fcd03cec8e935749cc638ca8782061b.json.gz +0 -0
  28. package/src/.umi/.cache/babel-loader/618d1310cbe7e3ab5a1868b0c46d3220.json.gz +0 -0
  29. package/src/.umi/.cache/babel-loader/683716d1044c7068587080b8da30fad2.json.gz +0 -0
  30. package/src/.umi/.cache/babel-loader/6c1a8a0b701b378087effcd0af6d5bf9.json.gz +0 -0
  31. package/src/.umi/.cache/babel-loader/701d505936161beb4fc1bfc287351f22.json.gz +0 -0
  32. package/src/.umi/.cache/babel-loader/7951e2d8cc89b48464f29549bad206b2.json.gz +0 -0
  33. package/src/.umi/.cache/babel-loader/80c8b98f4da80dd5a8a913fa9a50d5f4.json.gz +0 -0
  34. package/src/.umi/.cache/babel-loader/82b998f62aed9ca0c45af9cf39825c16.json.gz +0 -0
  35. package/src/.umi/.cache/babel-loader/95cc9944bb3a356f59fba5ddce4fa09c.json.gz +0 -0
  36. package/src/.umi/.cache/babel-loader/9827039a89ef1c55148eb3467b0e8232.json.gz +0 -0
  37. package/src/.umi/.cache/babel-loader/9bcef3d384bb96fb98d4564aee4b4636.json.gz +0 -0
  38. package/src/.umi/.cache/babel-loader/9f0b82d7b93ba5b559b56c9308c71d79.json.gz +0 -0
  39. package/src/.umi/.cache/babel-loader/a1243688c3a16a833eb50372cdaa4838.json.gz +0 -0
  40. package/src/.umi/.cache/babel-loader/a54e22f4c09df2a553f848b89e36ea07.json.gz +0 -0
  41. package/src/.umi/.cache/babel-loader/a790027af67d9805c746987b274b72b7.json.gz +0 -0
  42. package/src/.umi/.cache/babel-loader/a7e0417e532e4de5dc1b8a131c71587c.json.gz +0 -0
  43. package/src/.umi/.cache/babel-loader/b59c62ad49a0c3580fa7e48197074656.json.gz +0 -0
  44. package/src/.umi/.cache/babel-loader/b7d82e7428eb5c80e25a60f56bbc8243.json.gz +0 -0
  45. package/src/.umi/.cache/babel-loader/bb39ca3cdd8edd23b727264a5da5485c.json.gz +0 -0
  46. package/src/.umi/.cache/babel-loader/c0136a55785330e2abfaec9027922a32.json.gz +0 -0
  47. package/src/.umi/.cache/babel-loader/c049f48de211fb2b64513332da1ca948.json.gz +0 -0
  48. package/src/.umi/.cache/babel-loader/cb5271afeb5eec96b982ec589f9a6b7c.json.gz +0 -0
  49. package/src/.umi/.cache/babel-loader/e048d6ea6763619950f2dde99dd14e11.json.gz +0 -0
  50. package/src/.umi/.cache/babel-loader/e14c0fb49a12360e28afa7599255d453.json.gz +0 -0
  51. package/src/.umi/.cache/babel-loader/e38803b8d5e310c740a5cdc3e9450505.json.gz +0 -0
  52. package/src/.umi/.cache/babel-loader/e3d4f258a06c6d026c97e754e1d451eb.json.gz +0 -0
  53. package/src/.umi/.cache/babel-loader/e4a1ee09c8454bfe029b61bdb71b6f65.json.gz +0 -0
  54. package/src/.umi/.cache/babel-loader/e77f1657bb86ad84e8368a3e7e61bafc.json.gz +0 -0
  55. package/src/.umi/.cache/babel-loader/e87e23bed4cbf9b8221c63782caa7a5d.json.gz +0 -0
  56. package/src/.umi/.cache/babel-loader/f7538b949426a554b27ba6192ac6f3c7.json.gz +0 -0
  57. package/src/.umi/.cache/babel-loader/ff12f36776c7479bb1088e83d3abb025.json.gz +0 -0
  58. package/src/assets/crbd.png +0 -0
  59. package/src/assets/dzcrb.png +0 -0
  60. package/src/assets/ggws.png +0 -0
  61. package/src/assets/sjzyzx.png +0 -0
  62. package/src/assets/userLogo1.png +0 -0
  63. package/src/assets/yjzyk.png +0 -0
  64. package/src/assets/ztk.png +0 -0
  65. package/src/pages/ModuleMenu/constData.jsx +32 -0
  66. package/src/pages/ModuleMenu/index.jsx +5 -2
  67. package/src/pages/ModuleUser/index.jsx +267 -262
  68. package/src/pages/util/axios.js +1 -1
package/config/config.js CHANGED
@@ -5,8 +5,7 @@ export default defineConfig({
5
5
  // localhost:8000/cmcc/data/** -> http://192.168.108.88:30808/cmcc/data/**
6
6
  '/cmcc/data/': {
7
7
  // 要代理的地址
8
- // target: 'http://192.168.108.86:30808',
9
- target: 'http://192.168.108.203:31772',
8
+ target: 'http://192.168.108.86:30808',
10
9
  // target: 'http://10.136.106.82:30808',
11
10
  // target: 'http://192.168.200.122:28088',
12
11
  // target: 'http://10.136.106.148:32678',
@@ -17,8 +16,7 @@ export default defineConfig({
17
16
  },
18
17
  '/admin/': {
19
18
  // 要代理的地址
20
- // target: 'https://192.168.108.86:30011',
21
- target: 'https://192.168.108.203:31950',
19
+ target: 'https://192.168.108.86:30011',
22
20
  // target: 'http://10.136.106.82:30808',
23
21
  // target: 'http://192.168.200.122:28088',
24
22
  // target: 'http://10.136.106.148:32678',
@@ -27,12 +25,5 @@ export default defineConfig({
27
25
  // 依赖 origin 的功能可能需要这个,比如 cookie
28
26
  changeOrigin: true,
29
27
  },
30
- '/admin-api':{
31
- // 要代理的地址
32
- target: 'https://192.168.108.203:31950',
33
- // target: 'http://192.168.108.203:30077',
34
- changeOrigin: true,
35
- pathRewrite: { '^': '' },
36
- }
37
28
  }
38
29
  });
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
3
+ * -------------------------------
4
+ * The agent cannot take effect in the production environment
5
+ * so there is no configuration of the production environment
6
+ * For details, please see
7
+ * https://pro.ant.design/docs/deploy
8
+ */
9
+ const url = 'https://192.168.108.203:31950'
10
+ export default {
11
+ dev: {
12
+ '/admin-api': {
13
+ target: url,
14
+ changeOrigin: true,
15
+ pathRewrite: { '^': '' },
16
+ },
17
+ "/": {
18
+ target: url,
19
+ ws: false, // 需要websocket 开启
20
+ changOrigin: true, //允许跨域
21
+ pathRewrite: {
22
+ "^/": "/",
23
+ },
24
+ },
25
+ // 3.5 以后不需要再配置
26
+ },
27
+ ,
28
+ test: {
29
+ '/api/': {
30
+ target: 'https://proapi.azurewebsites.net',
31
+ changeOrigin: true,
32
+ pathRewrite: {
33
+ '^': '',
34
+ },
35
+ },
36
+ },
37
+ pre: {
38
+ '/api/': {
39
+ target: 'your pre url',
40
+ changeOrigin: true,
41
+ pathRewrite: {
42
+ '^': '',
43
+ },
44
+ },
45
+ },
46
+ };
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "module-menu",
3
- "version": "0.2.52",
4
- "description": "城市大数据平台公共头部及尾部",
5
- "main": "src/pages/index.jsx",
6
- "scripts": {
7
- "start": "umi dev",
8
- "build": "umi build",
9
- "postinstall": "umi generate tmp",
10
- "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
11
- "test": "umi-test",
12
- "test:coverage": "umi-test --coverage"
13
- },
14
- "gitHooks": {
15
- "pre-commit": "lint-staged"
16
- },
17
- "lint-staged": {
18
- "**/*.less": "stylelint --syntax less",
19
- "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
20
- "*.{js,jsx,less,md,json}": [
21
- "prettier --write"
22
- ],
23
- "*.ts?(x)": [
24
- "prettier --parser=typescript --write"
25
- ]
26
- },
27
- "dependencies": {
28
- "@ant-design/pro-layout": "^6.5.0",
29
- "@umijs/preset-react": "^1.8.17",
30
- "antd": "^4.17.0",
31
- "axios": "^0.27.2",
32
- "classnames": "^2.5.1",
33
- "lodash": "^4.17.0",
34
- "react": "^17.0.0",
35
- "react-dom": "^17.0.0",
36
- "umi": "^3.5.0"
37
- },
38
- "devDependencies": {
39
- "@types/react": "^17.0.0",
40
- "@types/react-dom": "^17.0.0",
41
- "@umijs/test": "^3.5.41",
42
- "lint-staged": "^10.0.0",
43
- "prettier": "^2.3.2",
44
- "typescript": "^4.2.2",
45
- "yorkie": "^2.0.0"
46
- }
47
- }
1
+ {
2
+ "name": "module-menu",
3
+ "version": "0.3.1",
4
+ "description": "城市大数据平台公共头部及尾部",
5
+ "main": "src/pages/index.jsx",
6
+ "scripts": {
7
+ "start": "umi dev",
8
+ "build": "umi build",
9
+ "postinstall": "umi generate tmp",
10
+ "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
11
+ "test": "umi-test",
12
+ "test:coverage": "umi-test --coverage"
13
+ },
14
+ "gitHooks": {
15
+ "pre-commit": "lint-staged"
16
+ },
17
+ "lint-staged": {
18
+ "**/*.less": "stylelint --syntax less",
19
+ "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
20
+ "*.{js,jsx,less,md,json}": [
21
+ "prettier --write"
22
+ ],
23
+ "*.ts?(x)": [
24
+ "prettier --parser=typescript --write"
25
+ ]
26
+ },
27
+ "dependencies": {
28
+ "@ant-design/pro-layout": "^6.5.0",
29
+ "@umijs/preset-react": "^1.8.17",
30
+ "antd": "^4.17.0",
31
+ "axios": "^0.27.2",
32
+ "classnames": "^2.5.1",
33
+ "lodash": "^4.17.0",
34
+ "react": "^17.0.0",
35
+ "react-dom": "^17.0.0",
36
+ "umi": "^3.5.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/react": "^17.0.0",
40
+ "@types/react-dom": "^17.0.0",
41
+ "@umijs/test": "^3.5.41",
42
+ "lint-staged": "^10.0.0",
43
+ "prettier": "^2.3.2",
44
+ "typescript": "^4.2.2",
45
+ "yorkie": "^2.0.0"
46
+ }
47
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -349,3 +349,35 @@ export const sysNameMap = (stash = '') => [
349
349
  logoSrc: stash !=='LNRD'? require('../../assets/alert_logo.svg'): require('../../assets/alert_logo_LNRD.svg'),
350
350
  },
351
351
  ];
352
+
353
+ export const menuList_HBJK = [{
354
+ name: '数据资源中心',
355
+ url: require('../../assets/sjzyzx.png'),
356
+ children: [
357
+ {
358
+ childName: '公共卫生监测人口库',
359
+ path: '/datamanage',
360
+ url:require('../../assets/ggws.png'),
361
+ },
362
+ {
363
+ childName: '电子传染病档案库',
364
+ path: '/datamanage',
365
+ url:require('../../assets/dzcrb.png'),
366
+ },
367
+ {
368
+ childName: '应急资源库',
369
+ path: '/datamanage',
370
+ url:require('../../assets/yjzyk.png'),
371
+ },
372
+ {
373
+ childName: '传染病防控知识库',
374
+ path: '/datamanage',
375
+ url:require('../../assets/crbd.png'),
376
+ },
377
+ {
378
+ childName: '主题库',
379
+ path: '/datamanage',
380
+ url:require('../../assets/ztk.png'),
381
+ },
382
+ ]
383
+ }]
@@ -1,6 +1,6 @@
1
1
  import { useState, useEffect, useRef, useMemo } from 'react';
2
2
  import { Popconfirm, message, Popover } from 'antd';
3
- import { menuList as menuListInit, menuIconSrc, sysNameMap } from './constData';
3
+ import { menuList as menuListInit, menuIconSrc, sysNameMap, menuList_HBJK} from './constData';
4
4
  import HeaderDropdown from '../ModuleUser/HeaderDropdown';
5
5
  import { getInfoByName, getUrlByInfo } from './service.js'
6
6
  import Axios from '../util/axios';
@@ -247,6 +247,9 @@ const ModuleMenu = ({ sysName, stash = '' }) => {
247
247
  newMenuList.splice(index, 1);
248
248
  }
249
249
  }
250
+ }
251
+ if (stash === 'HBJK') {
252
+ newMenuList = newMenuList.concat(menuList_HBJK);
250
253
  }
251
254
  return newMenuList;
252
255
  };
@@ -363,7 +366,7 @@ const ModuleMenu = ({ sysName, stash = '' }) => {
363
366
  backgroundRepeat: 'no-repeat',
364
367
  backgroundSize: '50%',
365
368
  backgroundPosition: 'center',
366
- backgroundColor: stash === 'LNRD'? '#EA1A1A': stash === 'HBJK'? '#1890ff' : '#4091F7'
369
+ backgroundColor: stash === 'LNRD'? '#EA1A1A': stash === 'HBJK'? '#1373FF' : '#4091F7'
367
370
 
368
371
  }}
369
372
  >
@@ -1,262 +1,267 @@
1
- import React, { Component, useEffect, useState } from 'react';
2
- import { Popconfirm, message, Dropdown, Button, Select } from 'antd';
3
- import { userMenuIcon } from './constData';
4
- import {
5
- HomeOutlined,
6
- UserOutlined,
7
- CaretDownOutlined,
8
- } from '@ant-design/icons';
9
- import { Spin, Menu, Avatar } from 'antd';
10
- import HeaderDropdown from './HeaderDropdown';
11
- import Axios from '../util/axios';
12
- import getStore, { getUserName } from '../util/userInfo';
13
- import './index.less';
14
- import cn from 'classnames'
15
-
16
- // stash存在则为一体化,否则为轻量级
17
- const ModuleUser = ({ stash = '' }) => {
18
- const [tenantList, setTenantList] = useState([]);
19
- const [haveAppSystemPermission, setHaveAppSystemPermission] = useState(false);
20
- useEffect(() => {
21
- localStorage.setItem('stash', stash)
22
- if (['integration', 'LNRD', 'HBJK'].includes(stash)) {
23
- getTenantList();
24
- allSystemList();
25
- }
26
- }, []);
27
- const handleClickmenu = (url) => {
28
- window.location.href = url;
29
- };
30
- const handleClickSysManage = () => {
31
- if(['integration', 'LNRD', 'HBJK'].includes(stash)){
32
- Axios('get', '/admin-api/system/auth/homePage', '', {})
33
- .then((res) => {
34
- if (res.data.code === 0) {
35
- window.location.href = `/admin-ui${res.data.data.path}`;
36
- } else {
37
- message.warning(res.data.msg || '获取系统管理页面路由信息失败');
38
- }
39
- })
40
- .catch((e) => console.log('e', e));
41
- }else{
42
- const menuList = getStore({name: 'menu'});
43
- const sysManagePath= menuList?.find(item=>item.name === '权限管理').children[0].path
44
- window.location.href = stash === 'GZW' ? '/data-platform/#'+ sysManagePath : '/#'+ sysManagePath
45
- }
46
- };
47
- const {
48
- PersonalCenterSrc,
49
- MessageCenterSrc,
50
- SystemManageSrc,
51
- LogoutSrc,
52
- AppSystemSrc,
53
- } = userMenuIcon;
54
-
55
- const isHaveSystemManagementPermission = (['integration', 'LNRD', 'HBJK'].includes(stash))
56
- ? true
57
- : getStore({ name: 'isHaveSystemManagementPermission' });
58
- const DEFAULT_LOGOUT_URL = (['integration', 'LNRD', 'HBJK'].includes(stash)) ? '/admin-ui/login' : (stash === 'GZW'? '/data-platform/#/login' : '/#/login');
59
-
60
- // 跳转服务门户
61
- const jumpToExterHome = () => {
62
- handleClickmenu('/admin-ui/data-share-portal/homePage');
63
- };
64
-
65
- const curTenantId = ['integration', 'LNRD', 'HBJK'].includes(stash)
66
- ? getStore({ name: 'tenantId' }) && parseInt(getStore({ name: 'tenantId' }))
67
- : '';
68
- const curTenantName = ['integration', 'LNRD', 'HBJK'].includes(stash) ? getStore({ name: 'tenantName' }) : '';
69
-
70
- const getTenantList = () => {
71
- Axios('get', '/admin-api/system/user/getUserTenant', '', {})
72
- .then((res) => {
73
- if (res.data.code === 0) {
74
- let tenantLists =
75
- res.data.data &&
76
- res.data.data.map((item) => {
77
- return {
78
- id: item.id,
79
- value: item.id,
80
- label: item.name,
81
- };
82
- });
83
- setTenantList(tenantLists || []);
84
- }
85
- })
86
- .catch((e) => console.log('e', e));
87
- };
88
- const allSystemList = () => {
89
- Axios(
90
- 'get',
91
- '/admin-api/system/user/get-user-menu-List?menuName=数据平台',
92
- '',
93
- {},
94
- )
95
- .then((res) => {
96
- if (res.data.code === 0) {
97
- let menuGet =
98
- res.data.data &&
99
- res.data.data[0]?.routes?.map((item) => {
100
- return {
101
- ...item,
102
- path:
103
- item.path.indexOf('/') !== -1 ? item.path : '/' + item.path,
104
- };
105
- });
106
- let haveAppSystem_Permission =
107
- menuGet?.some((item) => item.name === '应用系统配置') || false;
108
- setHaveAppSystemPermission(haveAppSystem_Permission);
109
- }
110
- })
111
- .catch((e) => console.log('e', e));
112
- };
113
-
114
- // 退出登录
115
- const logout = () => {
116
- const logoutUrl = (['integration', 'LNRD', 'HBJK'].includes(stash))
117
- ? '/admin-api/system/auth/logout'
118
- : (stash === 'GZW' ? '/data-platform/auth/token/logout' : '/auth/token/logout');
119
- const logouType = (['integration', 'LNRD', 'HBJK'].includes(stash)) ? 'post' : 'delete';
120
- Axios(logouType, logoutUrl, '', {})
121
- .then(() => {
122
- console.log('退出登录接口调用成功');
123
- localStorage.clear();
124
- sessionStorage.clear();
125
- window.location.href = DEFAULT_LOGOUT_URL;
126
- })
127
- .catch((error) => {
128
- console.error('Error while logging out, error:', error);
129
- message.error('服务器错误,请稍后重试');
130
- });
131
- };
132
-
133
- // 切换租户改缓存、调接口、刷界面
134
- const handleChangeTenant = (e) => {
135
- let token = getStore({ name: 'access_token' });
136
- Axios('post', `/admin-api/system/auth/setRedisTokenOfTenant`, '', {
137
- data: { token, tenantId: e },
138
- })
139
- .then((res) => {
140
- if (res.data.code === 0) {
141
- console.log('接口调用成功');
142
- window.localStorage.setItem('curTenantId', e);
143
- window.localStorage.setItem(
144
- 'curTenantName',
145
- tenantList.find((item) => item.id === e)?.label,
146
- );
147
- window.location.reload();
148
- } else {
149
- message.warning(res.data.msg || '租户切换失败');
150
- }
151
- })
152
- .catch((e) => console.log('e', e));
153
- };
154
-
155
- const menu = (
156
- <Menu className="menu" selectedKeys={[]}>
157
- <Menu.Item
158
- key="personalCenter"
159
- onClick={() =>
160
- handleClickmenu(
161
- ['integration', 'LNRD', 'HBJK'].includes(stash) ?
162
- '/admin-ui/data-share-portal/personal/info':
163
- (stash === 'GZW'? '/data-platform/#/info/index' : '/#/info/index')
164
- )
165
- }
166
- >
167
- <img
168
- src={PersonalCenterSrc}
169
- alt=""
170
- style={{ marginRight: '10px', marginTop: '-3px' }}
171
- />
172
- <span>{['integration', 'LNRD', 'HBJK'].includes(stash) ? '用户中心' : '个人中心'}</span>
173
- </Menu.Item>
174
- {isHaveSystemManagementPermission && (
175
- <Menu.Item key="systemManage" onClick={handleClickSysManage}>
176
- <img
177
- src={SystemManageSrc}
178
- alt=""
179
- style={{ marginRight: '10px', marginTop: '-3px' }}
180
- />
181
- <span>系统管理</span>
182
- </Menu.Item>
183
- )}
184
- {haveAppSystemPermission && (
185
- <Menu.Item
186
- key="appSystem"
187
- onClick={() => handleClickmenu('/dataadmin/#/appSystem/index')}
188
- >
189
- <img
190
- src={AppSystemSrc}
191
- alt=""
192
- style={{ marginRight: '10px', marginTop: '-3px' }}
193
- />
194
- <span>应用系统配置</span>
195
- </Menu.Item>
196
- )}
197
- <Menu.Item key="logout" onClick={() => logout()}>
198
- <img
199
- src={LogoutSrc}
200
- alt=""
201
- style={{ width: '15px', height: '15px', marginRight: '10px' }}
202
- />
203
- <span>退出登录</span>
204
- </Menu.Item>
205
- </Menu>
206
- );
207
-
208
- return (
209
- <div className={cn(stash !== 'LNRD'? 'right_size':'right_size_LNRD', 'right')}>
210
- {['integration', 'LNRD', 'HBJK'].includes(stash) && [
211
- <Button type="link" onClick={jumpToExterHome}
212
- className={cn(stash === 'LNRD'? 'fwmh_color_LNRD': stash === 'HBJK'? 'fwmh_color_HBJK' : null)}>
213
- 服务门户
214
- </Button>,
215
- <Select
216
- defaultValue={curTenantId}
217
- className={stash === 'LNRD'? 'right-select_LNRD': stash === 'HBJK'? 'right-select_HBJK' : 'right-select'}
218
- style={{
219
- width: 150,
220
- border: 'none',
221
- }}
222
- onChange={handleChangeTenant}
223
- options={tenantList}
224
- />,
225
- ]}
226
- {getUserName() ? (
227
- <HeaderDropdown overlay={menu}>
228
- <span style={{ display: 'inline-block', marginLeft: '12px' }}>
229
- <Avatar size="small" icon={<UserOutlined />} />
230
- <span
231
- style={{
232
- marginLeft: '10px',
233
- verticalAlign: '-2px',
234
- fontSize: '16px',
235
- fontWeight: '500',
236
- // color: stash !== 'LNRD'? null: '#FFFFFF'
237
- color: ['LNRD','HBJK'].includes(stash)? '#FFFFFF' : null
238
- }}
239
- >
240
- {getUserName()}
241
- </span>
242
- <CaretDownOutlined
243
- style={{ marginLeft: '10px', fontSize: '8px', color: ['LNRD','HBJK'].includes(stash)? '#FFFFFF': '#333333'}}
244
- />
245
- </span>
246
- </HeaderDropdown>
247
- ) : (
248
- <Spin
249
- size="small"
250
- style={{
251
- marginLeft: 8,
252
- marginRight: 8,
253
- lineHeight: '57px',
254
- textAlign: 'center',
255
- }}
256
- />
257
- )}
258
- </div>
259
- );
260
- };
261
-
262
- export default ModuleUser;
1
+ import React, { Component, useEffect, useState } from 'react';
2
+ import { Popconfirm, message, Dropdown, Button, Select } from 'antd';
3
+ import { userMenuIcon } from './constData';
4
+ import {
5
+ HomeOutlined,
6
+ UserOutlined,
7
+ CaretDownOutlined,
8
+ } from '@ant-design/icons';
9
+ import { Spin, Menu, Avatar } from 'antd';
10
+ import HeaderDropdown from './HeaderDropdown';
11
+ import Axios from '../util/axios';
12
+ import getStore, { getUserName } from '../util/userInfo';
13
+ import './index.less';
14
+ import cn from 'classnames'
15
+ import userLogo1 from '../../assets/userLogo1.png';
16
+
17
+ // stash存在则为一体化,否则为轻量级
18
+ const ModuleUser = ({ stash = '' }) => {
19
+ const [tenantList, setTenantList] = useState([]);
20
+ const [haveAppSystemPermission, setHaveAppSystemPermission] = useState(false);
21
+ useEffect(() => {
22
+ localStorage.setItem('stash', stash)
23
+ if (['integration', 'LNRD', 'HBJK'].includes(stash)) {
24
+ getTenantList();
25
+ allSystemList();
26
+ }
27
+ }, []);
28
+ const handleClickmenu = (url) => {
29
+ window.location.href = url;
30
+ };
31
+ const handleClickSysManage = () => {
32
+ if(['integration', 'LNRD', 'HBJK'].includes(stash)){
33
+ Axios('get', '/admin-api/system/auth/homePage', '', {})
34
+ .then((res) => {
35
+ if (res.data.code === 0) {
36
+ window.location.href = `/admin-ui${res.data.data.path}`;
37
+ } else {
38
+ message.warning(res.data.msg || '获取系统管理页面路由信息失败');
39
+ }
40
+ })
41
+ .catch((e) => console.log('e', e));
42
+ }else{
43
+ const menuList = getStore({name: 'menu'});
44
+ const sysManagePath= menuList?.find(item=>item.name === '权限管理').children[0].path
45
+ window.location.href = stash === 'GZW' ? '/data-platform/#'+ sysManagePath : '/#'+ sysManagePath
46
+ }
47
+ };
48
+ const {
49
+ PersonalCenterSrc,
50
+ MessageCenterSrc,
51
+ SystemManageSrc,
52
+ LogoutSrc,
53
+ AppSystemSrc,
54
+ } = userMenuIcon;
55
+
56
+ const isHaveSystemManagementPermission = (['integration', 'LNRD', 'HBJK'].includes(stash))
57
+ ? true
58
+ : getStore({ name: 'isHaveSystemManagementPermission' });
59
+ const DEFAULT_LOGOUT_URL = (['integration', 'LNRD', 'HBJK'].includes(stash)) ? '/admin-ui/login' : (stash === 'GZW'? '/data-platform/#/login' : '/#/login');
60
+
61
+ // 跳转服务门户
62
+ const jumpToExterHome = () => {
63
+ handleClickmenu('/admin-ui/data-share-portal/homePage');
64
+ };
65
+
66
+ const curTenantId = ['integration', 'LNRD', 'HBJK'].includes(stash)
67
+ ? getStore({ name: 'tenantId' }) && parseInt(getStore({ name: 'tenantId' }))
68
+ : '';
69
+ const curTenantName = ['integration', 'LNRD', 'HBJK'].includes(stash) ? getStore({ name: 'tenantName' }) : '';
70
+
71
+ const getTenantList = () => {
72
+ Axios('get', '/admin-api/system/user/getUserTenant', '', {})
73
+ .then((res) => {
74
+ if (res.data.code === 0) {
75
+ let tenantLists =
76
+ res.data.data &&
77
+ res.data.data.map((item) => {
78
+ return {
79
+ id: item.id,
80
+ value: item.id,
81
+ label: item.name,
82
+ };
83
+ });
84
+ setTenantList(tenantLists || []);
85
+ }
86
+ })
87
+ .catch((e) => console.log('e', e));
88
+ };
89
+ const allSystemList = () => {
90
+ Axios(
91
+ 'get',
92
+ '/admin-api/system/user/get-user-menu-List?menuName=数据平台',
93
+ '',
94
+ {},
95
+ )
96
+ .then((res) => {
97
+ if (res.data.code === 0) {
98
+ let menuGet =
99
+ res.data.data &&
100
+ res.data.data[0]?.routes?.map((item) => {
101
+ return {
102
+ ...item,
103
+ path:
104
+ item.path.indexOf('/') !== -1 ? item.path : '/' + item.path,
105
+ };
106
+ });
107
+ let haveAppSystem_Permission =
108
+ menuGet?.some((item) => item.name === '应用系统配置') || false;
109
+ setHaveAppSystemPermission(haveAppSystem_Permission);
110
+ }
111
+ })
112
+ .catch((e) => console.log('e', e));
113
+ };
114
+
115
+ // 退出登录
116
+ const logout = () => {
117
+ const logoutUrl = (['integration', 'LNRD', 'HBJK'].includes(stash))
118
+ ? '/admin-api/system/auth/logout'
119
+ : (stash === 'GZW' ? '/data-platform/auth/token/logout' : '/auth/token/logout');
120
+ const logouType = (['integration', 'LNRD', 'HBJK'].includes(stash)) ? 'post' : 'delete';
121
+ Axios(logouType, logoutUrl, '', {})
122
+ .then(() => {
123
+ console.log('退出登录接口调用成功');
124
+ localStorage.clear();
125
+ sessionStorage.clear();
126
+ window.location.href = DEFAULT_LOGOUT_URL;
127
+ })
128
+ .catch((error) => {
129
+ console.error('Error while logging out, error:', error);
130
+ message.error('服务器错误,请稍后重试');
131
+ });
132
+ };
133
+
134
+ // 切换租户改缓存、调接口、刷界面
135
+ const handleChangeTenant = (e) => {
136
+ let token = getStore({ name: 'access_token' });
137
+ Axios('post', `/admin-api/system/auth/setRedisTokenOfTenant`, '', {
138
+ data: { token, tenantId: e },
139
+ })
140
+ .then((res) => {
141
+ if (res.data.code === 0) {
142
+ console.log('接口调用成功');
143
+ window.localStorage.setItem('curTenantId', e);
144
+ window.localStorage.setItem(
145
+ 'curTenantName',
146
+ tenantList.find((item) => item.id === e)?.label,
147
+ );
148
+ window.location.reload();
149
+ } else {
150
+ message.warning(res.data.msg || '租户切换失败');
151
+ }
152
+ })
153
+ .catch((e) => console.log('e', e));
154
+ };
155
+
156
+ const menu = (
157
+ <Menu className="menu" selectedKeys={[]}>
158
+ <Menu.Item
159
+ key="personalCenter"
160
+ onClick={() =>
161
+ handleClickmenu(
162
+ ['integration', 'LNRD', 'HBJK'].includes(stash) ?
163
+ '/admin-ui/data-share-portal/personal/info':
164
+ (stash === 'GZW'? '/data-platform/#/info/index' : '/#/info/index')
165
+ )
166
+ }
167
+ >
168
+ <img
169
+ src={PersonalCenterSrc}
170
+ alt=""
171
+ style={{ marginRight: '10px', marginTop: '-3px' }}
172
+ />
173
+ <span>{['integration', 'LNRD', 'HBJK'].includes(stash) ? '用户中心' : '个人中心'}</span>
174
+ </Menu.Item>
175
+ {isHaveSystemManagementPermission && (
176
+ <Menu.Item key="systemManage" onClick={handleClickSysManage}>
177
+ <img
178
+ src={SystemManageSrc}
179
+ alt=""
180
+ style={{ marginRight: '10px', marginTop: '-3px' }}
181
+ />
182
+ <span>系统管理</span>
183
+ </Menu.Item>
184
+ )}
185
+ {haveAppSystemPermission && (
186
+ <Menu.Item
187
+ key="appSystem"
188
+ onClick={() => handleClickmenu('/dataadmin/#/appSystem/index')}
189
+ >
190
+ <img
191
+ src={AppSystemSrc}
192
+ alt=""
193
+ style={{ marginRight: '10px', marginTop: '-3px' }}
194
+ />
195
+ <span>应用系统配置</span>
196
+ </Menu.Item>
197
+ )}
198
+ <Menu.Item key="logout" onClick={() => logout()}>
199
+ <img
200
+ src={LogoutSrc}
201
+ alt=""
202
+ style={{ width: '15px', height: '15px', marginRight: '10px' }}
203
+ />
204
+ <span>退出登录</span>
205
+ </Menu.Item>
206
+ </Menu>
207
+ );
208
+
209
+ return (
210
+ <div className={cn(stash !== 'LNRD'? 'right_size':'right_size_LNRD', 'right')}>
211
+ {['integration', 'LNRD', 'HBJK'].includes(stash) && [
212
+ <Button type="link" onClick={jumpToExterHome}
213
+ className={cn(stash === 'LNRD'? 'fwmh_color_LNRD': stash === 'HBJK'? 'fwmh_color_HBJK' : null)}>
214
+ 服务门户
215
+ </Button>,
216
+ <Select
217
+ defaultValue={curTenantId}
218
+ className={stash === 'LNRD'? 'right-select_LNRD': stash === 'HBJK'? 'right-select_HBJK' : 'right-select'}
219
+ style={{
220
+ width: 150,
221
+ border: 'none',
222
+ }}
223
+ onChange={handleChangeTenant}
224
+ options={tenantList}
225
+ />,
226
+ ]}
227
+ {getUserName() ? (
228
+ <HeaderDropdown overlay={menu}>
229
+ <span style={{ display: 'inline-block', marginLeft: '12px' }}>
230
+ {stash === 'HBJK' ? (
231
+ <Avatar size="small" src={userLogo1} />
232
+ ) : (
233
+ <Avatar size="small" icon={<UserOutlined />} />
234
+ )}
235
+ <span
236
+ style={{
237
+ marginLeft: '10px',
238
+ verticalAlign: '-2px',
239
+ fontSize: '16px',
240
+ fontWeight: '500',
241
+ // color: stash !== 'LNRD'? null: '#FFFFFF'
242
+ color: ['LNRD','HBJK'].includes(stash)? '#FFFFFF' : null
243
+ }}
244
+ >
245
+ {getUserName()}
246
+ </span>
247
+ <CaretDownOutlined
248
+ style={{ marginLeft: '10px', fontSize: '8px', color: ['LNRD','HBJK'].includes(stash)? '#FFFFFF': '#333333'}}
249
+ />
250
+ </span>
251
+ </HeaderDropdown>
252
+ ) : (
253
+ <Spin
254
+ size="small"
255
+ style={{
256
+ marginLeft: 8,
257
+ marginRight: 8,
258
+ lineHeight: '57px',
259
+ textAlign: 'center',
260
+ }}
261
+ />
262
+ )}
263
+ </div>
264
+ );
265
+ };
266
+
267
+ export default ModuleUser;
@@ -4,7 +4,7 @@ import baseCof from './config';
4
4
  import getStore from './userInfo';
5
5
  import { checkToken} from './permessionUtils';
6
6
 
7
- let tokenValue='a1a2a1b747f644acb6e26c0e1ea79fe8';
7
+ let tokenValue='5de3ef8171364d6ba756221655fe1310';
8
8
  // 轻量级tokenInSessionStor存在(GZW跳/data-platform/#/login,否则/#/login),一体化tokenInSessionStor不存在
9
9
  const tokenInSessionStor = window.sessionStorage.getItem('bigdata-access_token');
10
10
  // stash=GZW为轻量级国资委 stash=integration 为一体化,其余为其他轻量级