- 在后端控制器中新增公开接口获取公告详情,支持状态检查和已读标记 - 在前端API模块中添加获取公共公告详情的方法 - 更新通知面板组件导入新的公共公告API方法 - 重构头部通知组件实现内联查看详情模式,移除独立详情弹窗 - 优化通知面板UI界面,调整布局样式和交互体验 - 将原有的Navbar中的通知弹窗替换为新的HeaderNotice组件 - 移除旧的通知相关代码和样式,精简组件结构
146 lines
2.9 KiB
JavaScript
Executable File
146 lines
2.9 KiB
JavaScript
Executable File
import request from '@/utils/request'
|
||
|
||
// 查询公告列表
|
||
export function listNotice(query) {
|
||
return request({
|
||
url: '/system/notice/list',
|
||
method: 'get',
|
||
params: query
|
||
})
|
||
}
|
||
|
||
// 获取公开的公告列表(给普通用户使用)
|
||
export function getPublicNoticeList(query) {
|
||
return request({
|
||
url: '/system/notice/public/list',
|
||
method: 'get',
|
||
params: query
|
||
})
|
||
}
|
||
|
||
// 获取当前用户的通知列表
|
||
export function getUserNotices() {
|
||
return request({
|
||
url: '/system/notice/public/notice',
|
||
method: 'get'
|
||
})
|
||
}
|
||
|
||
|
||
// 获取公告/通知详情(公开接口,普通用户可用)
|
||
export function getPublicNotice(noticeId) {
|
||
return request({
|
||
url: '/system/notice/public/' + noticeId,
|
||
method: 'get'
|
||
})
|
||
}
|
||
|
||
// 查询公告详细
|
||
export function getNotice(noticeId) {
|
||
return request({
|
||
url: '/system/notice/' + noticeId,
|
||
method: 'get'
|
||
})
|
||
}
|
||
|
||
// 新增公告
|
||
export function addNotice(data) {
|
||
return request({
|
||
url: '/system/notice',
|
||
method: 'post',
|
||
data: data
|
||
})
|
||
}
|
||
|
||
// 修改公告
|
||
export function updateNotice(data) {
|
||
return request({
|
||
url: '/system/notice',
|
||
method: 'put',
|
||
data: data
|
||
})
|
||
}
|
||
|
||
// 删除公告
|
||
export function delNotice(noticeId) {
|
||
return request({
|
||
url: '/system/notice/' + noticeId,
|
||
method: 'delete'
|
||
})
|
||
}
|
||
|
||
// 发布公告
|
||
export function publishNotice(noticeId) {
|
||
return request({
|
||
url: '/system/notice/publish/' + noticeId,
|
||
method: 'put'
|
||
})
|
||
}
|
||
|
||
// 取消发布公告
|
||
export function unpublishNotice(noticeId) {
|
||
return request({
|
||
url: '/system/notice/unpublish/' + noticeId,
|
||
method: 'put'
|
||
})
|
||
}
|
||
|
||
// 获取未读公告/通知数量
|
||
export function getUnreadCount() {
|
||
return request({
|
||
url: '/system/notice/public/unread/count',
|
||
method: 'get'
|
||
})
|
||
}
|
||
|
||
// 标记公告/通知为已读
|
||
export function markAsRead(noticeId) {
|
||
return request({
|
||
url: '/system/notice/public/read/' + noticeId,
|
||
method: 'post'
|
||
})
|
||
}
|
||
|
||
// 批量标记公告/通知为已读
|
||
export function markAllAsRead(noticeIds) {
|
||
return request({
|
||
url: '/system/notice/public/read/all',
|
||
method: 'post',
|
||
data: noticeIds
|
||
})
|
||
}
|
||
|
||
// 获取用户已读公告/通知ID列表
|
||
export function getReadNoticeIds() {
|
||
return request({
|
||
url: '/system/notice/public/read/ids',
|
||
method: 'get'
|
||
})
|
||
}
|
||
|
||
// 获取顶部公告/通知列表(最新N条)
|
||
export function listNoticeTop(query) {
|
||
return request({
|
||
url: '/system/notice/public/top',
|
||
method: 'get',
|
||
params: query
|
||
})
|
||
}
|
||
|
||
// 标记单条公告/通知为已读
|
||
export function markNoticeRead(noticeId) {
|
||
return request({
|
||
url: '/system/notice/public/read/' + noticeId,
|
||
method: 'post'
|
||
})
|
||
}
|
||
|
||
// 批量标记公告/通知为已读(逗号分隔的ID字符串)
|
||
export function markNoticeReadAll(noticeIds) {
|
||
return request({
|
||
url: '/system/notice/public/read/all',
|
||
method: 'post',
|
||
data: noticeIds
|
||
})
|
||
}
|