feat(react19-migration): 阶段2 - 核心框架层迁移
- T2.1: request.ts 确认无 Vue 依赖,无需修改 - T2.5: errorHandler.ts ElMessage → antd message - T2.7: 新增 API (menu/config/dict/file/notice/loginLog) + 类型定义 (menu/permission/user) - 清理旧 Vue 测试文件、views、stores、router、directives - 修复 tsconfig: 添加 module:ESNext + types:vite/client 验证: npx tsc --noEmit 无类型错误
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
import type { PageResponse } from './user.api'
|
||||
import { NoticeStatus } from '@/constants/status'
|
||||
|
||||
export interface Notice {
|
||||
id: number
|
||||
title: string
|
||||
content: string
|
||||
type: string
|
||||
status: NoticeStatus
|
||||
createdBy: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface CreateNoticeRequest {
|
||||
title: string
|
||||
content: string
|
||||
type?: string
|
||||
status?: NoticeStatus
|
||||
}
|
||||
|
||||
export interface UpdateNoticeRequest {
|
||||
title?: string
|
||||
content?: string
|
||||
type?: string
|
||||
status?: NoticeStatus
|
||||
}
|
||||
|
||||
export interface NoticePageRequest {
|
||||
page: number
|
||||
size: number
|
||||
title?: string
|
||||
type?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
export const noticeApi = {
|
||||
getPage: (params: NoticePageRequest) =>
|
||||
request.get<PageResponse<Notice>>('/notice/page', { params }),
|
||||
|
||||
getById: (id: number) =>
|
||||
request.get<Notice>(`/notice/${id}`),
|
||||
|
||||
create: (data: CreateNoticeRequest) =>
|
||||
request.post<Notice>('/notice', data),
|
||||
|
||||
update: (id: number, data: UpdateNoticeRequest) =>
|
||||
request.put<Notice>(`/notice/${id}`, data),
|
||||
|
||||
delete: (id: number) =>
|
||||
request.delete<void>(`/notice/${id}`),
|
||||
}
|
||||
Reference in New Issue
Block a user