Browse Source

去除webscoket链接

htc 12 hours ago
parent
commit
a5867a9a96
1 changed files with 23 additions and 23 deletions
  1. 23 23
      src/views/main-navbar.vue

+ 23 - 23
src/views/main-navbar.vue

@@ -53,7 +53,7 @@ import { messages } from '@/i18n'
 import screenfull from 'screenfull'
 import UpdatePassword from './main-navbar-update-password'
 import { clearLoginInfo } from '@/utils'
-var socket = null
+// var socket = null
 export default {
   inject: ['refresh'],
   data () {
@@ -67,29 +67,29 @@ export default {
     UpdatePassword
   },
   created () {
-    var vue = this
-    socket = new WebSocket(`${window.SITE_CONFIG['socketURL']}`)
-    socket.onopen = function () {}
-    socket.onerror = function () {
-      vue.$notify.error({
-        title: vue.$t('notice.disconnect'),
-        message: vue.$t('notice.disconnectMessage')
-      })
-    }
-    socket.onmessage = function (evt) {
-      const result = JSON.parse(evt.data)
+    // var vue = this
+    // socket = new WebSocket(`${window.SITE_CONFIG['socketURL']}`)
+    // socket.onopen = function () {}
+    // socket.onerror = function () {
+    //   vue.$notify.error({
+    //     title: vue.$t('notice.disconnect'),
+    //     message: vue.$t('notice.disconnectMessage')
+    //   })
+    // }
+    // socket.onmessage = function (evt) {
+    //   const result = JSON.parse(evt.data)
 
-      // 如果是有新文本通知,则提示有新通知
-      if (result.type === 0) {
-        vue.messageTip = true
-        vue.$notify({
-          title: vue.$t('notice.new'),
-          message: result.msg,
-          type: 'info',
-          duration: 5000
-        })
-      }
-    }
+    //   // 如果是有新文本通知,则提示有新通知
+    //   if (result.type === 0) {
+    //     vue.messageTip = true
+    //     vue.$notify({
+    //       title: vue.$t('notice.new'),
+    //       message: result.msg,
+    //       type: 'info',
+    //       duration: 5000
+    //     })
+    //   }
+    // }
 
     // 未读通知数
     this.getUnReadCount()