n20-common-lib 2.1.8 → 2.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -232,7 +232,7 @@ import dayjs from 'dayjs'
232
232
  import duration from 'dayjs/plugin/duration'
233
233
  dayjs.extend(duration)
234
234
 
235
- import { getMenuAndRela } from '../../LoginTemporary/utils'
235
+ import { siteTree2menus } from '../../LoginTemporary/utils'
236
236
 
237
237
  const prefix = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || process.env.BASE_URL || '/'
238
238
 
@@ -431,10 +431,10 @@ export default {
431
431
  window.localStorage.setItem('pageLang', this.langVal)
432
432
  Cookies.set('language', ['zh-cn', 'zh-hk'].includes(this.langVal) ? 'zh' : this.langVal, { expires: 365 })
433
433
  auth.setReqLang()
434
-
435
- let asyncRelaNos = JSON.parse(sessionStorage.getItem('isAsyncGetRela'))
436
- let extraForm = JSON.parse(sessionStorage.getItem('extraFormToGetMenu')) || {}
437
- getMenuAndRela(asyncRelaNos, extraForm).then(() => {
434
+ axios.get('/bems/1.0/menuTree/tree').then(({ data }) => {
435
+ data || (data = [])
436
+ let layoutMenus = siteTree2menus(data)
437
+ sessionStorage.setItem('menuTree', JSON.stringify(layoutMenus))
438
438
  window.location.reload()
439
439
  })
440
440
  },
@@ -199,7 +199,7 @@ export default {
199
199
  },
200
200
  {
201
201
  NO: 'JRWG',
202
- NAME: '金融网管系统',
202
+ NAME: '金融网关系统',
203
203
  ICON: '',
204
204
  LOGIN_MODE: [],
205
205
  OPEN: false
@@ -143,7 +143,7 @@ import { $lc } from '../../utils/i18n/index'
143
143
  import axios from '../../utils/axios'
144
144
  import auth from '../../utils/auth'
145
145
  import qrCode from './qrcode.vue'
146
- import { getMenuAndRela } from './utils'
146
+ import { siteTree2menus, siteTree2RelaNos } from './utils'
147
147
  import importG from '../../utils/importGlobal.js'
148
148
 
149
149
  function encode(pwd = '', key = 0) {
@@ -572,9 +572,24 @@ export default {
572
572
  // 获取子应用相关列表
573
573
  async getMicroAppsInfo() {
574
574
  this.loadingAdd()
575
- await getMenuAndRela(this.asyncRelaNos, this.extraForm, this.loadingSub)
576
- sessionStorage.setItem('isAsyncGetRela', this.asyncRelaNos)
577
- sessionStorage.setItem('extraFormToGetMenu', JSON.stringify(this.extraForm))
575
+ let { data } = await axios.get(
576
+ '/bems/1.0/menuTree/tree',
577
+ {
578
+ resType: this.asyncRelaNos ? '1' : undefined,
579
+ ...this.extraForm
580
+ },
581
+ { loading: this.loadingSub }
582
+ )
583
+ data || (data = [])
584
+
585
+ let layoutMenus = siteTree2menus(data)
586
+ sessionStorage.setItem('menuTree', JSON.stringify(layoutMenus))
587
+
588
+ let relaNos = siteTree2RelaNos(data)
589
+ sessionStorage.setItem('relaNos', JSON.stringify(relaNos))
590
+
591
+ // XXX: 兼容旧版resources
592
+ sessionStorage.setItem('resources', JSON.stringify(data))
578
593
  },
579
594
  // 新增不同单位对应不同角色,具有不同权限
580
595
  getCltRelaNos() {
@@ -238,7 +238,7 @@ export default {
238
238
  },
239
239
  {
240
240
  NO: 'JRWG',
241
- NAME: '金融网管系统',
241
+ NAME: '金融网关系统',
242
242
  ICON: undefined,
243
243
  LOGIN_MODE: [],
244
244
  OPEN: false
@@ -84,25 +84,3 @@ export function siteTree2RelaNos(siteTree) {
84
84
  let relaNos = Object.values(relaNosMap)
85
85
  return relaNos
86
86
  }
87
-
88
- import axios from '../../utils/axios'
89
- export async function getMenuAndRela(asyncRelaNos, extraForm, loadingSub) {
90
- let { data } = await axios.get(
91
- '/bems/1.0/menuTree/tree',
92
- {
93
- resType: asyncRelaNos ? '1' : undefined,
94
- ...extraForm
95
- },
96
- { loading: loadingSub }
97
- )
98
- data || (data = [])
99
-
100
- let layoutMenus = siteTree2menus(data)
101
- sessionStorage.setItem('menuTree', JSON.stringify(layoutMenus))
102
-
103
- let relaNos = siteTree2RelaNos(data)
104
- sessionStorage.setItem('relaNos', JSON.stringify(relaNos))
105
-
106
- // XXX: 兼容旧版resources
107
- sessionStorage.setItem('resources', JSON.stringify(data))
108
- }