fix(modues/web): deal with readingRecent tag clik event; remove keyup eventListener when addToBookShelfConfirm visible
This commit is contained in:
@@ -568,6 +568,9 @@ const addToBookShelfConfirm = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
onBeforeRouteLeave(async (to, from, next) => {
|
onBeforeRouteLeave(async (to, from, next) => {
|
||||||
|
console.log("onBeforeRouteLeave");
|
||||||
|
// 弹窗时停止响应按键翻页
|
||||||
|
window.removeEventListener("keyup", handleKeyPress);
|
||||||
await addToBookShelfConfirm();
|
await addToBookShelfConfirm();
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
readingRecent.author,
|
readingRecent.author,
|
||||||
readingRecent.chapterIndex,
|
readingRecent.chapterIndex,
|
||||||
readingRecent.chapterPos,
|
readingRecent.chapterPos,
|
||||||
|
readingRecent.isSeachBook,
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
:class="{ 'no-point': readingRecent.url == '' }"
|
:class="{ 'no-point': readingRecent.url == '' }"
|
||||||
@@ -110,6 +112,7 @@ export default defineComponent({
|
|||||||
url: "",
|
url: "",
|
||||||
chapterIndex: 0,
|
chapterIndex: 0,
|
||||||
chapterPos: 0,
|
chapterPos: 0,
|
||||||
|
isSeachBook: false,
|
||||||
});
|
});
|
||||||
const shelfWrapper = ref(null);
|
const shelfWrapper = ref(null);
|
||||||
const { showLoading, closeLoading, loadingWrapper, isLoading } = useLoading(
|
const { showLoading, closeLoading, loadingWrapper, isLoading } = useLoading(
|
||||||
@@ -249,20 +252,28 @@ export default defineComponent({
|
|||||||
chapterIndex,
|
chapterIndex,
|
||||||
chapterPos,
|
chapterPos,
|
||||||
isSeachBook,
|
isSeachBook,
|
||||||
|
fromReadRecentClick = false,
|
||||||
) => {
|
) => {
|
||||||
if (bookName === "尚无阅读记录") return;
|
if (bookName === "尚无阅读记录") return;
|
||||||
|
// 最近书籍不再书架上 自动搜索
|
||||||
|
if (isSeachBook === true && fromReadRecentClick) {
|
||||||
|
searchWord.value = bookName;
|
||||||
|
searchBook();
|
||||||
|
return;
|
||||||
|
}
|
||||||
sessionStorage.setItem("bookUrl", bookUrl);
|
sessionStorage.setItem("bookUrl", bookUrl);
|
||||||
sessionStorage.setItem("bookName", bookName);
|
sessionStorage.setItem("bookName", bookName);
|
||||||
sessionStorage.setItem("bookAuthor", bookAuthor);
|
sessionStorage.setItem("bookAuthor", bookAuthor);
|
||||||
sessionStorage.setItem("chapterIndex", chapterIndex);
|
sessionStorage.setItem("chapterIndex", chapterIndex);
|
||||||
sessionStorage.setItem("chapterPos", chapterPos);
|
sessionStorage.setItem("chapterPos", chapterPos);
|
||||||
sessionStorage.setItem("isSeachBook", isSeachBook);
|
sessionStorage.setItem("isSeachBook", String(isSeachBook));
|
||||||
readingRecent.value = {
|
readingRecent.value = {
|
||||||
name: bookName,
|
name: bookName,
|
||||||
author: bookAuthor,
|
author: bookAuthor,
|
||||||
url: bookUrl,
|
url: bookUrl,
|
||||||
chapterIndex: chapterIndex,
|
chapterIndex: chapterIndex,
|
||||||
chapterPos: chapterPos,
|
chapterPos: chapterPos,
|
||||||
|
isSeachBook,
|
||||||
};
|
};
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"readingRecent",
|
"readingRecent",
|
||||||
@@ -343,6 +354,7 @@ export default defineComponent({
|
|||||||
searchBook,
|
searchBook,
|
||||||
books,
|
books,
|
||||||
handleBookClick,
|
handleBookClick,
|
||||||
|
toDetail,
|
||||||
isSearching,
|
isSearching,
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
githubUrl,
|
githubUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user