@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
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="login" v-cloak>
3
3
  <div class="backgroundImage">
4
- <img :src="homeBgImg" alt="" :class="{ invisible: !homeBgImg }" @error="showBgImg" v-if="homeBgImg"/>
4
+ <img :src="homeBgImg" alt="" :class="{ invisible: !homeBgImg }" @error="showBgImg" v-if="homeBgImg" />
5
5
  </div>
6
6
  <el-select v-if="showLangSelect" v-model="languageSelected" @change="langChange" class="languageSelect">
7
7
  <template v-slot:prefix>
@@ -10,29 +10,29 @@
10
10
  <el-option v-for="(item, index) in langOptions" :label="item.name" :value="item.value" :key="index">
11
11
  </el-option>
12
12
  </el-select>
13
- <section class="main" >
13
+ <section class="main">
14
14
  <aside class="login_form">
15
15
  <div class="logo">
16
16
  <img :src="mainImg" alt="" :class="{ invisible: !mainImg }" @error="showImg" />
17
17
  </div>
18
18
  <el-form ref="loginForm" :model="form" label-width="0px" :rules="rules">
19
19
  <el-form-item prop="userName">
20
- <el-input v-model="form.userName" @keyup.enter.native="showSlideCode"
21
- :placeholder="txtTips[0]" autocomplete="off" clearable>
20
+ <el-input v-model="form.userName" @keyup.enter.native="showSlideCode" :placeholder="txtTips[0]"
21
+ autocomplete="off" clearable>
22
22
  <template #prefix>
23
23
  <i class="iconfont icon-denglu_zhanghu"></i>
24
24
  </template>
25
25
  </el-input>
26
26
  </el-form-item>
27
27
  <el-form-item prop="userPwd">
28
- <el-input type="password" v-model="form.userPwd" @keyup.enter.native="showSlideCode"
28
+ <el-input type="password" v-model="form.userPwd" @keyup.enter.native="showSlideCode"
29
29
  :placeholder="txtTips[1]" autocomplete="off">
30
30
  <template #prefix>
31
31
  <i class="iconfont icon-denglu_mima"></i>
32
32
  </template>
33
33
  <template #suffix>
34
- <showPassword :userPwd="form.userPwd"></showPassword>
35
- </template>
34
+ <showPassword :userPwd="form.userPwd"></showPassword>
35
+ </template>
36
36
  </el-input>
37
37
  </el-form-item>
38
38
  <el-form-item v-if="!IsIgnoreFalidateCode && verificationType != 1" prop="verificationCode">
@@ -79,7 +79,7 @@ export default {
79
79
  passwordModification,
80
80
  showPassword
81
81
  },
82
- data () {
82
+ data() {
83
83
  return {
84
84
  form: {
85
85
  userName: '',
@@ -109,7 +109,7 @@ export default {
109
109
  },
110
110
 
111
111
  watch: {
112
- txtTips (val) {
112
+ txtTips(val) {
113
113
  setTimeout(() => {
114
114
  if (this.$refs.loginForm) {
115
115
  this.$refs.loginForm.clearValidate()
@@ -119,7 +119,7 @@ export default {
119
119
  },
120
120
 
121
121
  computed: {
122
- rules () {
122
+ rules() {
123
123
  return {
124
124
  userName: [
125
125
  { required: true, message: this.txtTips[7], trigger: 'blur' },
@@ -134,7 +134,8 @@ export default {
134
134
  }
135
135
  },
136
136
 
137
- created () {
137
+ created() {
138
+ window.sessionStorage.isLgStatus = false
138
139
  this.loginCreated()
139
140
  //this.mainImg = sessionStorage.mainImg
140
141
  this.langOptions = localStorage.langOptions ? JSON.parse(localStorage.langOptions) : []
@@ -142,12 +143,12 @@ export default {
142
143
  this.i18nInstance = useI18n()
143
144
  this.initTxtTips()
144
145
  },
145
- mounted () {
146
+ mounted() {
146
147
  window.showSlideCode = this.showSlideCode.bind(this)
147
148
  window.slideCodeLogin = this.slideCodeLogin.bind(this)
148
149
  },
149
150
  methods: {
150
- initTxtTips(){
151
+ initTxtTips() {
151
152
  this.txtTips = [
152
153
  this.$t('login.input.inputAccount'),
153
154
  this.$t('login.input.inputPassword'),
@@ -164,30 +165,30 @@ export default {
164
165
  },
165
166
  getImageUrlWithoutAuth(originUrl, imageCode) {
166
167
  // 静态文件路径
167
- if(originUrl.startsWith('/static/images')) {
168
+ if (originUrl.startsWith('/static/images')) {
168
169
  return originUrl
169
170
  }
170
171
 
171
172
  // 上传图片路径
172
- if(originUrl.startsWith('/file/')) {
173
+ if (originUrl.startsWith('/file/')) {
173
174
  return `/IoT/api/v3/FrontConfiguration/DownloadImage?subject=${imageCode}&fileDir=${originUrl}`
174
175
  }
175
176
  return ''
176
177
  },
177
- async loginCreated () {
178
- sessionStorage.removeItem('configInfoData')
179
- if (window.top.getConfigInfoData) {
180
- await window.top.getConfigInfoData().then(webConfig => {
181
- this.defaultTheme = webConfig?.theme?.default || "dark"
182
- this.showLangSelect = webConfig?.showLangSelect // 默认选项
183
- this.mainImg = this.getImageUrlWithoutAuth(webConfig?.img?.loginImg, "loginImg")
184
- this.homeBgImg = this.getImageUrlWithoutAuth(webConfig?.img?.loginBgImg || "/static/images/login-bg-img.png", 'loginBgImg')
185
- sessionStorage.setItem("bgImg", this.homeBgImg)
186
- this.verificationType = (webConfig?.verificationType) ? 1 : 0
187
- }).catch((err) => {
188
- console.log(err)
189
- })
190
- }
178
+ async loginCreated() {
179
+ sessionStorage.removeItem('configInfoData')
180
+ if (window.top.getConfigInfoData) {
181
+ await window.top.getConfigInfoData().then(webConfig => {
182
+ this.defaultTheme = webConfig?.theme?.default || "dark"
183
+ this.showLangSelect = webConfig?.showLangSelect // 默认选项
184
+ this.mainImg = this.getImageUrlWithoutAuth(webConfig?.img?.loginImg, "loginImg")
185
+ this.homeBgImg = this.getImageUrlWithoutAuth(webConfig?.img?.loginBgImg || "/static/images/login-bg-img.png", 'loginBgImg')
186
+ sessionStorage.setItem("bgImg", this.homeBgImg)
187
+ this.verificationType = (webConfig?.verificationType) ? 1 : 0
188
+ }).catch((err) => {
189
+ console.log(err)
190
+ })
191
+ }
191
192
  // 验证码配置
192
193
  this.$api
193
194
  .IsIgnoreFalidateCode()
@@ -209,7 +210,7 @@ export default {
209
210
  })
210
211
 
211
212
  },
212
- async langChange (val) {
213
+ async langChange(val) {
213
214
  // 语言切换
214
215
  try {
215
216
  localStorage.languageType = sessionStorage.languageType = val
@@ -220,7 +221,7 @@ export default {
220
221
  console.log(error)
221
222
  }
222
223
  },
223
- drawCode () {
224
+ drawCode() {
224
225
  if (this.IsIgnoreFalidateCode || this.verificationType == 1) {
225
226
  return;
226
227
  }
@@ -248,13 +249,13 @@ export default {
248
249
  },
249
250
 
250
251
  // 提示
251
- info (type, msg) {
252
+ info(type, msg) {
252
253
  this.$message({
253
254
  title: msg,
254
255
  type: type
255
256
  })
256
257
  },
257
- login () {
258
+ login() {
258
259
  // 登录操作
259
260
  this.$refs.loginForm.validate(async valid => {
260
261
  if (valid) {
@@ -282,16 +283,16 @@ export default {
282
283
  if (!data?.userTermsService) {
283
284
  this.showDeclare = true
284
285
  } else {
285
- if(this.verificationType == 1 && !this.IsIgnoreFalidateCode) {
286
+ if (this.verificationType == 1 && !this.IsIgnoreFalidateCode) {
286
287
  window.slideAuthSuccess()
287
288
  }
288
289
  this.afterLogin()
289
290
  }
290
291
  } else {
291
292
  this.isLogin = false
292
- if(!this.IsIgnoreFalidateCode) { // 未关闭验证码
293
- if(this.verificationType == 1) { // 滑块验证码
294
- if(code === 40005 || code === 40001 || code == 400) { // 账号密码错误,关闭弹窗
293
+ if (!this.IsIgnoreFalidateCode) { // 未关闭验证码
294
+ if (this.verificationType == 1) { // 滑块验证码
295
+ if (code === 40005 || code === 40001 || code == 400) { // 账号密码错误,关闭弹窗
295
296
  window.popupHandle("coverUp", "__Verification", "flipInX");
296
297
  } else {
297
298
  window.slideAuthError()
@@ -309,8 +310,8 @@ export default {
309
310
  } catch (e) {
310
311
  this.$message.error(this.$t('login.systemError'))
311
312
  }
312
- if(!this.IsIgnoreFalidateCode) {
313
- if(this.verificationType == 1) {
313
+ if (!this.IsIgnoreFalidateCode) {
314
+ if (this.verificationType == 1) {
314
315
  window.slideAuthError()
315
316
  } else {
316
317
  this.drawCode()
@@ -326,7 +327,7 @@ export default {
326
327
  },
327
328
 
328
329
  // 确认条款
329
- async agree () {
330
+ async agree() {
330
331
  try {
331
332
  let res = await this.$api.addUserServer()
332
333
  if (res?.data?.code !== 200) {
@@ -338,16 +339,17 @@ export default {
338
339
  this.afterLogin()
339
340
  },
340
341
 
341
- afterLogin () {
342
+ afterLogin() {
342
343
  let data = this.loginData
343
344
  window.sessionStorage.userName = this?.form?.userName
345
+ window.sessionStorage.isLgStatus = true
344
346
  let userRetrunInfo = this.filterUserInfo(data?.personReserve)
345
- if(userRetrunInfo?.userTheme) {
347
+ if (userRetrunInfo?.userTheme) {
346
348
  sessionStorage.setItem('theme', userRetrunInfo?.userTheme)
347
349
  } else {
348
350
  sessionStorage.setItem('theme', this.defaultTheme || "dark")
349
351
  }
350
- let urlParameter = "?languageType=" + localStorage.languageType + "&userName=" + window.sessionStorage.userName + "&passwordPolicy=" + window.sessionStorage.passwordPolicy + "&theme=" + sessionStorage.getItem('theme') + "&userId=" + window.sessionStorage.userId + "&multiPark=" + window.sessionStorage.multiPark + "&CSRF_TOKEN=" + window.sessionStorage.CSRF_TOKEN
352
+ let urlParameter = "?languageType=" + localStorage.languageType + "&userName=" + window.sessionStorage.userName + "&passwordPolicy=" + window.sessionStorage.passwordPolicy + "&theme=" + sessionStorage.getItem('theme') + "&userId=" + window.sessionStorage.userId + "&multiPark=" + window.sessionStorage.multiPark + "&isLgStatus=" + window.sessionStorage.isLgStatus + "&CSRF_TOKEN=" + window.sessionStorage.CSRF_TOKEN
351
353
  if (data?.passwordPolicy?.passwordPolicy != null) {
352
354
  window.sessionStorage.removeItem('passwordPolicy')
353
355
  // 密码规则 0:禁止登录 1:强制修改 2:不限制登录
@@ -396,19 +398,19 @@ export default {
396
398
  }
397
399
  },
398
400
 
399
- showImg () {
401
+ showImg() {
400
402
  if (process.env.NODE_ENV === "development") { this.mainImg = `/static/images/${localStorage.theme == 'dark' ? 'index-logo-src' : 'index-logo-src-light'}.svg` }
401
403
  },
402
404
 
403
- showBgImg(){
405
+ showBgImg() {
404
406
  this.homeBgImg = "/static/images/login-bg-img.png"
405
407
  },
406
408
 
407
- filterUserInfo (item) {
409
+ filterUserInfo(item) {
408
410
  let obj = {}
409
- if(Array.isArray(item) && item.length > 0) {
411
+ if (Array.isArray(item) && item.length > 0) {
410
412
  for (let i of item) {
411
- if(i.key && i.value) {
413
+ if (i.key && i.value) {
412
414
  obj[i.key] = i.value
413
415
  }
414
416
  }
@@ -416,11 +418,11 @@ export default {
416
418
  return obj
417
419
  },
418
420
 
419
- showSlideCode () {
421
+ showSlideCode() {
420
422
  this.$refs.loginForm.validate(valid => {
421
423
  if (valid) {
422
424
  // 滑块验证 且 未关闭验证码
423
- if(this.verificationType == 1 && !this.IsIgnoreFalidateCode) {
425
+ if (this.verificationType == 1 && !this.IsIgnoreFalidateCode) {
424
426
  // 请完成安全验证 拖动图片验证 验证成功 点击刷新验证码
425
427
  sessionStorage.setItem('slideTitle', this.$t('login.tips.slideTitle'))
426
428
  sessionStorage.setItem('slideTipsLabel', this.$t('login.tips.slideTipsLabel'))
@@ -434,7 +436,7 @@ export default {
434
436
  })
435
437
  },
436
438
 
437
- slideCodeLogin(point){
439
+ slideCodeLogin(point) {
438
440
  this.form.verificationCode = point
439
441
  this.form.verificationKey = sessionStorage.getItem('verificationKey')
440
442
  sessionStorage.removeItem('verificationKey')
@@ -442,14 +444,14 @@ export default {
442
444
  },
443
445
 
444
446
  // 忘记密码
445
- forgotPassworrd(){
447
+ forgotPassworrd() {
446
448
  // 清除邮箱
447
449
  window.sessionStorage.removeItem("eamilUrl");
448
450
  this.passwordDialogVisible = true
449
451
  },
450
452
 
451
453
  // 关闭密码弹窗
452
- closePassword(){
454
+ closePassword() {
453
455
  this.passwordDialogVisible = false
454
456
  }
455
457
 
@@ -104,15 +104,16 @@ export default {
104
104
  sessionStorage.isSsoLogin = '1';
105
105
  sessionStorage.ssoLoginAppId = this.$route.params.appid;
106
106
  // 判断是否需要进行重定向
107
- if (this.urlConfig.method == 'redirect') {
108
- // 判断参数是否被加到#之前,是的话重定向地址
109
- if (window.location.search) {
110
- let str = window.location.origin + window.location.pathname + window.location.hash + window.location.search
111
- window.location.href = str;
112
- } else {
113
- window.location.href = this.urlConfig.api;
114
- }
115
- } else if (this.query.url) {
107
+ // if (this.urlConfig.method == 'redirect') {
108
+ // // 判断参数是否被加到#之前,是的话重定向地址
109
+ // if (window.location.search) {
110
+ // let str = window.location.origin + window.location.pathname + window.location.hash + window.location.search
111
+ // window.location.href = str;
112
+ // } else {
113
+ // window.location.href = this.urlConfig.api;
114
+ // }
115
+ // } else
116
+ if (this.query.url) {
116
117
  try {
117
118
  let url = new URL(window.location.origin + decodeURI(this.query.url));
118
119
  const search = url.href.indexOf('?') > -1 ? url.href.split('?')[1] : ''
@@ -3,9 +3,6 @@
3
3
  # 变量必须以 VITE_ 为前缀才能暴露给外部读取
4
4
  NODE_ENV = "development"
5
5
 
6
- # 图片路径
7
- VITE_IMAGE_BASE = "/static/images/"
8
-
9
6
  # 标题
10
7
  VITE_APP_TITLE = ''
11
8
 
@@ -3,14 +3,11 @@
3
3
  # 变量必须以 VITE_ 为前缀才能暴露给外部读取
4
4
  NODE_ENV = "production"
5
5
 
6
- # 图片路径
7
- VITE_IMAGE_BASE = "/APP/static/images/"
8
-
9
6
  # 标题
10
7
  VITE_APP_TITLE = ''
11
8
 
12
9
  # 端口
13
- VITE_APP_PORT = 0
10
+ VITE_APP_PORT = 8170
14
11
 
15
12
  # API请求前缀
16
13
  VITE_APP_BASE_API = ''
@@ -3,9 +3,6 @@
3
3
  # 变量必须以 VITE_ 为前缀才能暴露给外部读取
4
4
  NODE_ENV = "test"
5
5
 
6
- # 图片路径
7
- VITE_IMAGE_BASE = "/APP/static/images/"
8
-
9
6
  # 标题
10
7
  VITE_APP_TITLE = ''
11
8
 
@@ -26,12 +26,12 @@ module.exports = {
26
26
  plugins: ['vue', '@typescript-eslint'],
27
27
 
28
28
  /*
29
- 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin-
29
+ 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin-
30
30
  主要有如下的设置规则,可以设置字符串也可以设置数字,两者效果一致
31
31
  "off" -> 0 关闭规则
32
32
  "warn" -> 1 开启警告规则
33
33
  "error" -> 2 开启错误规则
34
- */
34
+ */
35
35
  // 参数说明:
36
36
  // 参数1 : 错误等级
37
37
  // 参数2 : 处理方式
@@ -1,7 +1,11 @@
1
1
 
2
2
  declare module '*.vue' {
3
- import type { DefineComponent } from 'vue'
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
5
- const component: DefineComponent<{}, {}, any>
6
- export default component
7
- }
3
+ import type { DefineComponent } from 'vue'
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
5
+ const component: DefineComponent<{}, {}, any>
6
+ export default component
7
+ }
8
+
9
+ interface ImportMeta {
10
+ readonly env: ImportMetaEnv
11
+ }
@@ -14,6 +14,7 @@
14
14
  <script type="text/javascript" src="../static/js/getLanguageOptions.js"></script>
15
15
  <script src="../static/http/createAxios.js"></script>
16
16
  <script type="text/javascript" src="../static/js/getLanguage.js"></script>
17
+ <script src="../static/js/getUserPermissionList.js"></script>
17
18
  <script type=text/javascript src=../static/js/font.js></script>
18
19
  <script src="../static/themes/default-theme-6-1.js"></script>
19
20
  </head>
@@ -4,8 +4,9 @@
4
4
  "version": "0.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "vite --force --host",
8
- "build": "vite build --mode production"
7
+ "dev": "vite --force --host --mode development",
8
+ "build": "vite build --mode production",
9
+ "fix": "eslint --fix src/**/*.{js,ts,tsx,vue}"
9
10
  },
10
11
  "dependencies": {
11
12
  "@aspnet/signalr": "^1.1.4",
@@ -25,7 +25,6 @@ function urlEncode(val) {
25
25
  } else if (typeof val != 'string') {
26
26
  val = JSON.stringify(val)
27
27
  }
28
- console.log(val)
29
28
  return encodeURIComponent(val).replace(/[!*'()]/g, c =>
30
29
  '%' + c.charCodeAt(0).toString(16).toUpperCase()
31
30
  );
@@ -57,6 +56,22 @@ const overTimeList = [
57
56
  { api: "/IoT/api/v3/GWAssembly/BatchInstallAppStorePlugin", timeout: 1800000 }
58
57
  ];
59
58
 
59
+ const languageValue = {
60
+ 'zh-CN': [
61
+ '登录超时,请重新登录',
62
+ '提示',
63
+ '确定',
64
+ '取消'
65
+ ],
66
+ 'en-US': [
67
+ 'Login Timeout, Please Login Again',
68
+ 'Tips',
69
+ 'Confirm',
70
+ 'Cancel'
71
+ ]
72
+ };
73
+
74
+
60
75
  /**
61
76
  * axios封装
62
77
  * 请求拦截、响应拦截、错误统一处理
@@ -102,14 +117,21 @@ const overTimeList = [
102
117
  }
103
118
  async function getLoginLanuage(pluginName, menuName, packageId, msg, duration) {
104
119
  await _this.requestLanguage(pluginName, menuName, packageId, '').then(res => {
105
- if (!sessionStorage.languageType) { sessionStorage.languageType = localStorage.languageType }
106
- if (currentAxiosBuilder.i18n && currentAxiosBuilder.i18n.global && currentAxiosBuilder.i18n.global.messages) {
107
- currentAxiosBuilder.i18n.global.messages.value[sessionStorage.languageType][menuName] = res
120
+ const langType = sessionStorage.languageType || localStorage.languageType || 'zh-CN';
121
+ const i18nGlobal = currentAxiosBuilder.i18n?.global;
122
+
123
+ if (i18nGlobal && i18nGlobal.messages) {
124
+ if (!i18nGlobal.messages.value[langType]) {
125
+ i18nGlobal.messages.value[langType] = {};
126
+ }
127
+ i18nGlobal.messages.value[langType][menuName] = res;
108
128
  }
109
129
  }).catch(err => {
110
130
  console.log(err)
111
131
  }).finally(o => {
112
- messageTips(msg, duration)
132
+ if (msg && duration) {
133
+ messageTips(msg, duration)
134
+ }
113
135
  })
114
136
  }
115
137
  function messageTips(msg, duration) {
@@ -147,15 +169,18 @@ const overTimeList = [
147
169
  } catch (error) {
148
170
  console.log(error)
149
171
  }
150
- if (!languagePackage || !languagePackage[localStorage.languageType] || !languagePackage[localStorage.languageType].login) {
151
- await getLoginLanuage('ganwei-iotcenter-login', 'login', 'Ganweisoft.IoTCenter.Module.Login', msg, duration)
152
- }
172
+ // TODO 如果此时有操作清空了浏览器缓存,正好服务断开,则会出现键值/重启服务直接访问登录后页面,此时会出现登录页面无法获取语言包,导致提示语不对,需要重新梳理语言包挂载
173
+ // if (!languagePackage || !languagePackage[localStorage.languageType] || !languagePackage[localStorage.languageType].login) {
174
+ // await getLoginLanuage('ganwei-iotcenter-login', 'login', 'Ganweisoft.IoTCenter.Module.Login', '', '')
175
+ // }
176
+ sessionStorage.setItem('isLgStatus', false)
177
+ let lType = sessionStorage.languageType || localStorage.languageType || 'zh-CN';
153
178
  currentAxiosBuilder.elmessageBox && currentAxiosBuilder.elmessageBox.confirm(
154
- currentAxiosBuilder.i18n.global.t('login.noAccess.noAccess[7]'),
155
- currentAxiosBuilder.i18n.global.t('login.mainInfoDialog.tips.tip'),
179
+ languageValue[lType][0],
180
+ languageValue[lType][1],
156
181
  {
157
- confirmButtonText: currentAxiosBuilder.i18n.global.t('login.publics.button.confirm'),
158
- cancelButtonText: currentAxiosBuilder.i18n.global.t('login.publics.button.cancel'),
182
+ confirmButtonText: languageValue[lType][2],
183
+ cancelButtonText: languageValue[lType][3],
159
184
  type: 'warning',
160
185
  showClose: false,
161
186
  closeOnClickModal: false,
@@ -328,6 +353,7 @@ const overTimeList = [
328
353
  _this.i18n = this.i18n = i18n
329
354
  _this.notification = this.notification = notification
330
355
  _this.elmessageBox = this.elmessageBox = elmessageBox
356
+
331
357
  try {
332
358
  if (_this.top.AxiosBuilder.i18n) { this.i18n = _this.top.AxiosBuilder.i18n }
333
359
  if (_this.top.AxiosBuilder.notification) { this.notification = _this.top.AxiosBuilder.notification }
@@ -364,7 +390,6 @@ const overTimeList = [
364
390
  config => {
365
391
  config.headers['Accept-Language'] = window.localStorage.languageType || 'zh-CN'
366
392
  config.headers['Xsrf-Token'] = window.sessionStorage.CSRF_TOKEN || ''
367
-
368
393
  if (config.method === 'post') {
369
394
  const signParams = {
370
395
  appId: sessionStorage.getItem("userName"),
@@ -131,8 +131,16 @@ window.updateLanguage = (pluginName, menuName,vm, i18n) => {
131
131
 
132
132
  // Vue3 基座
133
133
  if (vm && vm.i18nInstance) {
134
- vm.i18nInstance.locale = langType;
135
- vm.i18nInstance.mergeLocaleMessage(langType, JSON.parse(JSON.stringify(merged)));
134
+ // composition API 模式下,locale mergeLocaleMessage 在 i18n.global 上
135
+ const i18nInstance = vm.i18nInstance.global || vm.i18nInstance;
136
+ if (i18nInstance.locale && typeof i18nInstance.locale === 'object' && 'value' in i18nInstance.locale) {
137
+ // composition API 模式
138
+ i18nInstance.locale.value = langType;
139
+ } else {
140
+ // legacy 模式
141
+ i18nInstance.locale = langType;
142
+ }
143
+ i18nInstance.mergeLocaleMessage(langType, JSON.parse(JSON.stringify(merged)));
136
144
  }
137
145
  // Vue2 基座
138
146
  else if (i18n && i18n._vm) {
@@ -12,7 +12,7 @@ import { ElConfigProvider } from 'element-plus'
12
12
  import enUs from 'element-plus/es/locale/lang/en'
13
13
  import zhCn from 'element-plus/es/locale/lang/zh-cn'
14
14
  import muduleObserve from '@ganwei-web/gw-base-utils-plus/moduleObserve/dist/index.es.js'
15
- import { setTheme } from './utils/setStorage'
15
+ import { setTheme } from './utils/storage'
16
16
  import { onMounted } from 'vue'
17
17
  // ==================== 语言配置 ====================
18
18
  const locale = computed(() => {
@@ -4,7 +4,6 @@
4
4
  import { api as apiFunction } from '@ganwei-web/gw-base-api-plus/dist/index.es.js';
5
5
  import template from './api/template'
6
6
 
7
-
8
7
  const api = Object.assign({}, apiFunction, template)
9
8
 
10
9
  export default api
@@ -0,0 +1,79 @@
1
+ import dayjs from 'dayjs'
2
+ import relativeTime from 'dayjs/plugin/relativeTime'
3
+ import 'dayjs/locale/zh-cn'
4
+
5
+ dayjs.extend(relativeTime)
6
+ dayjs.locale('zh-cn')
7
+
8
+ /**
9
+ * 格式化日期
10
+ * @param date - 日期对象、时间戳或日期字符串
11
+ * @param format - 格式化模板,默认 'YYYY-MM-DD HH:mm:ss'
12
+ * @returns 格式化后的日期字符串
13
+ * @example
14
+ * formatDate(new Date()) // '2024-01-15 14:30:00'
15
+ * formatDate(Date.now(), 'YYYY年MM月DD日') // '2024年01月15日'
16
+ */
17
+ export function formatDate(
18
+ date: Date | number | string,
19
+ format = 'YYYY-MM-DD HH:mm:ss'
20
+ ): string {
21
+ return dayjs(date).format(format)
22
+ }
23
+
24
+ /**
25
+ * 获取相对时间
26
+ * @param date - 日期对象、时间戳或日期字符串
27
+ * @returns 相对时间描述,如 '3 天前'
28
+ * @example
29
+ * getRelativeTime(Date.now() - 3 * 24 * 60 * 60 * 1000) // '3 天前'
30
+ */
31
+ export function getRelativeTime(date: Date | number | string): string {
32
+ return dayjs(date).fromNow()
33
+ }
34
+
35
+ /**
36
+ * 获取时间范围
37
+ * @param type - 时间范围类型
38
+ * @returns [开始时间, 结束时间]
39
+ */
40
+ export function getDateRange(
41
+ type: 'today' | 'week' | 'month' | 'year'
42
+ ): [Date, Date] {
43
+ const now = dayjs()
44
+ let start: dayjs.Dayjs
45
+ const end: dayjs.Dayjs = now
46
+
47
+ switch (type) {
48
+ case 'today':
49
+ start = now.startOf('day')
50
+ break
51
+ case 'week':
52
+ start = now.startOf('week')
53
+ break
54
+ case 'month':
55
+ start = now.startOf('month')
56
+ break
57
+ case 'year':
58
+ start = now.startOf('year')
59
+ break
60
+ default:
61
+ start = now.startOf('day')
62
+ }
63
+
64
+ return [start.toDate(), end.toDate()]
65
+ }
66
+
67
+ /**
68
+ * 判断是否为今天
69
+ */
70
+ export function isToday(date: Date | number | string): boolean {
71
+ return dayjs(date).isSame(dayjs(), 'day')
72
+ }
73
+
74
+ /**
75
+ * 判断是否为本周
76
+ */
77
+ export function isThisWeek(date: Date | number | string): boolean {
78
+ return dayjs(date).isSame(dayjs(), 'week')
79
+ }