xg
This commit is contained in:
parent
79feb3d159
commit
8a25ea3075
@ -173,9 +173,9 @@
|
|||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// if (uni.getStorageSync('patientId') && !this.$store.state.socketOpen) {
|
if (uni.getStorageSync('patientId')) {
|
||||||
// this.scoket();
|
this.scoket();
|
||||||
// }
|
}
|
||||||
this.baseurl = baseurl;
|
this.baseurl = baseurl;
|
||||||
// uni.closeSocket()
|
// uni.closeSocket()
|
||||||
this.currentItem = JSON.parse(options.item)
|
this.currentItem = JSON.parse(options.item)
|
||||||
@ -192,42 +192,45 @@
|
|||||||
// scrollTop: 9999999
|
// scrollTop: 9999999
|
||||||
// })
|
// })
|
||||||
},
|
},
|
||||||
|
onUnload() {
|
||||||
|
clearInterval(this.timeoutObj);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
messagescoket() {
|
messagescoket() {
|
||||||
const that = this
|
const that = this
|
||||||
this.SOCKETURL = socketurl + this.currentItem.patientId
|
// this.SOCKETURL = socketurl + this.currentItem.patientId
|
||||||
this.socketOpen = false
|
// this.socketOpen = false
|
||||||
try {
|
try {
|
||||||
uni.connectSocket({
|
// uni.connectSocket({
|
||||||
url: that.SOCKETURL
|
// url: that.SOCKETURL
|
||||||
})
|
// })
|
||||||
uni.onSocketOpen(res => {
|
// uni.onSocketOpen(res => {
|
||||||
console.log('webScoket连接已打开', res);
|
// console.log('webScoket连接已打开', res);
|
||||||
that.socketOpen = true
|
// that.socketOpen = true
|
||||||
that.reset()
|
// that.reset()
|
||||||
})
|
// })
|
||||||
uni.onSocketError(err => {
|
// uni.onSocketError(err => {
|
||||||
console.log('webScoket连接打开失败', err);
|
// console.log('webScoket连接打开失败', err);
|
||||||
if (err && err.code != 1000) {
|
// if (err && err.code != 1000) {
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
that.socketOpen = true
|
// that.socketOpen = true
|
||||||
uni.connectSocket({
|
// uni.connectSocket({
|
||||||
url: that.SOCKETURL
|
// url: that.SOCKETURL
|
||||||
})
|
// })
|
||||||
}, 3000)
|
// }, 3000)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
uni.onSocketClose(err => {
|
// uni.onSocketClose(err => {
|
||||||
console.log('webScoket连接关闭', err);
|
// console.log('webScoket连接关闭', err);
|
||||||
if (err && err.code !== 1000) {
|
// if (err && err.code !== 1000) {
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
that.socketOpen = true
|
// that.socketOpen = true
|
||||||
uni.connectSocket({
|
// uni.connectSocket({
|
||||||
url: that.SOCKETURL
|
// url: that.SOCKETURL
|
||||||
})
|
// })
|
||||||
}, 3000)
|
// }, 3000)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
uni.onSocketMessage(res => {
|
uni.onSocketMessage(res => {
|
||||||
console.log("webScoket监听收到的信息", res);
|
console.log("webScoket监听收到的信息", res);
|
||||||
that.getPageHistory()
|
that.getPageHistory()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user