From cdd6be9f891091ff4767b7056d6adee6f9eb26e2 Mon Sep 17 00:00:00 2001 From: liuxy Date: Wed, 6 Dec 2023 15:39:47 +0800 Subject: [PATCH] =?UTF-8?q?rev=EF=BC=9A=E5=88=A0=E9=99=A4websock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/layout/components/Navbar.vue | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/lms/nladmin-ui/src/layout/components/Navbar.vue b/lms/nladmin-ui/src/layout/components/Navbar.vue index fa087ec..a3bc05f 100644 --- a/lms/nladmin-ui/src/layout/components/Navbar.vue +++ b/lms/nladmin-ui/src/layout/components/Navbar.vue @@ -47,7 +47,7 @@ - + {{ language }} @@ -95,7 +95,6 @@ export default { }, created() { this.setLang(localStorage.getItem('lang')) - this.initWebSocket() }, computed: { ...mapGetters([ @@ -154,35 +153,6 @@ export default { this.$store.dispatch('LogOut').then(() => { 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 - }) - } } } }