From f66732f21b7722e9261f89c9a83f66f4cc0c9c01 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <773861846@qq.com> Date: Fri, 20 May 2022 10:43:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=84=E8=AE=BA=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.js | 4 ++++ src/views/Book.vue | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/api/user.js b/src/api/user.js index 2d94d34..a78dce5 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -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}`); } \ No newline at end of file diff --git a/src/views/Book.vue b/src/views/Book.vue index 833418d..4c85a6c 100644 --- a/src/views/Book.vue +++ b/src/views/Book.vue @@ -157,10 +157,10 @@ >删除 @@ -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 }; },