rev:删除websock
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-dropdown class="right-menu-item" style="font-size: 14px" trigger="click" @command="langChange">
|
<el-dropdown class="right-menu-item" style="font-size: 14px" trigger="click" @command="langChange">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link" style="font-size: 18px">
|
||||||
{{ language }} <i class="el-icon-caret-bottom" />
|
{{ language }} <i class="el-icon-caret-bottom" />
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
@@ -95,7 +95,6 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.setLang(localStorage.getItem('lang'))
|
this.setLang(localStorage.getItem('lang'))
|
||||||
this.initWebSocket()
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
@@ -154,35 +153,6 @@ export default {
|
|||||||
this.$store.dispatch('LogOut').then(() => {
|
this.$store.dispatch('LogOut').then(() => {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
},
|
|
||||||
initWebSocket() {
|
|
||||||
// const wsUri = (process.env.VUE_APP_WS_API === '/' ? '/' : (process.env.VUE_APP_WS_API + '/')) + 'messageInfo'
|
|
||||||
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + 'messageInfo'
|
|
||||||
this.websock = new WebSocket(wsUri)
|
|
||||||
this.websock.onerror = this.webSocketOnError
|
|
||||||
this.websock.onmessage = this.webSocketOnMessage
|
|
||||||
},
|
|
||||||
webSocketOnError(e) {
|
|
||||||
this.$notify({
|
|
||||||
title: this.$t('common.Tip14'),
|
|
||||||
type: 'error',
|
|
||||||
duration: 0
|
|
||||||
})
|
|
||||||
},
|
|
||||||
webSocketOnMessage(e) {
|
|
||||||
const data = JSON.parse(e.data)
|
|
||||||
if (data.msgType === 'INFO') {
|
|
||||||
console.log('data', data)
|
|
||||||
this.$bus.emit(data.msg.data, data.msg.msgType)
|
|
||||||
} else if (data.msgType === 'ERROR') {
|
|
||||||
this.$notify({
|
|
||||||
title: '',
|
|
||||||
message: data.msg,
|
|
||||||
dangerouslyUseHTMLString: true,
|
|
||||||
type: 'error',
|
|
||||||
duration: 0
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user