From bb0a1de38c6bef9eb714bd19542022b1cb1370b3 Mon Sep 17 00:00:00 2001 From: yangzongjia Date: Mon, 12 Jun 2023 10:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0websocket=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/yInfo/yInfo.js | 2 ++ src/store/modules/app.js | 6 ++++ src/views/index.vue | 62 ++++++++++++++++++++++++++++------------ 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/src/api/yInfo/yInfo.js b/src/api/yInfo/yInfo.js index d07fa72..d443bf5 100644 --- a/src/api/yInfo/yInfo.js +++ b/src/api/yInfo/yInfo.js @@ -17,3 +17,5 @@ export function getUnread(query) { return request({ url: '/yInfo/getUnread', method: 'GET', params: data }) } +export const ws = '/api/monitor/ws' + diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 45d89bb..612216b 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -19,6 +19,9 @@ const mutations = { Cookies.set('sidebarStatus', 0) } }, + SET_SYSMESSAGE_COUNT: (state, count) => { + state.sysMessageCount = count; + }, CLOSE_SIDEBAR: (state, withoutAnimation) => { Cookies.set('sidebarStatus', 0) state.sidebar.opened = false @@ -40,6 +43,9 @@ const actions = { closeSideBar({ commit }, { withoutAnimation }) { commit('CLOSE_SIDEBAR', withoutAnimation) }, + setSysMessageCount({ commit }, count) { + commit("SET_SYSMESSAGE_COUNT", count); + }, toggleDevice({ commit }, device) { commit('TOGGLE_DEVICE', device) }, diff --git a/src/views/index.vue b/src/views/index.vue index a6e1481..ecb02e6 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -168,12 +168,15 @@