Procházet zdrojové kódy

fix:pad的mac地址发版本

chenzhen2 před 1 rokem
rodič
revize
59cfdad08f

+ 1 - 1
src/permission.ts

@@ -11,7 +11,7 @@ import { getUrlParams } from './utils/https'
 router.beforeEach(async (to: RouteLocationNormalized, _: RouteLocationNormalized, next: any) => {
   const store = useStore()
   let macAdr: string = getUrlParams('mac')
-  if (macAdr) {
+  if (macAdr && macAdr != "null" && macAdr != "NULL") {
     setCookieMac(macAdr)
   }
   await store.dispatch(UserActionTypes.ACTION_GET_USER_INFO, undefined)

+ 4 - 1
src/views/envmonitor/components/Light/index.vue

@@ -516,6 +516,7 @@ export default defineComponent({
       },
       // 定时刷新接口
       startLightsStatusTimer(timerLen: any = 2000) {
+        proxyData.clearLightStatusTimer();
         proxyData.lightsStatusTimer = setTimeout(() => {
           proxyData.getLampList();
           proxyData.clearLightStatusTimer();
@@ -535,9 +536,10 @@ export default defineComponent({
         proxyData.seviceEquipmentList = newProps.seviceEquipmentList;
         if (newProps.spaceId) {
           // 空间id改变的重新获取值调用接口
+          proxyData.clearLightStatusTimer();
+          console.log("spaceId变化了---");
           proxyData.spaceId = newProps.spaceId;
           proxyData.showFlag = false;
-          proxyData.clearLightStatusTimer();
           proxyData.getLampList();
         }
       },
@@ -547,6 +549,7 @@ export default defineComponent({
       }
     );
     onBeforeUnmount(() => {
+      console.log("灯的组件销毁了--")
       proxyData.clearLightStatusTimer();
     });
     onMounted(() => {});

+ 10 - 5
src/views/envmonitor/index.vue

@@ -419,12 +419,17 @@ export default defineComponent({
     VanIcon: Icon,
   },
   beforeRouteEnter(to, from, next) {
-    let mac: any = getCookieMac();
-    if (mac && mac != "null") {
-      next();
-    } else {
+    try {
+      let mac: any = getCookieMac();
+      if (mac && mac != "null") {
+        next();
+      } else {
+        next("/error");
+      }
+    } catch {
       next("/error");
     }
+
     // next()
   },
   setup() {
@@ -1981,7 +1986,7 @@ export default defineComponent({
       proxyData.defaultSpace = {
         spaceId: spaceId,
       };
-      proxyData.setDateTime()
+      proxyData.setDateTime();
       proxyData.init();
       // 获取当前平板绑定的空间
       proxyData.queryWorkSpace();

+ 1 - 1
src/views/error/index.vue

@@ -3,7 +3,7 @@
     <div>无法获取到mac地址</div>
     <p>
       <span> 1.请检查WIFI功能是否打开了 </span>
-      <span> 2.打开WIFI功能,重启应用 </span>
+      <span> 2.打开WIFI功能,重启平板 </span>
     </p>
   </div>
 </template>

+ 22 - 17
src/views/home/index.vue

@@ -106,27 +106,32 @@ export default defineComponent({
     console.log("路由导航首位---");
     console.log(to);
     console.log(from);
-    let mac: any = getCookieMac();
-    if (mac && mac != "null") {
-      if (to.query.type !== "logoOut") {
-        next((e: any) => {
-          console.log(e);
-          e.queryWorkSpace();
-        });
+    try {
+      let mac: any = getCookieMac();
+      if (mac && mac != "null") {
+        if (to.query.type !== "logoOut") {
+          next((e: any) => {
+            console.log(e);
+            e.queryWorkSpace();
+          });
+        } else {
+          next((e: any) => {
+            e.showLogin = true;
+            let mac: any = getCookieMac();
+            console.log(mac);
+            // to.query = { mac: mac};
+            console.log(to);
+            // console.log( e.showLogin )
+            // router.push({ name: "home", query: { mac: mac } });
+          });
+        }
       } else {
-        next((e: any) => {
-          e.showLogin = true;
-          let mac: any = getCookieMac();
-          console.log(mac);
-          // to.query = { mac: mac};
-          console.log(to);
-          // console.log( e.showLogin )
-          // router.push({ name: "home", query: { mac: mac } });
-        });
+        next("/error");
       }
-    } else {
+    } catch (e: any) {
       next("/error");
     }
+
     // next()
   },
   setup(props) {