🐛 fix response structure
This commit is contained in:
@@ -26,7 +26,7 @@ export const commentSubmitApi = (params: any) => {
|
||||
* @param params
|
||||
*/
|
||||
export const replySubmitApi = (params: any) => {
|
||||
return service.Post('/api/auth/reply/submit', {
|
||||
return service.Post('/api/auth/comment/reply/submit', {
|
||||
content: params.content,
|
||||
images: params.images,
|
||||
topic_id: params.topic_id,
|
||||
@@ -73,7 +73,7 @@ export const commentListApi = (params: any) => {
|
||||
* @param params
|
||||
*/
|
||||
export const replyListApi = (params: any) => {
|
||||
return service.Post('/api/auth/reply/list', {
|
||||
return service.Post('/api/auth/comment/reply/list', {
|
||||
page: params.page,
|
||||
size: params.size,
|
||||
comment_id: params.comment_id,
|
||||
@@ -97,7 +97,7 @@ export const replyListApi = (params: any) => {
|
||||
* @param params
|
||||
*/
|
||||
export const replyReplySubmitApi = (params: any) => {
|
||||
return service.Post('/api/auth/reply/reply/submit', {
|
||||
return service.Post('/api/auth/comment/reply/reply/submit', {
|
||||
content: params.content,
|
||||
images: params.images,
|
||||
topic_id: params.topic_id,
|
||||
@@ -139,7 +139,7 @@ export const commentLikeApi = (params: any) => {
|
||||
* @param params
|
||||
*/
|
||||
export const cancelCommentLikeApi = (params: any) => {
|
||||
return service.Post('/api/auth/comment/cancel_like', {
|
||||
return service.Post('/api/auth/comment/dislike', {
|
||||
|
||||
comment_id: params.comment_id,
|
||||
topic_id: params.topic_id,
|
||||
|
@@ -171,7 +171,7 @@ async function commentSubmit(point: any) {
|
||||
key: comment.slideCaptchaData.key,
|
||||
};
|
||||
const result: any = await commentSubmitApi(commentParams);
|
||||
if (result.code === 200 && result.success) {
|
||||
if (result.code === 200) {
|
||||
const tmpData: any = {
|
||||
user_id: user.user.uid,
|
||||
content: result.data.content,
|
||||
|
@@ -98,7 +98,9 @@
|
||||
:disabled="item.reply_count === 0"
|
||||
v-show="item.reply_count > 0"
|
||||
class="reply-action-btn">
|
||||
查看{{ item.reply_count >= 99 ? '99+' : item.reply_count }}条回复
|
||||
{{ t('comment.view') }}{{
|
||||
item.reply_count >= 99 ? '99+' : item.reply_count
|
||||
}}{{ t("comment.replies") }}
|
||||
</AButton>
|
||||
<AButton
|
||||
@click="comment.handleShowReplyInput(item.id)"
|
||||
|
@@ -186,7 +186,7 @@ async function replySubmit(point: any) {
|
||||
key: comment.slideCaptchaData.key,
|
||||
};
|
||||
const result: any = await replySubmitApi(replyParams);
|
||||
if (result.code === 200 && result.success) {
|
||||
if (result.code === 200) {
|
||||
const tmpData: any = {
|
||||
id: result.data.id,
|
||||
content: result.data.content,
|
||||
|
@@ -31,7 +31,7 @@
|
||||
<UserInfoCard :user="child" :padding="0"/>
|
||||
</template>
|
||||
<span
|
||||
class="reply-at">@{{ child.reply_username }}</span>
|
||||
class="reply-at">@{{ child.reply_nickname }}</span>
|
||||
</Popover>
|
||||
<a-tag color="cyan" class="reply-tag-child" size="small">Lv.5</a-tag>
|
||||
</AFlex>
|
||||
|
@@ -189,7 +189,7 @@ async function replyReplySubmit(point: any) {
|
||||
key: comment.slideCaptchaData.key,
|
||||
};
|
||||
const result: any = await replyReplySubmitApi(replyParams);
|
||||
if (result.code === 200 && result.success) {
|
||||
if (result.code === 200) {
|
||||
const tmpData: any = {
|
||||
id: result.data.id,
|
||||
content: result.data.content,
|
||||
|
@@ -104,5 +104,7 @@ export default {
|
||||
loadingMore: 'loading more',
|
||||
noMore: 'no more',
|
||||
reportSeletion: 'Please select the reason for reporting the comment',
|
||||
view: 'look',
|
||||
replies: 'replies',
|
||||
}
|
||||
};
|
||||
|
@@ -103,6 +103,8 @@ export default {
|
||||
loadingMore: '加载更多',
|
||||
noMore: '没有更多了',
|
||||
reportSeletion: '请选择举报原因',
|
||||
view : '查看',
|
||||
replies: '条回复',
|
||||
}
|
||||
|
||||
};
|
||||
|
@@ -52,7 +52,7 @@ export const useCommentStore = defineStore(
|
||||
commentList.value = {} as Comment;
|
||||
// 获取评论列表
|
||||
const result: any = await commentListApi(data);
|
||||
if (result.code === 200 && result.success && result.data) {
|
||||
if (result.code === 200 && result.data) {
|
||||
commentList.value = result.data;
|
||||
commentLoading.value = false;
|
||||
commentList.value.comments.forEach((item: any) => {
|
||||
@@ -98,7 +98,7 @@ export const useCommentStore = defineStore(
|
||||
replyList.value = {} as Comment;
|
||||
// 获取评论列表
|
||||
const result: any = await replyListApi(params);
|
||||
if (result.code === 200 && result.success && result.data) {
|
||||
if (result.code === 200 && result.data) {
|
||||
replyList.value = result.data;
|
||||
replyLoading.value = false;
|
||||
} else {
|
||||
@@ -116,7 +116,7 @@ export const useCommentStore = defineStore(
|
||||
topic_id: data.topic_id,
|
||||
};
|
||||
const result: any = await commentLikeApi(params);
|
||||
if (result.code !== 200 || !result.success) {
|
||||
if (result.code !== 200) {
|
||||
message.error(result.message);
|
||||
return false;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ export const useCommentStore = defineStore(
|
||||
topic_id: data.topic_id,
|
||||
};
|
||||
const result: any = await cancelCommentLikeApi(params);
|
||||
if (result.code !== 200 || !result.success) {
|
||||
if (result.code !== 200) {
|
||||
message.error(result.message);
|
||||
return false;
|
||||
}
|
||||
|
2
src/types/comment.d.ts
vendored
2
src/types/comment.d.ts
vendored
@@ -15,7 +15,7 @@ interface CommentContent {
|
||||
location: string;
|
||||
operating_system: string;
|
||||
reply_count: number;
|
||||
reply_username: string;
|
||||
reply_nickname: string;
|
||||
reply_id: string;
|
||||
reply_user: string;
|
||||
topic_id: string;
|
||||
|
Reference in New Issue
Block a user