@ganwei-web/ganwei-pc-cli 6.2.9 → 6.3.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 (71) hide show
  1. package/ganwei-iotcenter-index-6.2.3/configuration/moduleConfiguration.json +2 -0
  2. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/env.d.ts +8 -5
  3. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/index.html +1 -1
  4. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/public/static/css/ElementPlusAdapter.css +437 -68
  5. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/public/static/css/reset-6-1.css +1 -0
  6. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/public/static/css/reset-plus.css +396 -0
  7. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/public/static/http/createAxios.js +38 -13
  8. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/public/static/js/getLanguage.js +19 -12
  9. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/public/static/themes/dark-6-1.css +3 -3
  10. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/public/static/themes/green-6-1.css +12 -11
  11. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/App.vue +11 -6
  12. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/equipAlarmDialog/index.vue +6 -0
  13. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/expirationReminder/index.vue +7 -3
  14. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/index.scss +4 -0
  15. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/index.js +35 -3
  16. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/index.scss +7 -1
  17. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/indexRightContent/headerRight/userInfo/index.vue +2 -2
  18. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/layouts/Navigation/ContractMenu.vue +11 -37
  19. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/layouts/Navigation/TopNav.vue +3 -2
  20. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/components/layouts/Sidebar/LeftContent/index.vue +7 -1
  21. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/router.js +120 -18
  22. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/date.ts +80 -0
  23. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/dom.ts +99 -0
  24. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/env.ts +20 -0
  25. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/file.ts +74 -0
  26. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/index.ts +26 -0
  27. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/number.ts +83 -0
  28. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/performance.ts +69 -0
  29. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/storage.ts +80 -0
  30. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/string.ts +116 -0
  31. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/xss-filter.ts +260 -0
  32. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/views/jumpIframe/index.vue +45 -28
  33. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/tsconfig.json +1 -0
  34. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/vite.config.ts +10 -1
  35. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-login/public/static/http/createAxios.js +40 -15
  36. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-login/public/static/js/getLanguage.js +10 -2
  37. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-login/src/views/login.vue +55 -53
  38. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-login/src/views/ssoLogin.vue +10 -9
  39. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/.env.development +0 -3
  40. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/.env.production +1 -4
  41. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/.env.test +0 -3
  42. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/.eslintrc.cjs +2 -2
  43. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/env.d.ts +9 -5
  44. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/index.html +1 -0
  45. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/package.json +3 -2
  46. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/public/static/http/createAxios.js +38 -13
  47. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/public/static/js/getLanguage.js +10 -2
  48. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/App.vue +1 -1
  49. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/request/api.ts +0 -1
  50. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/request/models/response/template.ts +0 -0
  51. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/date.ts +79 -0
  52. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/dom.ts +99 -0
  53. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/env.ts +20 -0
  54. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/file.ts +74 -0
  55. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/index.ts +29 -0
  56. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/number.ts +83 -0
  57. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/performance.ts +69 -0
  58. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/signalr.ts +564 -0
  59. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/storage.ts +80 -0
  60. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/string.ts +116 -0
  61. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/xss-filter.ts +260 -0
  62. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/views/template.vue +0 -1
  63. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/tsconfig.json +7 -0
  64. package/ganwei-iotcenter-index-6.2.3/pnpm-lock.yaml +489 -155
  65. package/package.json +1 -1
  66. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/mixins/judgePermission.js +0 -60
  67. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/src/utils/setStorage.js +0 -5
  68. package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/utils/setStorage.js +0 -5
  69. /package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-index/build/{enteryJson.js → entryJson.js} +0 -0
  70. /package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/{request/models/request/index.ts → enum/template.ts} +0 -0
  71. /package/ganwei-iotcenter-index-6.2.3/packages/ganwei-iotcenter-template/src/request/models/{response/index.ts → request/template.ts} +0 -0
@@ -46,7 +46,6 @@ window.getElementLanguages = async () => {
46
46
  //① 是否需要请求 element.el
47
47
  const needElementRequest = !elementPkg || isEmptyObject(elementPkg['el']) || isEmptyObject(elementPkg['ele']);
48
48
 
49
-
50
49
  //② 是否需要请求 publics(login.publics)
51
50
  const needPublicsRequest = !loginPkg || isEmptyObject(loginPkg['publics']);
52
51
 
@@ -72,8 +71,8 @@ window.haveExistLanguage = (pluginName, menuName) => {
72
71
  const key = pluginName + '__' + menuName;
73
72
  const pkg = JSON.parse(sessionStorage.languagePackage || '{}');
74
73
  return pkg[langType] &&
75
- pkg[langType][key] &&
76
- Object.keys(pkg[langType][key]).length > 0;
74
+ pkg[langType][key] &&
75
+ Object.keys(pkg[langType][key]).length > 0;
77
76
  } catch {
78
77
  return false;
79
78
  }
@@ -98,12 +97,12 @@ window.requestLanguage = async (pluginName, menuName, packageId, vm) => {
98
97
  }).catch(() => ({}));
99
98
  }
100
99
 
101
- window.updateLanguage = (pluginName, menuName,vm, i18n) => {
100
+ window.updateLanguage = (pluginName, menuName, vm, i18n) => {
102
101
  if (!(vm && vm.i18nInstance) && !(i18n && i18n._vm)) {
103
102
  console.log(pluginName + '__' + menuName + ' 更新语言失败,没有找到 i18n 实例');
104
103
  return;
105
104
  }
106
-
105
+
107
106
  const langType = localStorage.languageType || 'zh-CN';
108
107
  let languagePackage = {};
109
108
  try {
@@ -131,8 +130,16 @@ window.updateLanguage = (pluginName, menuName,vm, i18n) => {
131
130
 
132
131
  // Vue3 基座
133
132
  if (vm && vm.i18nInstance) {
134
- vm.i18nInstance.locale = langType;
135
- vm.i18nInstance.mergeLocaleMessage(langType, JSON.parse(JSON.stringify(merged)));
133
+ // composition API 模式下,locale mergeLocaleMessage 在 i18n.global 上
134
+ const i18nInstance = vm.i18nInstance.global || vm.i18nInstance;
135
+ if (i18nInstance.locale && typeof i18nInstance.locale === 'object' && 'value' in i18nInstance.locale) {
136
+ // composition API 模式
137
+ i18nInstance.locale.value = langType;
138
+ } else {
139
+ // legacy 模式
140
+ i18nInstance.locale = langType;
141
+ }
142
+ i18nInstance.mergeLocaleMessage(langType, JSON.parse(JSON.stringify(merged)));
136
143
  }
137
144
  // Vue2 基座
138
145
  else if (i18n && i18n._vm) {
@@ -151,8 +158,8 @@ window.haveExistLanguage = (pluginName, menuName) => {
151
158
  const key = pluginName + '__' + menuName;
152
159
  const pkg = JSON.parse(sessionStorage.languagePackage || '{}');
153
160
  return pkg[langType] &&
154
- pkg[langType][key] &&
155
- Object.keys(pkg[langType][key]).length > 0;
161
+ pkg[langType][key] &&
162
+ Object.keys(pkg[langType][key]).length > 0;
156
163
  } catch {
157
164
  return false;
158
165
  }
@@ -178,9 +185,9 @@ window.saveToSession = (pluginName, menuName, language) => {
178
185
  languagePackage[langType]['publics'] = language['publics'] || {};
179
186
  }
180
187
  else if (key === 'ganwei-iotcenter-login__element') {
181
- languagePackage[langType]['element'] = language || {};
182
- languagePackage[langType]['el'] = language['el'] || {};
183
- languagePackage[langType]['ele'] = language || {};
188
+ languagePackage[langType]['element'] = language || {};
189
+ languagePackage[langType]['el'] = language['el'] || {};
190
+ languagePackage[langType]['ele'] = language || {};
184
191
  }
185
192
  sessionStorage.setItem('languagePackage', JSON.stringify(languagePackage));
186
193
  } catch (e) {
@@ -449,9 +449,9 @@
449
449
 
450
450
  /* EquipSelect 组件样式 */
451
451
  --equipselect-header-background: var(--gw-color-Neutrals23);
452
- --equipselect-body-background: var(--gw-color-Neutrals20);
452
+ --equipselect-body-background: var(--frame-main-background);
453
453
 
454
454
  /* TaskPopper 组件样式 */
455
- --task-popper-background: var(--gw-color-Neutrals27);
456
- --task-popper-item-background: var(--gw-color-Neutrals28);
455
+ --task-popper-background: var(--gw-color-Neutrals23);
456
+ --task-popper-item-background: var(--gw-color-Neutrals27);
457
457
  }
@@ -59,15 +59,15 @@
59
59
  /* --gw-color-Neutrals30: transparent; */
60
60
  --gw-color-Neutrals31: #D8DDEA;
61
61
  --gw-color-Neutrals32: #FFFFFF;
62
- --gw-color-Neutrals33: rgba(255,255,255,0.42);
63
- --gw-color-Neutrals34: rgba(4,4,4,0.14);
62
+ --gw-color-Neutrals33: rgba(255, 255, 255, 0.42);
63
+ --gw-color-Neutrals34: rgba(4, 4, 4, 0.14);
64
64
  --gw-color-Neutrals35: #F3F6F8;
65
65
  --gw-color-Neutrals36: transparent;
66
66
  --gw-color-Neutrals37: #191D2B;
67
67
  --gw-color-Neutrals38: #F0F3F5;
68
- --gw-color-Neutrals39:rgba(154,37,37,0.4);
69
- --gw-color-Neutrals40:rgba(0,219,28,0.2);
70
- --gw-color-Neutrals41:rgba(197, 154, 99, 0.4);
68
+ --gw-color-Neutrals39: rgba(154, 37, 37, 0.4);
69
+ --gw-color-Neutrals40: rgba(0, 219, 28, 0.2);
70
+ --gw-color-Neutrals41: rgba(197, 154, 99, 0.4);
71
71
  /* 命名规则 参考BEM命名法*/
72
72
  /* --组件-元素-样式名__状态 */
73
73
  /* 样式名:color(字体颜色),background(背景色),border(边框色) */
@@ -98,13 +98,13 @@
98
98
  --frame-main-border2: var(--gw-color-Neutrals36);
99
99
 
100
100
  /* 顶部 */
101
- --frame-top-background: var(--gw-color-Neutrals28);
101
+ --frame-top-background: var(--gw-color-Neutrals27);
102
102
  --frame-top-alarm-background: var(--gw-color-Neutrals39);
103
103
  --frame-top-normal-background: var(--gw-color-Neutrals40);
104
104
  --frame-top-upgrade-background: var(--gw-color-Neutrals41);
105
105
  /* 左侧菜单 */
106
106
  --frame-left-background: var(--gw-color-primary);
107
- --frame-left-box-shadow: 0px 0px 10px 0px rgba(13,17,26,0.1);
107
+ --frame-left-box-shadow: 0px 0px 10px 0px rgba(13, 17, 26, 0.1);
108
108
 
109
109
  /* 按钮主要颜色 */
110
110
  --button-primary-color: var(--gw-color-primary);
@@ -126,11 +126,11 @@
126
126
 
127
127
  /* 标签页 */
128
128
  --labelpage-header-background: var(--gw-color-Neutrals23);
129
- --labelpage-background: var(--frame-main-background);
130
- --labelpage-background__active: var(--gw-color-primary5);
129
+ --labelpage-background: var(--gw-color-Neutrals27);
130
+ --labelpage-background__active: var(--frame-main-background);
131
131
  --labelpage-border__active: var(--gw-color-primary);
132
132
  --labelpage-color: var(--gw-color-Neutrals12);
133
- --labelpage-color__active: var(--gw-color-Neutrals24);
133
+ --labelpage-color__active: var(--gw-color-Neutrals12);
134
134
  --labelpage-icon-color__hover: var(--gw-color-primary);
135
135
  --labelpage-border: var(--gw-color-Neutrals18);
136
136
 
@@ -153,6 +153,7 @@
153
153
 
154
154
  /* 菜单 */
155
155
  --menu-color: var(--gw-color-Neutrals27);
156
+ --menu-color-1: var(--gw-color-Neutrals1);
156
157
  --menu-color__hover: var(--gw-color-Neutrals27);
157
158
  --menu-color__active: var(--gw-color-Neutrals27);
158
159
  --menu-background__hover: var(--gw-color-primary5);
@@ -354,4 +355,4 @@
354
355
 
355
356
  --task-popper-background: var(--gw-color-Neutrals27);
356
357
  --task-popper-item-background: var(--gw-color-Neutrals28);
357
- }
358
+ }
@@ -1,22 +1,23 @@
1
1
  <template>
2
2
  <div class="app">
3
- <el-config-provider>
4
- <router-view v-cloak v-if="isShow" />
3
+ <!-- 验证通过且语言包加载完成后显示页面 -->
4
+ <el-config-provider v-if="isShow">
5
+ <router-view v-cloak />
5
6
  </el-config-provider>
6
7
  </div>
7
8
  </template>
8
9
  <script>
9
10
  import muduleObserve from '@ganwei-web/gw-base-utils-plus/moduleObserve/dist/index.es.js'
10
11
 
11
- import judgePermission from './mixins/judgePermission'
12
- import { setTheme } from './utils/setStorage'
12
+ import { setTheme } from './utils/storage.ts'
13
13
 
14
14
  export default {
15
- mixins: [judgePermission, muduleObserve],
15
+ mixins: [muduleObserve],
16
16
  name: 'App',
17
17
  data() {
18
18
  return {
19
- isNoRequestObserveGetPublic: true
19
+ isNoRequestObserveGetPublic: true,
20
+ isLoading: true
20
21
  }
21
22
  },
22
23
  mounted() {
@@ -85,4 +86,8 @@ html body div {
85
86
  iframe {
86
87
  border: none;
87
88
  }
89
+
90
+ .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell {
91
+ background-color: var(--table-body-background__hover) !important;
92
+ }
88
93
  </style>
@@ -109,6 +109,12 @@ export default {
109
109
 
110
110
  // 显示通知
111
111
  showNotification(alarmData) {
112
+ // 检查当前路由是否包含指定路径,如果是则不显示通知
113
+ const currentPath = this.$route?.path || '';
114
+ if (currentPath.includes('/ganwei-iotcenter-alarm-manage-h5')) {
115
+ return;
116
+ }
117
+
112
118
  // 检查是否达到最大通知数量
113
119
  if (this.notificationOrder.length >= this.maxActiveNotifications) {
114
120
  // 移除最早的通知(第一个)
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-dialog :title="$t('login.应用到期提醒')" class="systemInformation_main" v-model="dialogVisible" :before-close="closeDialog" width="690" top="6vh" center append-to="#index">
3
- <el-table :data="expirepluginList" height="400" border >
3
+ <el-table :data="expirepluginList" height="400px" border >
4
4
  <template v-slot:empty>
5
5
  <div class="noDataTips"></div>
6
6
  </template>
@@ -27,11 +27,11 @@ export default {
27
27
  dialogVisible: false,
28
28
  expirepluginList: [],
29
29
  stateList: [{
30
- value: true,
30
+ value: false,
31
31
  label: 'login.即将到期',
32
32
  type: 'warning'
33
33
  }, {
34
- value: false,
34
+ value: true,
35
35
  label: 'login.已到期',
36
36
  type: 'error'
37
37
  }]
@@ -102,6 +102,10 @@ export default {
102
102
  justify-content: center;
103
103
  align-items: center;
104
104
  }
105
+ .el-table {
106
+ min-height: 240px;
107
+ max-height: 480px;
108
+ }
105
109
  :deep(td.el-table__cell) {
106
110
  border-bottom: 1px solid var(--frame-main-border) !important;
107
111
  }
@@ -81,7 +81,11 @@
81
81
  vertical-align: middle;
82
82
  background-color: transparent;
83
83
  border-radius: 0px;
84
+
84
85
  // margin: 0 18px;
86
+ img {
87
+ border-radius: 6px;
88
+ }
85
89
  }
86
90
 
87
91
  span {
@@ -18,7 +18,7 @@ export default {
18
18
  data() {
19
19
  return {
20
20
  // 登录者姓名
21
- loginUsername: window.sessionStorage.userName,
21
+ loginUsername: sessionStorage.userName,
22
22
  showLogoutDialog: false,
23
23
  showPWEditDialog: false,
24
24
  showSystemInfoDialog: false,
@@ -28,7 +28,8 @@ export default {
28
28
  showSafeModeDialog: false,
29
29
  organizationName: '',
30
30
  parkDialog: false,
31
- showComfirm: localStorage.getItem('multiPark') == 'true' ? true : false
31
+ showComfirm: localStorage.getItem('multiPark') == 'true' ? true : false,
32
+ photograph: ''
32
33
  }
33
34
  },
34
35
  mounted() {
@@ -40,7 +41,20 @@ export default {
40
41
  return
41
42
  }
42
43
  if (code == 200) {
43
- this.loginUsername = sessionStorage.userName = data?.userName
44
+ sessionStorage.personName = data?.personName
45
+ sessionStorage.userName = data?.userName
46
+ sessionStorage.aesUserName = data?.aesUserName
47
+ // 将图片路径转换为 base64 存储
48
+ if (data?.photograph) {
49
+ this.convertImageToBase64(data.photograph).then(base64 => {
50
+ sessionStorage.photograph = base64 || ''
51
+ this.photograph = base64 || this.theme.user
52
+ })
53
+ } else {
54
+ sessionStorage.photograph = ''
55
+ this.photograph = this.theme.user
56
+ }
57
+ this.loginUsername = data?.personName || sessionStorage.userName
44
58
  sessionStorage.passwordPolicy = this.passwordPolicy = data?.passwordPolicy?.passwordPolicy
45
59
  this.isAdmin = data?.role == 'ADMIN'
46
60
  this.$store.commit('roleInfo', this.isAdmin);
@@ -55,6 +69,24 @@ export default {
55
69
  })
56
70
  },
57
71
  methods: {
72
+ // 图片路径转 base64
73
+ async convertImageToBase64(imagePath) {
74
+ if (!imagePath) return null
75
+ try {
76
+ const imageUrl = window.origin + imagePath
77
+ const response = await fetch(imageUrl)
78
+ const blob = await response.blob()
79
+ return new Promise((resolve, reject) => {
80
+ const reader = new FileReader()
81
+ reader.onloadend = () => resolve(reader.result)
82
+ reader.onerror = reject
83
+ reader.readAsDataURL(blob)
84
+ })
85
+ } catch (error) {
86
+ console.error('图片转base64失败:', error)
87
+ return null
88
+ }
89
+ },
58
90
  openDialog(dialog) {
59
91
  this[dialog] = true
60
92
  },
@@ -24,7 +24,7 @@
24
24
  }
25
25
 
26
26
  .user {
27
- padding: 4px 15px 14px;
27
+ padding: 10px 4px;
28
28
  display: flex;
29
29
  align-items: center;
30
30
  margin-bottom: 10px;
@@ -34,6 +34,12 @@
34
34
  background: transparent;
35
35
  height: auto;
36
36
  margin-right: 10px;
37
+
38
+ img {
39
+ width: 28px;
40
+ height: 28px;
41
+ border-radius: 6px;
42
+ }
37
43
  }
38
44
 
39
45
  span {
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <div class="userInfo">
3
3
  <el-dropdown class="index-header-right" popper-class="topToolTip">
4
- <el-avatar :src="theme.user" shape="square"></el-avatar>
4
+ <el-avatar :src="photograph" shape="square"></el-avatar>
5
5
  <i class="iconfont icon-xialasanjiao"></i>
6
6
  <template #dropdown>
7
7
  <el-dropdown-menu style="padding: 10px">
8
8
  <div class="user">
9
- <el-avatar :src="theme.user" shape="square"></el-avatar>
9
+ <el-avatar :src="photograph" shape="square"></el-avatar>
10
10
  <span>{{ loginUsername }}</span>
11
11
  </div>
12
12
  <p v-if="(config?.showTopBtn?.park || config?.showTopBtn?.park === undefined) && showComfirm"
@@ -7,35 +7,20 @@
7
7
  </span>
8
8
  <label>{{ data.name }}</label>
9
9
  </p>
10
- <ContractMenu
11
- v-for="item in data.children"
12
- :key="item.resourceId"
13
- :data="item"
14
- :is-collapse="isCollapse"
15
- :in-popup="true"
16
- />
10
+ <ContractMenu v-for="item in data.children" :key="item.resourceId" :data="item" :is-collapse="isCollapse"
11
+ :in-popup="true" />
17
12
  </div>
18
13
 
19
14
  <!-- 一级子菜单:显示为可展开的 el-sub-menu -->
20
- <el-sub-menu
21
- v-else-if="isSubMenu"
22
- :key="`${data.resourceId}-sub-menu`"
23
- :index="String(data.resourceId)"
24
- class="menu-list-item-scale"
25
- :title="data.name"
26
- >
15
+ <el-sub-menu v-else-if="isSubMenu" :key="`${data.resourceId}-sub-menu`" :index="String(data.resourceId)"
16
+ class="menu-list-item-scale" :title="data.name">
27
17
  <template #title>
28
18
  <div class="iconBox" :style="iconBoxStyle">
29
19
  <i class="iconfont" :class="menuIcon" />
30
20
  </div>
31
21
  </template>
32
- <ContractMenu
33
- v-for="item in data.children"
34
- :key="item.resourceId"
35
- :data="item"
36
- :is-collapse="isCollapse"
37
- :in-popup="true"
38
- />
22
+ <ContractMenu v-for="item in data.children" :key="item.resourceId" :data="item" :is-collapse="isCollapse"
23
+ :in-popup="true" />
39
24
  </el-sub-menu>
40
25
 
41
26
  <!-- 3级及以下菜单:在弹出面板中平铺显示 -->
@@ -46,25 +31,13 @@
46
31
  </span>
47
32
  <label>{{ data.name }}</label>
48
33
  </p>
49
- <ContractMenu
50
- v-for="item in data.children"
51
- :key="item.resourceId"
52
- :data="item"
53
- :is-collapse="isCollapse"
54
- :in-popup="true"
55
- />
34
+ <ContractMenu v-for="item in data.children" :key="item.resourceId" :data="item" :is-collapse="isCollapse"
35
+ :in-popup="true" />
56
36
  </div>
57
37
 
58
38
  <!-- 菜单项 -->
59
- <el-menu-item
60
- v-else-if="isMenuItem"
61
- :name="data.resourceId"
62
- :key="`${data.resourceId}-menu-item`"
63
- :index="data.route"
64
- class="menu-list-item-scale"
65
- :title="showTitle ? data.name : ''"
66
- @click="handleMenuClick"
67
- >
39
+ <el-menu-item v-else-if="isMenuItem" :name="data.resourceId" :key="`${data.resourceId}-menu-item`" :index="data.route"
40
+ class="menu-list-item-scale" :title="showTitle ? data.name : ''" @click="handleMenuClick">
68
41
  <div class="iconBox" :style="iconBoxStyle">
69
42
  <i class="iconfont" :class="data.icon" />
70
43
  </div>
@@ -283,6 +256,7 @@ onMounted(() => {
283
256
 
284
257
  label {
285
258
  cursor: pointer;
259
+ color: var(--menu-color-1);
286
260
  }
287
261
  }
288
262
 
@@ -6,8 +6,9 @@
6
6
  <div :class="$style.scrollView" id="topNavScrollView">
7
7
  <div :class="$style.topNavContainer" id="topNavContainer">
8
8
  <div v-for="item in options" :key="item.id" :id="`${item.id}${item.name}`"
9
- :class="[$style.topNavItem, { [$style.active]: modelValue === item.index }]" @click="handleItemClick(item)">
10
- <div :class="$style.iconBox" :style="{ backgroundColor: item.backgroundColor }">
9
+ :class="[$style.topNavItem, { 'top-nav-item': true, 'active': modelValue === item.index, [$style.active]: modelValue === item.index }]"
10
+ @click="handleItemClick(item)">
11
+ <div :class="$style.iconBox" class="iconBox" :style="{ backgroundColor: item.backgroundColor }">
11
12
  <i v-if="item.icon" class="iconfont" :class="item.icon" />
12
13
  </div>
13
14
  {{ item.name }}
@@ -391,7 +391,7 @@ globalProperties.$bus.on('navTopSelectChange', () => {
391
391
  .minImg {
392
392
  width: 80%;
393
393
  height: auto;
394
- margin: 0 auto;
394
+ margin-left: 10%;
395
395
  }
396
396
 
397
397
  .organizationalStructure {
@@ -531,11 +531,17 @@ globalProperties.$bus.on('navTopSelectChange', () => {
531
531
  [data-theme="green"] .el-container {
532
532
  #menuRef {
533
533
  background: url(/static/images/menu-background.png) no-repeat center center/100% 100%, var(--frame-left-background);
534
+ box-shadow: none;
534
535
  }
535
536
 
536
537
  .maxActive {
537
538
  box-shadow: none !important;
538
539
  }
540
+
541
+ .el-menu>.el-sub-menu .el-sub-menu__title .el-icon {
542
+ color: var(--menu-color);
543
+ }
544
+
539
545
  }
540
546
 
541
547
  .el-menu--vertical {
@@ -4,31 +4,133 @@ import {
4
4
  createRouter,
5
5
  createWebHashHistory
6
6
  } from 'vue-router'
7
+ import hostMap from './hostMap.js'
7
8
 
8
9
  const INDEX = () => import('./views/Index.vue')
9
10
  const jumpIframe = () => import('@/views/jumpIframe/index.vue')
11
+
10
12
  const router = createRouter({
11
13
  history: createWebHashHistory(),
12
- routes: [{
13
- path: '/',
14
- redirect: '/Index'
15
- },
16
- {
17
- path: '/Index',
18
- name: 'INDEX',
19
- component: INDEX,
20
- children: [
21
- {
22
- path: 'jumpIframe/:packageName([^/]*)/:route(.*)',
23
- name: 'jumpIframe3',
24
- component: jumpIframe
25
- }
26
- ]
27
- },
14
+ routes: [
15
+ {
16
+ path: '/',
17
+ redirect: '/Index'
18
+ },
19
+ {
20
+ path: '/Index',
21
+ name: 'INDEX',
22
+ component: INDEX,
23
+ meta: { requiresAuth: true },
24
+ children: [
25
+ {
26
+ path: 'jumpIframe/:packageName([^/]*)/:route(.*)',
27
+ name: 'jumpIframe3',
28
+ component: jumpIframe,
29
+ meta: { requiresAuth: true }
30
+ }
31
+ ]
32
+ }
28
33
  ]
29
34
  })
35
+
36
+ // ==================== 登录验证状态管理 ====================
37
+ let authCheckPromise = null
38
+ let isAuthChecked = false
39
+
40
+ // 带超时的请求
41
+ function fetchWithTimeout(promise, timeout) {
42
+ return Promise.race([
43
+ promise,
44
+ new Promise((_, reject) =>
45
+ setTimeout(() => reject(new Error('请求超时')), timeout)
46
+ )
47
+ ])
48
+ }
49
+
50
+ // 用 AxiosBuilder 构建的带拦截器的实例
51
+ function getAxiosInstance() {
52
+ return window.AxiosBuilder?.axios || window.axios
53
+ }
54
+
55
+ // 验证登录状态(复用同一个 Promise,避免重复请求)
56
+ async function checkAuthStatus() {
57
+ if (isAuthChecked) return true
58
+ if (authCheckPromise) return authCheckPromise
59
+
60
+ authCheckPromise = (async () => {
61
+ try {
62
+ console.time('getSystemInfo')
63
+ const res = await fetchWithTimeout(
64
+ getAxiosInstance().get('/IoT/api/v3/Auth/GetSystemRuntimeInfo'),
65
+ 3000
66
+ )
67
+ console.timeEnd('getSystemInfo')
68
+
69
+ if (res?.data?.code == 200 || res?.data?.code == -99999) {
70
+ isAuthChecked = true
71
+ return true
72
+ }
73
+ return false
74
+ } catch (err) {
75
+ console.log('登录验证失败:', err?.message || err)
76
+ return false
77
+ } finally {
78
+ authCheckPromise = null
79
+ }
80
+ })()
81
+
82
+ return authCheckPromise
83
+ }
84
+
85
+ // 跳转登录页
86
+ function redirectToLogin() {
87
+ const url = process.env.NODE_ENV === 'development'
88
+ ? hostMap('ganwei-iotcenter-login')
89
+ : '/ganwei-iotcenter-login/#/'
90
+ window.location.href = url
91
+ }
92
+
93
+ // 设置开发环境参数(从 URL 参数中读取)
94
+ function setDevelopmentParams() {
95
+ let map = window?.getParameterMap() || {}
96
+ if (process.env.NODE_ENV === 'development' && map) {
97
+ if (map.get('languageType')) {
98
+ sessionStorage.languageType = localStorage.languageType = map.get('languageType')
99
+ }
100
+ sessionStorage.userName = map.get('userName')
101
+ sessionStorage.passwordPolicy = map.get('passwordPolicy')
102
+ if (map.get('multiPark')) {
103
+ localStorage.multiPark = map.get('multiPark')
104
+ }
105
+ if (!sessionStorage.getItem('theme') || sessionStorage.getItem('theme') == 'null' || sessionStorage.getItem('theme') == 'undefined') {
106
+ sessionStorage.setItem('theme', map.get('theme'))
107
+ }
108
+ }
109
+ }
110
+
111
+ // ==================== 路由守卫 ====================
30
112
  router.beforeEach(async (to, from, next) => {
31
- next()
113
+
114
+ // 不需要认证的路由直接放行
115
+ if (!to.meta.requiresAuth) {
116
+ next()
117
+ return
118
+ }
119
+
120
+ // 设置开发环境参数
121
+ setDevelopmentParams()
122
+
123
+ // 验证登录状态
124
+ const isValid = await checkAuthStatus()
125
+
126
+ if (isValid) {
127
+ next()
128
+ } else {
129
+ // 验证失败,跳转登录页
130
+ redirectToLogin()
131
+ }
32
132
  })
33
- router.afterEach((to, from, next) => { })
133
+
134
+ router.afterEach(() => { })
135
+
34
136
  export default router