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