From 3c32b3e1e2e61f31b517cd31ca31c4a526c745da Mon Sep 17 00:00:00 2001 From: pengqiang Date: Tue, 3 Sep 2024 19:05:17 +0800 Subject: [PATCH] peter --- .../360View/commonForm/optometryForm.vue | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/360View/commonForm/optometryForm.vue b/src/components/360View/commonForm/optometryForm.vue index 65921d3..1021659 100644 --- a/src/components/360View/commonForm/optometryForm.vue +++ b/src/components/360View/commonForm/optometryForm.vue @@ -584,9 +584,6 @@ export default { caseId: { handler: function(newV, oldV) { this.queryForm() - // if (this.isSearch === '3') { - // this.initWebSoket() - // } } } }, @@ -596,7 +593,6 @@ export default { clearTimeout(this.timeoutnum) clearTimeout(this.timeoutObj) clearTimeout(this.serverTimeoutObj) - this.ws.close() this.ws = null } }, @@ -759,15 +755,13 @@ export default { console.log('start') self.reconnect() } - self.serverTimeoutObj = setTimeout(function() { - // 超时关闭 - self.ws.close() - }, self.timeout) }, self.timeout) }, initWebSoket() { try { const url = process.env.VUE_APP_WS_URL + // const url = 'ws://192.168.0.151:1894/data' + // const url = 'ws://192.168.0.151:4649/Chat' const self = this this.ws = new WebSocket(url) this.ws.onopen = function() { @@ -775,11 +769,14 @@ export default { self.connectFlag = true self.start() } - this.ws.onclose = function() { + this.ws.onclose = function(err) { self.connectFlag = false + console.log('closed', err) + self.reconnect() } - this.ws.onerror = function() { + this.ws.onerror = function(err) { self.connectFlag = false + console.log('error', err) self.reconnect() } this.ws.onmessage = (msg) => {