diff --git a/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysNoticeController.java b/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysNoticeController.java index 9fe8c707a..fc2490e8f 100755 --- a/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysNoticeController.java +++ b/openhis-server-new/core-admin/src/main/java/com/core/web/controller/system/SysNoticeController.java @@ -102,6 +102,30 @@ public class SysNoticeController extends BaseController { return success(list); } + + /** + * 获取公告/通知详情(公开接口,普通用户可用) + * 仅返回已发布且状态正常的公告 + */ + @GetMapping("/public/{noticeId}") + public AjaxResult getPublicNotice(@PathVariable Long noticeId) { + SysNotice notice = noticeService.selectNoticeById(noticeId); + if (notice == null) { + return error("公告不存在"); + } + // 只允许查看已发布且状态正常的公告 + if (!"1".equals(notice.getPublishStatus()) || !"0".equals(notice.getStatus())) { + return error("该公告未发布或已关闭"); + } + // 标注当前用户是否已读 + LoginUser loginUser = getLoginUser(); + if (loginUser != null) { + List readIds = noticeReadService.selectReadNoticeIdsByUserId(loginUser.getUser().getUserId()); + notice.setIsRead(readIds.contains(noticeId)); + } + return success(notice); + } + /** * 获取用户未读公告/通知数量(公开接口) */ diff --git a/openhis-ui-vue3/src/api/system/notice.js b/openhis-ui-vue3/src/api/system/notice.js index fc01181b7..011bc4300 100755 --- a/openhis-ui-vue3/src/api/system/notice.js +++ b/openhis-ui-vue3/src/api/system/notice.js @@ -26,6 +26,15 @@ export function getUserNotices() { }) } + +// 获取公告/通知详情(公开接口,普通用户可用) +export function getPublicNotice(noticeId) { + return request({ + url: '/system/notice/public/' + noticeId, + method: 'get' + }) +} + // 查询公告详细 export function getNotice(noticeId) { return request({ diff --git a/openhis-ui-vue3/src/components/NoticePanel/index.vue b/openhis-ui-vue3/src/components/NoticePanel/index.vue index 0dc8c26db..06f99a8ab 100755 --- a/openhis-ui-vue3/src/components/NoticePanel/index.vue +++ b/openhis-ui-vue3/src/components/NoticePanel/index.vue @@ -140,7 +140,7 @@ diff --git a/openhis-ui-vue3/src/layout/components/Navbar.vue b/openhis-ui-vue3/src/layout/components/Navbar.vue index 1d08f6091..38e4caf5f 100755 --- a/openhis-ui-vue3/src/layout/components/Navbar.vue +++ b/openhis-ui-vue3/src/layout/components/Navbar.vue @@ -20,63 +20,7 @@ /> - -
-
- 消息中心 - 全部已读 -
- - - - - - - - - - - - -
- -
-
-
- - -
-
-
- {{ item.noticeTitle }} - 未读 -
-
{{ noticeFormatTime(item.createTime) }}
-
-
-
-
- -
+ - @@ -220,9 +163,7 @@ import {ElMessageBox} from 'element-plus'; import {Fold, Expand} from '@element-plus/icons-vue'; import {Help, Setting} from "@element-plus/icons-vue"; import HeaderSearch from '@/components/HeaderSearch/index.vue'; -import DetailView from '@/layout/components/HeaderNotice/DetailView.vue' -import useNoticeStore from '@/store/modules/notice' -import { Notification } from '@element-plus/icons-vue' +import HeaderNotice from '@/layout/components/HeaderNotice/index.vue'; import useAppStore from '@/store/modules/app'; import useUserStore from '@/store/modules/user'; import useLockStore from '@/store/modules/lock'; @@ -313,40 +254,10 @@ function goToHelpCenter() { } -const noticeStore = useNoticeStore() -const noticeVisible = ref(false) -const noticeTab = ref('all') -const detailViewRef = ref(null) -const noticeFilteredList = computed(() => { - const list = noticeStore.noticeList - if (noticeTab.value === 'notice') return list.filter(n => n.noticeType === '1') - if (noticeTab.value === 'announce') return list.filter(n => n.noticeType === '2') - return list -}) const noticeUnread = computed(() => noticeStore.noticeList.filter(n => n.noticeType === '1' && !noticeIsRead(n)).length) const announceUnread = computed(() => noticeStore.noticeList.filter(n => n.noticeType === '2' && !noticeIsRead(n)).length) -function noticeIsRead(item) { - return item.isRead || item.readFlag === '1' || noticeStore.readIds.has(item.noticeId) -} -function noticeFormatTime(time) { - if (!time) return '' - const d = new Date(time), now = new Date(), diff = now - d - if (diff < 60000) return '刚刚' - if (diff < 3600000) return Math.floor(diff / 60000) + '分钟前' - if (diff < 86400000) return Math.floor(diff / 3600000) + '小时前' - if (diff < 604800000) return Math.floor(diff / 86400000) + '天前' - const pad = n => String(n).padStart(2, '0') - return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())}` -} -function handleNoticeRead(item) { - if (!noticeIsRead(item)) noticeStore.markRead(item.noticeId) - detailViewRef.value?.open(item) -} -function handleNoticeReadAll() { - noticeStore.markAllRead() -} const emits = defineEmits(['setLayout']); function setLayout() { @@ -355,7 +266,6 @@ function setLayout() { onMounted(() => { loadOrgList(); - noticeStore.fetchNotices(); }); @@ -647,117 +557,3 @@ onMounted(() => { } -