From 6bb088ddbe3cb8abf753f9a90358c3a48cfd6235 Mon Sep 17 00:00:00 2001
From: 2812875475 <2812875475@qq.com>
Date: Sun, 14 Apr 2024 15:51:17 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=85=AC=E5=91=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/system/notice.js | 23 ++-
src/layout/components/Navbar.vue | 160 +++++++++++++++++-
src/views/system/notice/index.vue | 263 +++++++++++++++++++++++++++++-
3 files changed, 437 insertions(+), 9 deletions(-)
diff --git a/src/api/system/notice.js b/src/api/system/notice.js
index c274ea5..2c20e1c 100644
--- a/src/api/system/notice.js
+++ b/src/api/system/notice.js
@@ -9,6 +9,27 @@ export function listNotice(query) {
})
}
+/*公告列表*/
+export function noticList() {
+ return request({
+ url: '/system/notice/noticList',
+ method: 'get'
+ })
+}
+/*公告详情列表*/
+export function noticListDetail() {
+ return request({
+ url: '/system/notice/noticListDetail',
+ method: 'get'
+ })
+}
+//阅读公告
+export function readNotic(noticeId) {
+ return request({
+ url: '/system/notice/readNotic/?noticeId=' + noticeId,
+ method: 'get'
+ })
+}
// 查询公告详细
export function getNotice(noticeId) {
return request({
@@ -41,4 +62,4 @@ export function delNotice(noticeId) {
url: '/system/notice/' + noticeId,
method: 'delete'
})
-}
\ No newline at end of file
+}
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 7ccea26..73af5a6 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -7,6 +7,10 @@
+
+
+
+
+
+
+ 全部
+ 通知
+ 公告
+
+ 通知已读
+ 通知未读
+ 公告已读
+ 公告未读
+
+
+ 阅读消息
+
+
+
+
+ 消息发布时间
+
+ {{notice.createTime}}
+
+
+
+
+ 消息发布人
+
+ {{notice.createBy}}
+
+
+
+
+ 当前状态
+
+ 未读
+ 已读
+
+
+
+
+ 消息类型
+
+ 通知
+ 公告
+
+
+
+
+
+
+
@@ -46,8 +107,18 @@ import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
+import {noticList, readNotic} from "@/api/system/notice";
+
export default {
+ data() {
+ return {
+ drawer: false,
+ notic: [],
+ /*通知*/
+ inform: []
+ }
+ },
components: {
Breadcrumb,
TopNav,
@@ -77,9 +148,94 @@ export default {
get() {
return this.$store.state.settings.topNav
}
- }
+ },
+
+ },
+ created() {
+ this.noticList()
},
methods: {
+
+ /*全部*/
+ all(){
+ this.inform = []
+ this.notic.forEach(item => {
+ this.inform.push(item)
+ })
+ },
+ /*通知*/
+ notice(){
+ this.inform = []
+ this.notic.forEach(item => {
+ if (item.noticeType === '1') {
+ this.inform.push(item)
+ }
+ })
+ },
+ /*通知已读*/
+ readNotic(){
+ this.inform = []
+ this.notic.forEach(item => {
+ if (item.noticeType === '1' && item.flag == 1) {
+ this.inform.push(item)
+ }
+ })
+ },
+ /*公告已读*/
+ announcementListReadNotic(){
+ this.inform = []
+ this.notic.forEach(item => {
+ if (item.noticeType === '2' && item.flag == 1) {
+ this.inform.push(item)
+ }
+ })
+ },
+ /*通知未读*/
+ noReadNotic(){
+ this.inform = []
+ this.notic.forEach(item => {
+ if (item.noticeType === '1' && item.flag == 0) {
+ this.inform.push(item)
+ }
+ })
+ },
+ /*通知未读*/
+ announcementListNoReadNotic(){
+ this.inform = []
+ this.notic.forEach(item => {
+ if (item.noticeType === '2' && item.flag == 0) {
+ this.inform.push(item)
+ }
+ })
+ },
+ /*公告*/
+ announcementList(){
+ this.inform = []
+ this.notic.forEach(item => {
+ if (item.noticeType === '2') {
+ this.inform.push(item)
+ }
+ })
+ },
+ /*阅读*/
+ readMessage(notice){
+
+ readNotic(notice.noticeId).then(
+ res=>{
+ this. noticList()
+ }
+ )
+ this.$router.push({ path: '/system/notice', query: { openDialog: 'true' ,noticeId: notice.noticeId} });
+ },
+ /*打开公告*/
+ noticList() {
+ noticList().then(
+ res => {
+ console.log(res)
+ this.notic = res.data
+ }
+ )
+ },
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
@@ -99,6 +255,7 @@ export default {
}
+