瀏覽代碼

bug修改

yuantianjiao 6 年之前
父節點
當前提交
bd26273605
共有 2 個檔案被更改,包括 12 行新增6 行删除
  1. 1
    1
      dist/index.html
  2. 11
    5
      src/pages/system/newOrder/newOrderList/index.vue

+ 1
- 1
dist/index.html 查看文件

1
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><link rel="shortcut icon" href=favorite.ico><title>城的空间后台管理系统</title><link href=./static/css/app.bf70b42de6cff066f179f6fcb263c589.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.7e921535e20f729cf046.js></script><script type=text/javascript src=./static/js/app.71e24e76faf4dd36b9f1.js></script></body></html>
1
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><link rel="shortcut icon" href=favorite.ico><title>城的空间后台管理系统</title><link href=./static/css/app.3701d2ecdb620da25b5f579564321337.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.7e921535e20f729cf046.js></script><script type=text/javascript src=./static/js/app.4cecf8ef134122787596.js></script></body></html>

+ 11
- 5
src/pages/system/newOrder/newOrderList/index.vue 查看文件

142
     console.log(this.websockets)
142
     console.log(this.websockets)
143
     this.needReload = false
143
     this.needReload = false
144
     Object.keys(this.websockets).forEach((key) => {
144
     Object.keys(this.websockets).forEach((key) => {
145
-      console.log(key, this.websockets[key])
146
-      this.websockets[key].close()
147
-      clearInterval(this.websockets[key].interval)
145
+      this.destroyWebsocket(this.websockets[key])
148
     })
146
     })
149
     this.websockets = {}
147
     this.websockets = {}
150
     next()
148
     next()
153
     init () {
151
     init () {
154
       this.needReload = false
152
       this.needReload = false
155
       Object.keys(this.websockets).forEach((key) => {
153
       Object.keys(this.websockets).forEach((key) => {
156
-        console.log(key, this.websockets[key])
157
-        this.websockets[key].close()
154
+        this.destroyWebsocket(this.websockets[key])
158
       })
155
       })
159
       this.websockets = {}
156
       this.websockets = {}
160
       this.needReload = true
157
       this.needReload = true
311
     },
308
     },
312
     newWebsocket (wsRealPath) {
309
     newWebsocket (wsRealPath) {
313
       const ws = this.websockets[wsRealPath]
310
       const ws = this.websockets[wsRealPath]
311
+      console.log('newWebsocket', ws)
314
       if (!ws) {
312
       if (!ws) {
315
         const url = `${window.location.origin.replace('http', 'ws')}${wsRealPath}?token=${localStorage.getItem('JWT')}`
313
         const url = `${window.location.origin.replace('http', 'ws')}${wsRealPath}?token=${localStorage.getItem('JWT')}`
316
         this.websockets[wsRealPath] = new WebSocket(url)
314
         this.websockets[wsRealPath] = new WebSocket(url)
338
         }, 5000)
336
         }, 5000)
339
       }
337
       }
340
     },
338
     },
339
+    destroyWebsocket (ws) {
340
+      ws.onclose = ((ws) => {
341
+        console.log('close')
342
+      })(ws)
343
+      ws.close()
344
+      clearInterval(ws.interval)
345
+      ws = null
346
+    },
341
     open () {
347
     open () {
342
       if (!this.CaseId) {
348
       if (!this.CaseId) {
343
         this.$message({
349
         this.$message({