更新消息管理页面,调整消息数据结构,新增标记消息为已读的API路由,优化用户消息状态处理,提升用户体验和代码可维护性。

This commit is contained in:
zyh
2025-04-10 09:21:05 +00:00
parent d5c31777d2
commit a16e7a4165
4 changed files with 37 additions and 9 deletions

View File

@@ -90,11 +90,11 @@ export const MessagesPage = () => {
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
render: (status: MessageStatus) => (
<span style={{ color: status === MessageStatus.UNREAD ? 'red' : 'green' }}>
{MessageStatusNameMap[status]}
dataIndex: 'user_status',
key: 'user_status',
render: (user_status: MessageStatus) => (
<span style={{ color: user_status === MessageStatus.UNREAD ? 'red' : 'green' }}>
{MessageStatusNameMap[user_status]}
</span>
),
},
@@ -112,7 +112,7 @@ export const MessagesPage = () => {
<Button
type="link"
onClick={() => markAsReadMutation.mutate(record.id)}
disabled={record.status === MessageStatus.READ}
disabled={record.user_status === MessageStatus.READ}
>
</Button>

View File

@@ -5,7 +5,7 @@ import type {
User, FileLibrary, FileCategory, ThemeSettings,
SystemSetting, SystemSettingGroupData,
LoginLocation, LoginLocationDetail,
Message, MessageType, MessageStatus
Message, MessageType, MessageStatus, UserMessage
} from '../share/types.ts';
@@ -608,7 +608,7 @@ export interface MessageResponse {
}
export interface MessagesResponse {
data: Message[];
data: UserMessage[];
pagination: {
total: number;
current: number;

View File

@@ -487,7 +487,10 @@ export interface UserMessage {
id: number;
user_id: number;
message_id: number;
status: MessageStatus;
title: string;
content: string;
user_status: MessageStatus;
user_message_id: number;
is_deleted?: DeleteStatus;
read_at?: string;
created_at: string;