diff --git a/components.d.ts b/components.d.ts index f238dd8..9a49e1d 100644 --- a/components.d.ts +++ b/components.d.ts @@ -27,6 +27,7 @@ declare module 'vue' { AMenuDivider: typeof import('ant-design-vue/es')['MenuDivider'] AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] AModal: typeof import('ant-design-vue/es')['Modal'] + APagination: typeof import('ant-design-vue/es')['Pagination'] APopover: typeof import('ant-design-vue/es')['Popover'] AQrcode: typeof import('ant-design-vue/es')['QRCode'] ASegmented: typeof import('ant-design-vue/es')['Segmented'] diff --git a/src/api/comment/index.ts b/src/api/comment/index.ts index eec2761..9961b47 100644 --- a/src/api/comment/index.ts +++ b/src/api/comment/index.ts @@ -1,19 +1,61 @@ import {service} from "@/utils/alova/service.ts"; /** - * 上传图片转base64 + * @description 评论提交 + * @param params */ -export const uploadToBase64 = (images: any[]) => { - return service.Post('/api/auth/comment/upload_to_base64', +export const commentSubmitApi = (params: any) => { + return service.Post('/api/auth/comment/submit', { + user_id: params.user_id, + content: params.content, + images: params.images, + topic_id: params.topic_id, + author: params.author, + }, { - images, - }, { - headers: { - 'Content-Type': 'multipart/form-data' - }, meta: { ignoreToken: false, - } + }, + } + ); +}; +/** + * @description 回复提交 + * @param params + */ +export const replySubmitApi = (params: any) => { + return service.Post('/api/auth/reply/submit', { + user_id: params.user_id, + content: params.content, + images: params.images, + topic_id: params.topic_id, + reply_id: params.reply_id, + reply_user: params.reply_user, + author: params.author, + }, + { + meta: { + ignoreToken: false, + }, + } + ); +}; + +/** + * @description 评论列表 + * @param params + */ +export const commentListApi = (params: any) => { + return service.Post('/api/auth/comment/list', { + page: params.page, + size: params.size, + topic_id: params.topic_id, + }, + { + cacheFor: 1000 * 60 * 60 * 24 * 7, // 7天缓存 + meta: { + ignoreToken: false, + }, } ); }; diff --git a/src/components/CommentReply/CommentReply.vue b/src/components/CommentReply/CommentReply.vue index 915d025..b4aa9e1 100644 --- a/src/components/CommentReply/CommentReply.vue +++ b/src/components/CommentReply/CommentReply.vue @@ -12,6 +12,7 @@ @@ -34,14 +35,14 @@ @@ -66,7 +67,8 @@ {{ t('comment.sendComment') }} @@ -198,19 +200,49 @@ > - + {{ t('comment.emoji') }} - - {{ t('comment.picture') }} - + + + + {{ t('comment.picture') }} + + + + - + {{ t('comment.sendComment') }} @@ -247,14 +279,16 @@ - + 10 - + 1 @@ -281,7 +315,8 @@ -