鸿蒙智能电子锁前端项目
he wei
2025-03-15 f8fd43f1307b0ae3a55f5a5a1390fd13b506fa88
src/layout/index.vue
@@ -32,7 +32,7 @@
   import config from '@/utils/config.js';
   const { ukey, face } = config;
   const throttleConect = throttle(pingpong, 1000);
    const throttleConect = throttle(pingpong, 1000);
   export default defineComponent({
      name: "LayoutIndex",
@@ -54,17 +54,17 @@
            },
            immediate: true,
         },
      isIn: {
       async handler(val) {
         if (ukey && !val) {
           await store.user().logout();
           // console.log('logout', '=============');
           router.push(`/login?redirect=${route.fullPath}`);
         }
       },
        immediate: true
      }
         isIn: {
            async handler(val) {
               if (ukey && !val) {
                  await store.user().logout();
                  // console.log('logout', '=============');
                  router.push(`/login?redirect=${route.fullPath}`);
               }
            },
            immediate: true
         }
      },
      mixins: [ResizeMixin],
      computed: {
@@ -78,6 +78,7 @@
            fixedHeader: "fixedHeader",
            secondMenuPopup: "secondMenuPopup",
         }),
         ...mapState(store.user, ['name', 'sessionid']),
         classObj() {
            return {
               hideSidebar: !this.sidebar.opened,
@@ -110,14 +111,14 @@
         changeTheme(this.theme);
      },
      mounted() {
         document.addEventListener("click", throttleConect);
         document.addEventListener("mousemove", throttleConect);
         document.addEventListener("keydown", throttleConect);
         document.addEventListener("click", () => throttleConect(this.sessionid, this.name));
         document.addEventListener("mousemove", () => throttleConect(this.sessionid, this.name));
         document.addEventListener("keydown", () => throttleConect(this.sessionid, this.name));
      },
      unMounted() {
         document.removeEventListener("click", throttleConect);
         document.removeEventListener("mousemove", throttleConect);
         document.removeEventListener("keydown", throttleConect);
         document.removeEventListener("click", () => throttleConect(this.sessionid, this.name));
         document.removeEventListener("mousemove", () => throttleConect(this.sessionid, this.name));
         document.removeEventListener("keydown", () => throttleConect(this.sessionid, this.name));
      },
   });
</script>