scorpio 2 lat temu
rodzic
commit
0e9d55879e
2 zmienionych plików z 15 dodań i 16 usunięć
  1. 0 1
      src/layout/left.vue
  2. 15 15
      src/layout/top.vue

+ 0 - 1
src/layout/left.vue

@@ -91,7 +91,6 @@ export default {
     },
     menus() {
       this.$api.common.getMenus().then(res => {
-        console.log('fuck' + new Date().getTime())
         if (res.code === 200 && res.data.length > 0) {
           this.data = res.data.map(sub => {
             sub.hasChildren = Object.hasOwn(sub, 'children')

+ 15 - 15
src/layout/top.vue

@@ -268,21 +268,21 @@ export default {
       const self = this
       self.timeoutObj && clearTimeout(self.timeoutObj)
       self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj)
-      // self.timeoutObj = setTimeout(function () {
-      //   // 这里发送一个心跳,后端收到后,返回一个心跳消息,
-      //   console.log(self.websock)
-      //   if (self.websock.readyState === 1) {
-      //     // 如果连接正常
-      //     self.websock.send('heartCheck') // 这里可以自己跟后端约定
-      //   } else {
-      //     // 否则重连
-      //     // self.reconnect()
-      //   }
-      //   self.serverTimeoutObj = setTimeout(function () {
-      //     // 超时关闭
-      //     self.websock.close()
-      //   }, self.timeout)
-      // }, self.timeout)
+      self.timeoutObj = setTimeout(function () {
+        // 这里发送一个心跳,后端收到后,返回一个心跳消息,
+        console.log(self.websock)
+        if (self.websock.readyState === 1) {
+          // 如果连接正常
+          self.websock.send('heartCheck') // 这里可以自己跟后端约定
+        } else {
+          // 否则重连
+          // self.reconnect()
+        }
+        self.serverTimeoutObj = setTimeout(function () {
+          // 超时关闭
+          self.websock.close()
+        }, self.timeout)
+      }, self.timeout)
     },
 
     dropDown(res) {