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