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
};
},
};