From 2dd106c41ee7be1b992637a3011983d2bcd2385b Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Tue, 25 Apr 2023 17:44:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=9C=E5=AE=B6=E5=90=8E=E5=8F=B0-?= =?UTF-8?q?=E5=B0=8F=E8=AF=B4=E7=AB=A0=E8=8A=82=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/author.js | 4 ++++ src/views/author/ChapterList.vue | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/api/author.js b/src/api/author.js index 35d0a80..c4d7683 100644 --- a/src/api/author.js +++ b/src/api/author.js @@ -22,4 +22,8 @@ export function listChapters(bookId, params) { export function publishChapter(bookId,params) { return request.post(`/author/book/chapter/${bookId}`, params); +} + +export function deleteChapter(id) { + return request.delete(`/author/book/chapter/${id}`); } \ No newline at end of file diff --git a/src/views/author/ChapterList.vue b/src/views/author/ChapterList.vue index 8d77d3d..4e7913c 100644 --- a/src/views/author/ChapterList.vue +++ b/src/views/author/ChapterList.vue @@ -35,7 +35,7 @@ 章节名 更新时间 是否收费 - + 操作 @@ -46,17 +46,19 @@ {{item.chapterUpdateTime}}
更新 {{item.isVip == 1 ? '收费' : '免费'}} - + 删除
- --> + @@ -112,7 +114,7 @@ import "@/assets/styles/book.css"; import { reactive, toRefs, onMounted, ref } from "vue"; import { useRouter, useRoute } from "vue-router"; -import { listChapters } from "@/api/author"; +import { listChapters ,deleteChapter} from "@/api/author"; import AuthorHeader from "@/components/author/Header.vue"; export default { name: "authorChapterList", @@ -149,10 +151,16 @@ export default { load(); }; + const deleteBookChapter = async (id) => { + await deleteChapter(id); + load(); + }; + return { ...toRefs(state), handleCurrentChange, load, + deleteBookChapter }; }, };