Browse Source

peter

master
pengqiang 1 year ago
parent
commit
3c32b3e1e2
  1. 17
      src/components/360View/commonForm/optometryForm.vue

17
src/components/360View/commonForm/optometryForm.vue

@ -584,9 +584,6 @@ export default {
caseId: { caseId: {
handler: function(newV, oldV) { handler: function(newV, oldV) {
this.queryForm() this.queryForm()
// if (this.isSearch === '3') {
// this.initWebSoket()
// }
} }
} }
}, },
@ -596,7 +593,6 @@ export default {
clearTimeout(this.timeoutnum) clearTimeout(this.timeoutnum)
clearTimeout(this.timeoutObj) clearTimeout(this.timeoutObj)
clearTimeout(this.serverTimeoutObj) clearTimeout(this.serverTimeoutObj)
this.ws.close()
this.ws = null this.ws = null
} }
}, },
@ -759,15 +755,13 @@ export default {
console.log('start') console.log('start')
self.reconnect() self.reconnect()
} }
self.serverTimeoutObj = setTimeout(function() {
//
self.ws.close()
}, self.timeout)
}, self.timeout) }, self.timeout)
}, },
initWebSoket() { initWebSoket() {
try { try {
const url = process.env.VUE_APP_WS_URL 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 const self = this
this.ws = new WebSocket(url) this.ws = new WebSocket(url)
this.ws.onopen = function() { this.ws.onopen = function() {
@ -775,11 +769,14 @@ export default {
self.connectFlag = true self.connectFlag = true
self.start() self.start()
} }
this.ws.onclose = function() {
this.ws.onclose = function(err) {
self.connectFlag = false self.connectFlag = false
console.log('closed', err)
self.reconnect()
} }
this.ws.onerror = function() {
this.ws.onerror = function(err) {
self.connectFlag = false self.connectFlag = false
console.log('error', err)
self.reconnect() self.reconnect()
} }
this.ws.onmessage = (msg) => { this.ws.onmessage = (msg) => {

Loading…
Cancel
Save