feat(web): 试看搜索书籍后返回书架时提示是否加入书架

This commit is contained in:
Xwite committed 2024-09-30 20:03:43 +08:00
1 parent 0311a4ce34
commit 4d51516efa
3 files changed
+33 -4

No files matched your search

+5 -3
View File
@@ -211,18 +211,20 @@ const handleBookClick = async (book) => {
durChapterPos = 0,
} = book;
// 判断是否为 searchBook
if (book.durChapterIndex === undefined) {
const isSeachBook = "respondTime" in book
if (isSeachBook) {
await API.saveBook(book);
}
toDetail(bookUrl, name, author, durChapterIndex, durChapterPos);
toDetail(bookUrl, name, author, durChapterIndex, durChapterPos, isSeachBook);
};
const toDetail = (bookUrl, bookName, bookAuthor, chapterIndex, chapterPos) => {
const toDetail = (bookUrl, bookName, bookAuthor, chapterIndex, chapterPos, isSeachBook) => {
if (bookName === "尚无阅读记录") return;
sessionStorage.setItem("bookUrl", bookUrl);
sessionStorage.setItem("bookName", bookName);
sessionStorage.setItem("bookAuthor", bookAuthor);
sessionStorage.setItem("chapterIndex", chapterIndex);
sessionStorage.setItem("chapterPos", chapterPos);
sessionStorage.setItem("isSeachBook", isSeachBook);
readingRecent.value = {
name: bookName,
author: bookAuthor,