websocket
This commit is contained in:
@@ -101,7 +101,11 @@ export function sendWebsocket (url, agentData, successCallback, errCallback) {
|
||||
/**
|
||||
* 关闭websocket函数
|
||||
*/
|
||||
export function closeWebsocket () {
|
||||
export function closeWebsocket (flag) {
|
||||
if (flag) {
|
||||
websock.close()
|
||||
return
|
||||
}
|
||||
if (websock) {
|
||||
websock.close() // 关闭websocket
|
||||
websock.onclose() // 关闭websocket
|
||||
|
||||
@@ -263,11 +263,11 @@ export default {
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
clearInterval(this.timer)
|
||||
clearTimeout(this.timer)
|
||||
closeWebsocket(true)
|
||||
},
|
||||
destroyed () {
|
||||
clearInterval(this.timer)
|
||||
clearTimeout(this.timer)
|
||||
},
|
||||
methods: {
|
||||
handleSelect (key) {
|
||||
@@ -372,7 +372,7 @@ export default {
|
||||
},
|
||||
wsMessage (res) {
|
||||
// console.log(res)
|
||||
clearInterval(this.timer)
|
||||
clearTimeout(this.timer)
|
||||
let data = res.head
|
||||
this.$store.dispatch('materObj', res.home.result)
|
||||
if (data.code === '1') {
|
||||
|
||||
Reference in New Issue
Block a user