From 8a25ea307556ff654f173b2e55bc249ba959c55b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89?= <814457906@qq.com> Date: Sat, 30 Mar 2024 21:10:51 +0800 Subject: [PATCH] xg --- pagesC/seekadvicefrom/seekadvicefrom.vue | 73 ++++++++++++------------ 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/pagesC/seekadvicefrom/seekadvicefrom.vue b/pagesC/seekadvicefrom/seekadvicefrom.vue index 8922de2..e23c83d 100644 --- a/pagesC/seekadvicefrom/seekadvicefrom.vue +++ b/pagesC/seekadvicefrom/seekadvicefrom.vue @@ -173,9 +173,9 @@ // }); }, onLoad(options) { - // if (uni.getStorageSync('patientId') && !this.$store.state.socketOpen) { - // this.scoket(); - // } + if (uni.getStorageSync('patientId')) { + this.scoket(); + } this.baseurl = baseurl; // uni.closeSocket() this.currentItem = JSON.parse(options.item) @@ -192,42 +192,45 @@ // scrollTop: 9999999 // }) }, + onUnload() { + clearInterval(this.timeoutObj); + }, methods: { messagescoket() { const that = this - this.SOCKETURL = socketurl + this.currentItem.patientId - this.socketOpen = false + // this.SOCKETURL = socketurl + this.currentItem.patientId + // this.socketOpen = false try { - uni.connectSocket({ - url: that.SOCKETURL - }) - uni.onSocketOpen(res => { - console.log('webScoket连接已打开', res); - that.socketOpen = true - that.reset() - }) - uni.onSocketError(err => { - console.log('webScoket连接打开失败', err); - if (err && err.code != 1000) { - setTimeout(() => { - that.socketOpen = true - uni.connectSocket({ - url: that.SOCKETURL - }) - }, 3000) - } - }) - uni.onSocketClose(err => { - console.log('webScoket连接关闭', err); - if (err && err.code !== 1000) { - setTimeout(() => { - that.socketOpen = true - uni.connectSocket({ - url: that.SOCKETURL - }) - }, 3000) - } - }) + // uni.connectSocket({ + // url: that.SOCKETURL + // }) + // uni.onSocketOpen(res => { + // console.log('webScoket连接已打开', res); + // that.socketOpen = true + // that.reset() + // }) + // uni.onSocketError(err => { + // console.log('webScoket连接打开失败', err); + // if (err && err.code != 1000) { + // setTimeout(() => { + // that.socketOpen = true + // uni.connectSocket({ + // url: that.SOCKETURL + // }) + // }, 3000) + // } + // }) + // uni.onSocketClose(err => { + // console.log('webScoket连接关闭', err); + // if (err && err.code !== 1000) { + // setTimeout(() => { + // that.socketOpen = true + // uni.connectSocket({ + // url: that.SOCKETURL + // }) + // }, 3000) + // } + // }) uni.onSocketMessage(res => { console.log("webScoket监听收到的信息", res); that.getPageHistory()