module-menu-vue 0.3.24 → 0.3.25

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-vue",
3
- "version": "0.3.24",
3
+ "version": "0.3.25",
4
4
  "description": "城市大数据平台菜单--Vue版",
5
5
  "main": "/index.js",
6
6
  "scripts": {
@@ -6,6 +6,13 @@ export const getMenuList = () => {
6
6
  })
7
7
  }
8
8
 
9
+ // 获取系统菜单列表(用于系统管理菜单判断)
10
+ export const getAuthListMenus = () => {
11
+ return request('/admin-api/system/auth/list-menus', {
12
+ method: 'get'
13
+ })
14
+ }
15
+
9
16
  // 是否跳转到第三方
10
17
  export const isLogoutThird = () => {
11
18
  return request('/admin/social/logoutUri');
@@ -15,7 +15,7 @@
15
15
  <img :src="SystemManageSrc" alt="" class="menuItem" />
16
16
  <span>系统管理</span>
17
17
  </el-dropdown-item>
18
- <el-dropdown-item v-show="isShowApp" command="app">
18
+ <el-dropdown-item v-show="isShowAppFinal" command="app">
19
19
  <img :src="appSystemSrc" alt="" class="menuItem" />
20
20
  <span>应用系统配置</span>
21
21
  </el-dropdown-item>
@@ -32,8 +32,8 @@ import Axios from '../Util/axios.js'
32
32
  import { userMenuIcon } from './constant.js'
33
33
  import { getUserName, getIsHaveSystemManagementPermissionFlag } from './../Util/userInfo.js'
34
34
  import { integrationLogout, getSysUrl } from './service.js'
35
- import {getMenuList} from '../Menu/service.js'
36
35
  import { getLoginUrl } from '../Util/permessionUtils.js';
36
+ import {getMenuList, getAuthListMenus} from '../Menu/service.js'
37
37
 
38
38
  export default {
39
39
  name: 'UserInfo',
@@ -45,14 +45,28 @@ export default {
45
45
  SystemManageSrc: userMenuIcon.SystemManageSrc,
46
46
  appSystemSrc: userMenuIcon.appSystemSrc,
47
47
  LogoutSrc: userMenuIcon.LogoutSrc,
48
- isShowApp: false
48
+ isShowApp: false,
49
+ isShowSysIntegration: false,
50
+ isShowAppIntegration: false
49
51
  }
50
52
  },
51
53
  computed: {
52
54
  // 是否显示系统管理菜单项
53
55
  isShowSys () {
54
- return ["integration", 'LNRD', 'HBJK'].includes(this.stash) ? true : this.sysName !== 'admin' && this.isHaveSystemManagementPermission
56
+ if (this.stash === 'integration') {
57
+ return this.isShowSysIntegration
58
+ } else if (['LNRD', 'HBJK'].includes(this.stash)) {
59
+ return true
60
+ } else {
61
+ return this.isHaveSystemManagementPermission
62
+ }
55
63
  },
64
+ isShowAppFinal () {
65
+ if (this.stash === 'integration') {
66
+ return this.isShowAppIntegration
67
+ }
68
+ return this.isShowApp
69
+ }
56
70
  },
57
71
  props: {
58
72
  sysName: {
@@ -72,6 +86,10 @@ export default {
72
86
  if (["integration", 'LNRD', 'HBJK'].includes(this.stash)) {
73
87
  this.isShowAppFunc()
74
88
  }
89
+ if (this.stash === 'integration') {
90
+ this.checkSystemMenu()
91
+ this.checkAppMenu()
92
+ }
75
93
  if (this.stash === 'GZW') {
76
94
  sessionStorage.setItem('stash', 'GZW')
77
95
  } else if (this.stash === 'PANWEI') {
@@ -81,6 +99,40 @@ export default {
81
99
  }
82
100
  },
83
101
  methods: {
102
+ hasMenu(menuList, targetId, targetName) {
103
+ for (const item of menuList) {
104
+ if (item.id === targetId || item.name === targetName) {
105
+ return true
106
+ }
107
+ if (item.children && item.children.length > 0) {
108
+ if (this.hasMenu(item.children, targetId, targetName)) {
109
+ return true
110
+ }
111
+ }
112
+ }
113
+ return false
114
+ },
115
+ async checkSystemMenu() {
116
+ try {
117
+ const rsp = await getAuthListMenus()
118
+ const menuList = rsp.data.data || []
119
+ this.isShowSysIntegration = this.hasMenu(menuList, 1, '系统管理')
120
+ } catch (e) {
121
+ console.error('获取系统菜单失败:', e)
122
+ this.isShowSysIntegration = false
123
+ }
124
+ },
125
+ async checkAppMenu() {
126
+ try {
127
+ const rsp = await getMenuList()
128
+ const menuList = rsp.data.data[0].routes || []
129
+ console.log("menuList===", menuList)
130
+ this.isShowAppIntegration = this.hasMenu(menuList, 7500, '应用系统配置')
131
+ } catch (e) {
132
+ console.error('获取用户菜单失败:', e)
133
+ this.isShowAppIntegration = false
134
+ }
135
+ },
84
136
  async isShowAppFunc() {
85
137
  const rsp = await getMenuList()
86
138
  const rspData = rsp.data.data
@@ -231,4 +283,4 @@ export default {
231
283
  .el-popper{
232
284
  margin-top: -2px !important;
233
285
  }
234
- </style>
286
+ </style>
package/vue.config.js CHANGED
@@ -1,4 +1,4 @@
1
- const url = 'https://192.168.108.203:31950'
1
+ const url = 'https://192.168.108.81:31950'
2
2
  module.exports = {
3
3
  lintOnSave: true,
4
4
  productionSourceMap: false,
@@ -18,6 +18,7 @@ module.exports = {
18
18
  target: url,
19
19
  ws: false, // 需要websocket 开启
20
20
  changOrigin: true, //允许跨域
21
+ secure: false,
21
22
  pathRewrite: {
22
23
  "^/": "/",
23
24
  },
@@ -25,6 +26,7 @@ module.exports = {
25
26
  '/admin-api': {
26
27
  target: url,
27
28
  changeOrigin: true,
29
+ secure: false,
28
30
  pathRewrite: { '^': '' },
29
31
  }
30
32
  // 3.5 以后不需要再配置