qj-common 4.2.1 → 4.2.2

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/permission.js +57 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qj-common",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "common files && template for qj-paas",
5
5
  "scripts": {
6
6
  "gulp": "gulp css"
package/src/permission.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import main from '#/main';
3
3
 
4
4
  // White List
5
- const whiteList = [`b2b.heidelbergchina.com`,`uatb2b.heidelbergchina.com`];
5
+ const whiteList = [`b2b.heidelbergchina.com`, `uatb2b.heidelbergchina.com`];
6
6
 
7
7
  // Executor
8
8
  main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgress, PageNotFound, domCreate, interceptor, queryParams, getActiveMenu, generateRoutesFromMenu }) => {
@@ -30,7 +30,7 @@ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgre
30
30
  }
31
31
 
32
32
  // Dispatch GetAppInfo
33
- store.dispatch('GetAppInfo').then(res => {
33
+ store.dispatch('GetAppInfo').then((res) => {
34
34
  // Get App Path
35
35
  const appPath = process.env.APP_PATH;
36
36
 
@@ -46,7 +46,7 @@ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgre
46
46
  if (menuList) {
47
47
  // Current Routes
48
48
  if (menuList.routerMap[appPath]) {
49
- return menuList.routerMap[appPath].forEach(el => {
49
+ return menuList.routerMap[appPath].forEach((el) => {
50
50
  handleRouter(el.children);
51
51
  });
52
52
  }
@@ -56,10 +56,10 @@ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgre
56
56
  }
57
57
 
58
58
  // No Storage
59
- store.dispatch('GetAppRouter').then(menuList => {
59
+ store.dispatch('GetAppRouter').then((menuList) => {
60
60
  // Current Routes
61
61
  if (menuList.routerMap[appPath]) {
62
- return menuList.routerMap[appPath].forEach(el => {
62
+ return menuList.routerMap[appPath].forEach((el) => {
63
63
  handleRouter(el.children);
64
64
  });
65
65
  }
@@ -87,7 +87,7 @@ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgre
87
87
  const menu = {};
88
88
 
89
89
  // Set Menu
90
- menuList && menuList.forEach(element => (menu[element.proappModelCode] = element.children));
90
+ menuList && menuList.forEach((element) => (menu[element.proappModelCode] = element.children));
91
91
 
92
92
  // Set Code
93
93
  menuCode(menuList);
@@ -101,7 +101,7 @@ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgre
101
101
  return;
102
102
  }
103
103
 
104
- data.forEach(item => {
104
+ data.forEach((item) => {
105
105
  if (item.menuCode === 'P0000111') {
106
106
  return window.sessionStorage.setItem('menuAction', item.menuAction);
107
107
  }
@@ -153,10 +153,10 @@ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgre
153
153
  const noneLayout = [];
154
154
 
155
155
  // Check Action by Preset
156
- data.forEach(e => (menuActions.includes(e.menuAction) ? noneLayout.push(e) : dataLayout.push(e)));
156
+ data.forEach((e) => (menuActions.includes(e.menuAction) ? noneLayout.push(e) : dataLayout.push(e)));
157
157
 
158
158
  // Check First for No Data
159
- noneLayout.forEach(item => {
159
+ noneLayout.forEach((item) => {
160
160
  // 只做一级
161
161
  menus.push({
162
162
  path: '/' + item.menuAction,
@@ -228,30 +228,56 @@ main(({ menuActions }, { proApp, router, store, _import, _import_common, NProgre
228
228
  if (!proappEnvLayout) {
229
229
  return;
230
230
  }
231
-
232
- // Extension Link of 1 ?
233
- const link = document.getElementsByTagName('link')[1];
234
-
231
+ let arr = document.getElementsByTagName('link') || [];
232
+ let link, head;
235
233
  // Get Head
236
- const head = document.getElementsByTagName('head')[0];
237
-
238
- // Set Href of Link
239
- link.href = '';
240
- link.href = proappEnvLayout.proappEnvIconUrl;
241
-
242
- // Extension Metas
243
- const keywords = domCreate('meta', {
244
- name: 'keywords',
245
- content: proappEnvLayout.proappEnvDes,
246
- });
234
+ if (Array.isArray(arr)) {
235
+ head = document.getElementsByTagName('head')[0];
236
+ // Extension Metas
237
+ const keywords = domCreate('meta', {
238
+ name: 'keywords',
239
+ content: proappEnvLayout.proappEnvDes,
240
+ });
247
241
 
248
- const description = domCreate('meta', {
249
- name: 'description',
250
- content: proappEnvLayout.proappEnvDes,
251
- });
242
+ const description = domCreate('meta', {
243
+ name: 'description',
244
+ content: proappEnvLayout.proappEnvDes,
245
+ });
252
246
 
253
- // Insert
254
- head.appendChild(keywords);
255
- head.appendChild(description);
247
+ // Insert
248
+ head.appendChild(keywords);
249
+ head.appendChild(description);
250
+ }
251
+ if (Array.isArray(arr) && arr.length > 1) {
252
+ // Extension Link of 1 ?
253
+ link = document.getElementsByTagName('link')[1];
254
+ // Set Href of Link
255
+ link.href = '';
256
+ link.href = proappEnvLayout.proappEnvIconUrl;
257
+ }
258
+ // // Extension Link of 1 ?
259
+ // const link = document.getElementsByTagName('link')[1];
260
+
261
+ // // Get Head
262
+ // const head = document.getElementsByTagName('head')[0];
263
+
264
+ // // Set Href of Link
265
+ // link.href = '';
266
+ // link.href = proappEnvLayout.proappEnvIconUrl;
267
+
268
+ // // Extension Metas
269
+ // const keywords = domCreate('meta', {
270
+ // name: 'keywords',
271
+ // content: proappEnvLayout.proappEnvDes,
272
+ // });
273
+
274
+ // const description = domCreate('meta', {
275
+ // name: 'description',
276
+ // content: proappEnvLayout.proappEnvDes,
277
+ // });
278
+
279
+ // // Insert
280
+ // head.appendChild(keywords);
281
+ // head.appendChild(description);
256
282
  });
257
283
  });