diff --git a/src/api/message/index.ts b/src/api/message/index.ts new file mode 100644 index 0000000..d89ac78 --- /dev/null +++ b/src/api/message/index.ts @@ -0,0 +1,10 @@ +import httpClient from '@/utils/axios' +import type { ApiResult } from '@/api/types' +import type { directPageParam, distributeData } from './types' + +/** + * 确认切换成已读 + */ +export function confirmToRead(announcementId: number | undefined) { + return httpClient.get(`/notify/user-announcement/read/${announcementId}`) +} diff --git a/src/api/message/types.ts b/src/api/message/types.ts new file mode 100644 index 0000000..b2a444f --- /dev/null +++ b/src/api/message/types.ts @@ -0,0 +1,32 @@ +import type { PageParam } from '@/api/types' +import type { Dayjs } from 'dayjs' +export type directParam = { + customName?: string + originType?: number | null + attribute?: string + distributeDate?: [Dayjs, Dayjs] +} +interface otherObj { + [name: string]: any +} +export type directDTO = { + directClueId?: number + batchNo?: string + nid?: string | undefined + customName?: string + originType: number + effectiveStatus: number + otherClueObj: otherObj + clueLabelName?: string + distributeType: number + distributeDate?: Dayjs | null + distributeUserId?: number | null + userId?: number[] +} +export type directPageParam = directParam & PageParam + +export type distributeData = { + clueId: number + userId: number + userName: string +} diff --git a/src/components/Message/index.vue b/src/components/Message/index.vue index 348c107..c70b027 100644 --- a/src/components/Message/index.vue +++ b/src/components/Message/index.vue @@ -9,26 +9,34 @@
- 【{{ item.type === 1 ? '系统公告' : '导出通知' }}】{{ item.title }} + 【{{ item.messageType === 1 ? '系统公告' : '导出通知' }}】{{ item.title }}
{{ item.createTime }}
- {{ - item.content - }} -
+
+ + {{ item.content }} +
+ +
- {{ + {{ item.state === 1 ? '已读' : '确认' }} { //定位 const positioning = (messageKey: string) => { + localStorage.setItem('clueId', messageKey) emits('click-success', false) - router.push({ path: '/task/customerlist', query: { clueId: messageKey } }) // 跳转到 /task/customerlist 页面 + const randomClueId = Math.random().toString(36).substring(2, 15) // 生成一个随机的ID值 + router.push({ path: '/task/customerlist', query: { clueId: randomClueId } }) // 跳转到 /task/customerlist 页面 } //展开收起 const toggleShowAll = (itemShow: DataItem) => { itemShow.show = !itemShow.show } -const contentRef = ref(null) + +//点击确认变成已读事件 +const readConfirmation = (item: any) => { + if (item.state === 1) { + // 如果当前状态为已读,不执行任何操作 + return + } + // 执行标记为已读的逻辑 + item.state = 1 + // 发送请求将状态更新到后端 + doRequest(confirmToRead(toRaw(item.id)), { + onSuccess: (res: any) => {} + }) +}