From b160f34d70e561ab45124d9d321f1b198359bfd7 Mon Sep 17 00:00:00 2001 From: "YUN-PC5\\user" Date: Thu, 28 Sep 2023 14:53:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=AF=B9=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BC=95=E5=85=A5tailwindcss=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=8F=9C=E5=8D=95=E6=8A=98?= =?UTF-8?q?=E5=8F=A0=E5=90=8E=E4=B8=8D=E6=98=BE=E7=A4=BAlogo=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E8=A7=92=E8=89=B2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=86=E9=85=8D=E5=A2=9E=E5=8A=A0=E5=8D=A1=E7=89=87=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=EF=BC=8C=E9=A6=96=E9=A1=B5=E5=8E=BB=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E5=85=83=E7=B4=A0=EF=BC=8C=E9=A1=B5=E9=9D=A2=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Notice/Index.vue | 167 +++++++++++++++++++------ src/layout/components/Sidebar/Logo.vue | 4 +- src/layout/index.vue | 19 ++- src/router/index.js | 4 +- src/store/modules/socket.js | 20 ++- src/utils/signalR.js | 26 +++- src/views/index.vue | 129 +------------------ src/views/system/roleusers/index.vue | 4 +- 8 files changed, 197 insertions(+), 176 deletions(-) diff --git a/src/components/Notice/Index.vue b/src/components/Notice/Index.vue index ad4c3e5..c0e9dc4 100644 --- a/src/components/Notice/Index.vue +++ b/src/components/Notice/Index.vue @@ -7,54 +7,145 @@
-
-
通知
-
全部已读
-
-
- -
-
- -
全部已读
-
-
+ + +
+ + + + + 查看更多 +
-
前往通知中心
+ + + +
diff --git a/src/router/index.js b/src/router/index.js index b199940..f1c5bff 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -98,8 +98,8 @@ export const constantRoutes = [ redirect: 'noredirect', children: [ { - path: 'title', - name: 'Title', + path: 'center', + name: 'Center', component: () => import('@/views/noticecenter/index'), meta: { title: '通知中心', icon: 'Bell' } } diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 998e9d0..61ebae5 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -3,7 +3,11 @@ const useSocketStore = defineStore('socket', { onlineNum: 0, onlineUsers: [], noticeList: [], - noticeDot: false + noticeDot: false, + readNoticeList: [], + unreadNoticeList: [], + readAimList: [], + unreadAimList: [] }), actions: { //更新在线人数 @@ -15,6 +19,20 @@ const useSocketStore = defineStore('socket', { this.noticeList = data this.noticeDot = data.length > 0 }, + setReadNoticeList(data) { + this.readNoticeList = data + }, + setUnreadNoticeList(data) { + this.unreadNoticeList = data + this.noticeDot = data.length > 0 || this.unreadAimList.length > 0 + }, + setReadAimList(data) { + this.readAimList = data + }, + setUnreadAimList(data) { + this.unreadAimList = data + this.noticeDot = data.length > 0 || this.unreadNoticeList.length > 0 + }, // setOnlineUsers(data) { // const { onlineNum, users } = data // this.onlineUsers = users diff --git a/src/utils/signalR.js b/src/utils/signalR.js index 5c902db..766bffe 100644 --- a/src/utils/signalR.js +++ b/src/utils/signalR.js @@ -92,10 +92,12 @@ export default { webNotify({ title: title, body: data }) }) // 接收系统通知/公告 - connection.on('moreNotice', (data) => { - if (data.code == 200) { - useSocketStore().setNoticeList(data.data) - } + connection.on('moreNotice', (data1, data2) => { + // if (data.code == 200) { + // useSocketStore().setNoticeList(data.data) + // } + useSocketStore().setUnreadNoticeList(data1) + useSocketStore().setReadNoticeList(data2) }) // 接收在线用户 @@ -115,5 +117,21 @@ export default { webNotify({ title: title, body: data.message }) }) + }, + AllReadNotice() { + const connection = this.SR + connection.invoke('AllReadNotice') + }, + ReadNotice(noticeId) { + const connection = this.SR + connection.invoke('ReadNotice', noticeId) } + // AllReadAimMsg() { + // const connection = this.SR + // connection.invoke('AllReadAimMsg') + // }, + // ReadAimMsg(msgId) { + // const connection = this.SR + // connection.invoke('ReadAimMsg', msgId) + // } } diff --git a/src/views/index.vue b/src/views/index.vue index d31c740..d63942a 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -1,46 +1,5 @@