浏览代码

[Mod 0000] 解决首页加载时组件首次登录加载错误问题

hongrunxia 1 月之前
父节点
当前提交
6c7af9149c

+ 4 - 4
.env.development

@@ -6,8 +6,8 @@ VITE_PUBLIC_PATH = /
 
 # 跨域代理,您可以配置多个 ,请注意,没有换行符
 #VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
-VITE_PROXY = [["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"]]
-# VITE_PROXY = [["/jeecgsystem","http://192.168.183.88:9999"],["/upload","http://192.168.183.88:9999/upload"],["/documents", "http://192.168.183.88:9050"],["/modelreq", "http://192.168.183.88:9999"],["/webRtc", "http://192.168.183.88:8051"]]
+# VITE_PROXY = [["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"]]
+VITE_PROXY = [["/jeecgsystem","http://192.168.183.88:9999"],["/upload","http://192.168.183.88:9999/upload"],["/documents", "http://192.168.183.88:9050"],["/modelreq", "http://192.168.183.88:9999"],["/webRtc", "http://192.168.183.88:8051"]]
 # VITE_PROXY = [["/jeecgsystem","http://10.10.150.72:9999"],["/upload","http://localhost:3300/upload"],["/documents", "http://10.10.150.72:9050"],["/modelreq", "http://10.10.150.72:9999"],["/webRtc", "http://192.168.183.216:8051"]]
 #VITE_PROXY = [["/jeecgsystem","http://192.168.1.8:9999"],["/upload","http://localhost:3300/upload"]]
 
@@ -29,7 +29,7 @@ VITE_GLOB_API_URL_PREFIX=
 
 #微前端qiankun应用,命名必须以VITE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径
 #VITE_APP_SUB_APP = [["micro-need-air", "//10.10.150.72:8099/"], ["micro-vent-3dModal", "//localhost:8091/"], ["micro-fire-front", "//localhost:8090/"]]
-# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.88:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
+VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.88:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.154:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
-VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"], ["micro-need-air", "//182.92.126.35:8099/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
+# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"], ["micro-need-air", "//182.92.126.35:8099/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//localhost:8091/"], ["micro-need-air", "//localhost:8099/"], ["micro-fire-front", "//localhost:8090/"]]

+ 0 - 11
src/router/routes/basic.ts

@@ -87,17 +87,6 @@ export const QIANKUN_ROUTE: AppRouteRecordRaw = {
       ver: '1',
     },
     {
-      path: '/micro-vent-3dModal/modelchannel/model3D/home',
-      name: 'micro-vent-3dModal-modelchannel-model3D-home',
-      component: () => import('/@/views/vent/home/colliery/index.vue'),
-      meta: {
-        title: '通防综合管控',
-        hideBreadcrumb: true,
-        hideMenu: true,
-      },
-      ver: '1',
-    },
-    {
       path: '/micro-need-air/:path(.*)*',
       name: 'micro-need-air',
       component: () => import('/@/components/vent/micro/needAir.vue'),

+ 2 - 2
src/settings/encryptionSetting.ts

@@ -11,8 +11,8 @@ export const cacheCipher = {
 
 // 开启登录密码加密,采用aes加密
 export const loginCipher = {
-  key: 'PF1ZTosoRRBOocKLMEIxkoOrle+2NPJCEr57ckGJl80=',
-  iv: 'NfHCCRv0MdS7e948',
+  key: '_11111000001111@',
+  iv: '@11111000001111_',
 };
 
 // 是否加密缓存,默认生产环境加密

+ 3 - 1
src/store/modules/permission.ts

@@ -135,6 +135,7 @@ export const usePermissionStore = defineStore({
     },
 
     async buildRoutesAction(): Promise<AppRouteRecordRaw[]> {
+      debugger;
       const { t } = useI18n();
       const userStore = useUserStore();
       const appStore = useAppStoreWithOut();
@@ -276,6 +277,7 @@ export const usePermissionStore = defineStore({
           } catch (error) {
             console.error(error);
           }
+          debugger;
           // 组件地址前加斜杠处理  author: lsq date:2021-09-08
           routeList = addSlashToRouteComponent(routeList);
           // 动态引入组件
@@ -289,7 +291,7 @@ export const usePermissionStore = defineStore({
           routeList = filter(routeList, routeRemoveIgnoreFilter);
           routeList = routeList.filter(routeRemoveIgnoreFilter);
           routeList = flatMultiLevelRoutes(routeList);
-          routes = [PAGE_NOT_FOUND_ROUTE, QIANKUN_ROUTE, , ...routeList];
+          routes = [PAGE_NOT_FOUND_ROUTE, ...routeList, QIANKUN_ROUTE];
           break;
       }
 

+ 3 - 3
src/store/modules/user.ts

@@ -150,8 +150,7 @@ export const useUserStore = defineStore({
         const { goHome = true, mode, successMode, ...loginParams } = params;
         // 进行加密
         const encryption = new AesEncryption({ key: loginCipher.key, iv: loginCipher.iv });
-        encryption.encryptByAES(loginParams.password);
-        // loginParams.password = encryption.encryptByAES(loginParams.password);
+        loginParams.password = encryption.encryptByAES(loginParams.password);
         const data = await loginApi(loginParams, mode, successMode);
         const { token, userInfo } = data;
         // save token
@@ -185,6 +184,7 @@ export const useUserStore = defineStore({
       //获取用户信息
       const userInfo = await this.getUserInfoAction();
       const sessionTimeout = this.sessionTimeout;
+      debugger;
       if (sessionTimeout) {
         this.setSessionTimeout(false);
       } else {
@@ -195,7 +195,7 @@ export const useUserStore = defineStore({
             router.addRoute(route as unknown as RouteRecordRaw);
           });
           router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw);
-          router.addRoute(QIANKUN_ROUTE as unknown as RouteRecordRaw);
+          // router.addRoute(QIANKUN_ROUTE as unknown as RouteRecordRaw);
           permissionStore.setDynamicAddedRoute(true);
         }
         this.setLoginInfo({ ...data, isLogin: true });

+ 29 - 2
src/utils/cipher.ts

@@ -1,10 +1,10 @@
 import { encrypt, decrypt } from 'crypto-js/aes';
 import { parse } from 'crypto-js/enc-utf8';
 import pkcs7 from 'crypto-js/pad-pkcs7';
-import ECB from 'crypto-js/mode-ecb';
 import md5 from 'crypto-js/md5';
 import UTF8 from 'crypto-js/enc-utf8';
 import Base64 from 'crypto-js/enc-base64';
+import * as CryptoJS from 'crypto-js';
 
 export interface EncryptionParams {
   key: string;
@@ -27,7 +27,7 @@ export class AesEncryption {
 
   get getOptions() {
     return {
-      mode: ECB,
+      mode: CryptoJS.mode.CBC,
       padding: pkcs7,
       iv: this.iv,
     };
@@ -40,6 +40,33 @@ export class AesEncryption {
   decryptByAES(cipherText: string) {
     return decrypt(cipherText, this.key, this.getOptions).toString(UTF8);
   }
+
+  // 将 Uint8Array 转换为 CryptoJS.lib.WordArray
+  static uint8ArrayToWordArray(uint8Array: Uint8Array): CryptoJS.lib.WordArray {
+    const words: number[] = [];
+    for (let i = 0; i < uint8Array.length; i += 4) {
+      let word = 0;
+      for (let j = 0; j < 4 && i + j < uint8Array.length; j++) {
+        word |= (uint8Array[i + j] & 0xff) << (24 - 8 * j);
+      }
+      words.push(word);
+    }
+    return CryptoJS.lib.WordArray.create(words, uint8Array.length);
+  }
+
+  // 将 CryptoJS.lib.WordArray 转换为 Uint8Array
+  static wordArrayToUint8Array(wordArray: CryptoJS.lib.WordArray): Uint8Array {
+    const words = wordArray.words;
+    const sigBytes = wordArray.sigBytes;
+    const uint8Array = new Uint8Array(sigBytes);
+
+    for (let i = 0; i < sigBytes; i++) {
+      const byte = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+      uint8Array[i] = byte;
+    }
+
+    return uint8Array;
+  }
 }
 
 export function encryptByBase64(cipherText: string) {

+ 3 - 13
src/views/vent/monitorManager/gateMonitor/index.vue

@@ -25,18 +25,8 @@
       <div class="top-center row">
         <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(1)">打开前门</div>
         <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(2)">关闭前门</div>
-        <div
-          v-if="hasPermission('btn:control') && (selectData.deviceType == 'gate_ss' || selectData.deviceType == 'gate_nomal3')"
-          class="button-box"
-          @click="playAnimation(8)"
-          >打开中间门</div
-        >
-        <div
-          v-if="hasPermission('btn:control') && (selectData.deviceType == 'gate_ss' || selectData.deviceType == 'gate_nomal3')"
-          class="button-box"
-          @click="playAnimation(9)"
-          >关闭中间门</div
-        >
+        <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box" @click="playAnimation(8)">打开中间门</div>
+        <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box" @click="playAnimation(9)">关闭中间门</div>
         <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(3)">打开后门</div>
         <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(4)">关闭后门</div>
         <div v-if="selectData['isShowGatesContrl']" class="button-box" @click="playAnimation(5)">同时打开</div>
@@ -484,7 +474,7 @@
         type = 'fm3';
       } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
         type = 'fmTwoSs';
-      } else if (selectData.deviceType == 'gate_nomal3') {
+      } else if (selectData.deviceType == 'gate_nomal3' || selectData.ndoorcount == '3') {
         type = 'fmThreeTl';
       } else if (selectData.deviceType == 'gate_tj') {
         type = 'fmWindow';