mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2026-01-12 05:01:39 +08:00
feat: 重构公告及消息,公告支持系统消息推送提醒、定时发布、置顶、记录读取状态
This commit is contained in:
@@ -29,7 +29,10 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import MyMessage from './components/MyMessage.vue'
|
||||
import MyNotice from './components/MyNotice.vue'
|
||||
import { useDevice } from '@/hooks'
|
||||
import { type MessageResp, type NoticeResp, listMessage, listNotice } from '@/apis'
|
||||
import {
|
||||
getUnreadMessageCount,
|
||||
getUnreadNoticeCount,
|
||||
} from '@/apis'
|
||||
import mittBus from '@/utils/mitt'
|
||||
|
||||
defineOptions({ name: 'UserMessage' })
|
||||
@@ -51,35 +54,22 @@ const TabPaneTitle = defineComponent({
|
||||
|
||||
const { isDesktop } = useDevice()
|
||||
|
||||
const messageList = ref<MessageResp[]>()
|
||||
const noticeList = ref<NoticeResp[]>()
|
||||
const unreadMessageCount = ref(0)
|
||||
const unreadNoticeCount = ref(0)
|
||||
|
||||
const tabItems = computed(() => [
|
||||
{ key: 'msg', title: '我的消息', count: messageList.value?.length ?? 0 },
|
||||
{ key: 'notice', title: '我的公告' },
|
||||
{ key: 'msg', title: '我的消息', count: unreadMessageCount },
|
||||
{ key: 'notice', title: '我的公告', count: unreadNoticeCount },
|
||||
])
|
||||
|
||||
const messageQueryParam = reactive({
|
||||
isRead: false,
|
||||
sort: ['createTime,desc'],
|
||||
page: 1,
|
||||
size: 5,
|
||||
})
|
||||
|
||||
const noticeQueryParam = reactive({
|
||||
sort: ['createTime,desc'],
|
||||
page: 1,
|
||||
size: 5,
|
||||
})
|
||||
|
||||
const getMessageData = async () => {
|
||||
const { data } = await listMessage(messageQueryParam)
|
||||
messageList.value = data.list.filter((item) => !item.isRead)
|
||||
const { data } = await getUnreadMessageCount()
|
||||
unreadMessageCount.value = data.total
|
||||
}
|
||||
|
||||
const getNoticeData = async () => {
|
||||
const { data } = await listNotice(noticeQueryParam)
|
||||
noticeList.value = data.list
|
||||
const { data } = await getUnreadNoticeCount()
|
||||
unreadNoticeCount.value = data.total
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user