Browse Source

Merge branch 'master' of http://120.26.64.82:10880/BFFE/dz2.1

chenjun 1 year ago
parent
commit
270791c15a
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/layout/components/Navbar.vue

+ 9 - 9
src/layout/components/Navbar.vue

@@ -8,9 +8,7 @@
           <!-- <el-avatar :size="40" :src="imgSrc">
             <img src="@/assets/logo/error.png">
           </el-avatar> -->
-          <el-image
-            style="max-width: 90px"
-            :src="imgSrc">
+          <el-image style="max-width: 90px" :src="imgSrc">
           </el-image>
         </div>
         <div class="log_name">{{ pageTitle }}</div>
@@ -86,14 +84,14 @@ export default {
       // this.newData = Format("yyyy/MM/dd hh:mm:ss", new Date());
       this.newData = timeInZone(new Date(), this.timeZone).replaceAll('-', '/')
     })
-    // this.usertHeart = setInterval(() => {
-    //   this.setUserHeart()
-    // }, 1000 * 10);
+    this.usertHeart = window.setInterval(() => {
+      this.setUserHeart()
+    }, 1000 * 10);
   },
   beforeDestroy () {
     this.getTimeInterval && clearInterval(this.getTimeInterval)
     this.getTimeInterval = null
-    this.usertHeart && clearInterval(this.usertHeart)
+    this.usertHeart && window.clearInterval(this.usertHeart)
     this.usertHeart = null
   },
   methods: {
@@ -102,9 +100,11 @@ export default {
     },
     //心跳连接
     async setUserHeart () {
-      const { code, message } = await userHealth();
+      const { code, message } = await userHealth()
       if (code != 0) {
-        this.$message.error(message);
+        this.usertHeart && window.clearInterval(this.usertHeart)
+        this.usertHeart = null
+        // this.$message.error(message)
       }
     },
     toggleSideBar () {