Refactor comment system:

- Update comment API to handle private comments and improve request structure.
- Remove unused CSS animations and components related to comments.
- Implement new comment input and item components with enhanced functionality including editing and private comment options.
- Integrate user profile navigation and improve user experience with better feedback on actions (like, delete, edit).
- Update localization for new features and ensure consistency in comment handling.
- Introduce checkbox for private comments in the comment input.
This commit is contained in:
2025-09-09 21:56:41 +08:00
parent ad9dfb0c4c
commit 3e70d63e70
16 changed files with 523 additions and 666 deletions

View File

@ -1,5 +1,5 @@
import axiosClient from './client'
import { UpdateCommentRequest, Comment } from '@/models/comment'
import { Comment } from '@/models/comment'
import { PaginationParams } from '@/models/common'
import { OrderBy } from '@/models/common'
import type { BaseResponse } from '@/models/resp'
@ -32,13 +32,23 @@ export async function createComment(
}
export async function updateComment(
data: UpdateCommentRequest,
{
id, content,
isPrivate = false
}: {
id: number
content: string
isPrivate?: boolean // 可选字段,默认为 false
}
): Promise<BaseResponse<Comment>> {
const res = await axiosClient.put<BaseResponse<Comment>>(`/comment/c/${data.id}`, data)
const res = await axiosClient.put<BaseResponse<Comment>>(`/comment/c/${id}`, {
content,
isPrivate
})
return res.data
}
export async function deleteComment(id: number): Promise<void> {
export async function deleteComment({ id }: { id: number }): Promise<void> {
await axiosClient.delete(`/comment/c/${id}`)
}