fix(web): standardize user picker and message detail

This commit is contained in:
2026-06-18 00:30:01 +08:00
parent b0537f87ae
commit 16393c183c
9 changed files with 429 additions and 71 deletions

View File

@@ -18,6 +18,23 @@ export interface NoticeListResult {
total: number;
}
export interface NoticeDetail {
id: string;
receiveId?: string;
title?: string | null;
content?: string | null;
type?: number | string | null;
createTime?: number | string | null;
senderId?: string;
sender?: string | null;
receivers?: string | null;
receiverIds?: string | null;
document?: unknown;
params?: unknown;
received?: boolean;
readChanged?: boolean;
}
/** 获取当前用户消息列表 */
export async function fetchNotices(
params: { unreadOnly?: boolean; page?: number; perPage?: number } = {},
@@ -46,3 +63,19 @@ export async function markNoticeRead(id: string): Promise<void> {
export async function markAllNoticesRead(): Promise<void> {
await http.post('/api/notice/read-all');
}
/** 按 sys_message_id 加载只读消息详情(已发送/当前用户可访问消息) */
export async function fetchNoticeDetail(messageId: string): Promise<NoticeDetail> {
const { data } = await http.get<{ status: number; data: NoticeDetail }>(
`/api/notice/${encodeURIComponent(messageId)}/detail`,
);
return data.data;
}
/** 按 sys_messageuser_id 打开收到消息详情,并在后端置已读 */
export async function openReceivedNotice(receiveId: string): Promise<NoticeDetail> {
const { data } = await http.post<{ status: number; data: NoticeDetail }>(
`/api/notice/received/${encodeURIComponent(receiveId)}/open`,
);
return data.data;
}