fix Comment Page
This commit is contained in:
@@ -1,27 +1,17 @@
|
||||
import {
|
||||
axios,
|
||||
CaptchaData,
|
||||
Comment,
|
||||
CommentPage,
|
||||
CommentReply,
|
||||
CommentReplyPage,
|
||||
CommentReplyView,
|
||||
CommentView,
|
||||
PageResult
|
||||
} from "~/index";
|
||||
import { axios, CaptchaData, Comment, CommentReply, Page, PageResult } from "~/index";
|
||||
|
||||
const BASE_URI = "/comment";
|
||||
|
||||
async function page(commentPage: CommentPage): Promise<PageResult<CommentView>> {
|
||||
return axios.post(`${BASE_URI}/list`, commentPage);
|
||||
async function page(page: Page<Comment>): Promise<PageResult<Comment>> {
|
||||
return axios.post(`${BASE_URI}/list`, page);
|
||||
}
|
||||
|
||||
async function create(captchaData: CaptchaData<Comment>): Promise<void> {
|
||||
return axios.post(`${BASE_URI}/create`, captchaData);
|
||||
}
|
||||
|
||||
async function pageReply(commentReplyPage: CommentReplyPage): Promise<PageResult<CommentReplyView>> {
|
||||
return axios.post(`${BASE_URI}/reply/list`, commentReplyPage);
|
||||
async function pageReply(page: Page<CommentReply>): Promise<PageResult<CommentReply>> {
|
||||
return axios.post(`${BASE_URI}/reply/list`, page);
|
||||
}
|
||||
|
||||
async function createReply(captchaData: CaptchaData<CommentReply>): Promise<void> {
|
||||
|
||||
@@ -3,57 +3,47 @@ import { UserView } from "./User";
|
||||
|
||||
/** 评论 */
|
||||
export type Comment = {
|
||||
bizType: CommentBizType;
|
||||
bizId: number;
|
||||
bizType?: CommentBizType;
|
||||
bizId?: number;
|
||||
userId?: number;
|
||||
nick?: string;
|
||||
content: string;
|
||||
} & Model
|
||||
content?: string;
|
||||
|
||||
/** 评论视图 */
|
||||
export type CommentView = {
|
||||
/** 所属用户 */
|
||||
user?: UserView;
|
||||
|
||||
/** 回复列表 */
|
||||
replies: CommentReplyView[];
|
||||
replies?: CommentReply[];
|
||||
|
||||
/** 回复分页 */
|
||||
repliesPage: CommentReplyPage;
|
||||
repliesPage?: Page<CommentReply>;
|
||||
|
||||
/** 用于绑定组件当前页下标 */
|
||||
repliesCurrent: number;
|
||||
repliesCurrent?: number;
|
||||
|
||||
/** 回复数量 */
|
||||
repliesLength: number;
|
||||
repliesLength?: number;
|
||||
|
||||
/** 关联文章 */
|
||||
article?: object;
|
||||
|
||||
/** 关联 Git 仓库 */
|
||||
repository?: object;
|
||||
} & Comment;
|
||||
} & Model
|
||||
|
||||
export type CommentReply = {
|
||||
replyId?: number;
|
||||
commentId: number;
|
||||
commentId?: number;
|
||||
senderId?: number;
|
||||
senderNick?: string;
|
||||
receiverId?: number;
|
||||
receiverNick?: string;
|
||||
content: string;
|
||||
} & Model;
|
||||
content?: string;
|
||||
|
||||
export type CommentReplyView = {
|
||||
comment: CommentView;
|
||||
comment?: Comment;
|
||||
sender?: UserView;
|
||||
receiver?: UserView;
|
||||
} & CommentReply;
|
||||
|
||||
export type CommentPage = {
|
||||
bizType?: CommentBizType;
|
||||
bizId?: number;
|
||||
} & Page<Comment>;
|
||||
} & Model;
|
||||
|
||||
export enum CommentReplyBizType {
|
||||
|
||||
@@ -64,11 +54,6 @@ export enum CommentReplyBizType {
|
||||
RECEIVER = "RECEIVER"
|
||||
}
|
||||
|
||||
export type CommentReplyPage = {
|
||||
bizType: CommentReplyBizType
|
||||
bizId?: number
|
||||
} & Page<Comment>;
|
||||
|
||||
export enum CommentBizType {
|
||||
ARTICLE = "ARTICLE",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user