feat: 评论删除功能

This commit is contained in:
xiongxiaoyang 2022-05-20 10:43:44 +08:00
parent ce5497f24f
commit f66732f21b
2 changed files with 14 additions and 4 deletions

View File

@ -14,4 +14,8 @@ export function submitFeedBack(params) {
export function comment(params) {
return request.post('/user/comment',params);
}
export function deleteComment(id) {
return request.delete(`/user/comment/${id}`);
}

View File

@ -157,10 +157,10 @@
><span class="fr"
><a
href="javascript:void(0);"
onclick="javascript:BookDetail.AddAgreeTotal(77,this);"
@click="deleteUserComment(item.id)"
class="zan"
style="display: none"
><i class="num">(0)</i></a
>删除</a
></span
>
</li>
@ -295,7 +295,7 @@ import {
listRecBooks,
listNewestComments,
} from "@/api/book";
import { comment } from "@/api/user";
import { comment , deleteComment} from "@/api/user";
import Header from "@/components/common/Header";
import Footer from "@/components/common/Footer";
import author_head from "@/assets/images/author_head.png";
@ -389,6 +389,11 @@ export default {
loadNewestComments(state.book.id)
};
const deleteUserComment = async (id) => {
await deleteComment(id)
loadNewestComments(state.book.id)
}
return {
...toRefs(state),
author_head,
@ -398,6 +403,7 @@ export default {
chapterList,
goToAnchor,
userComment,
deleteUserComment,
man
};
},