fix: Claude
This commit is contained in:
parent
a20550422f
commit
2cefd01331
@ -64,19 +64,24 @@ const App = (function() {
|
||||
|
||||
function showPage(page) {
|
||||
// 重置UI状态
|
||||
if (page !== 'reader') {
|
||||
$('#app-header').removeClass('header-hidden');
|
||||
$('#app-content').removeClass('reader-mode');
|
||||
$('#reader-toolbar').addClass('hidden');
|
||||
|
||||
// 详情页隐藏底部导航(有自己的操作栏)
|
||||
if (page === 'detail') {
|
||||
if (page === 'reader') {
|
||||
// 阅读器模式:隐藏所有导航
|
||||
$('#app-header').addClass('header-hidden');
|
||||
$('#app-nav').addClass('nav-hidden');
|
||||
$('#app-content').addClass('detail-mode');
|
||||
$('#app-content').addClass('reader-mode').removeClass('detail-mode');
|
||||
$('#reader-toolbar').removeClass('hidden');
|
||||
} else if (page === 'detail') {
|
||||
// 详情页:隐藏底部导航(有自己的操作栏)
|
||||
$('#app-header').removeClass('header-hidden');
|
||||
$('#app-nav').addClass('nav-hidden');
|
||||
$('#app-content').removeClass('reader-mode').addClass('detail-mode');
|
||||
$('#reader-toolbar').addClass('hidden');
|
||||
} else {
|
||||
// 普通页面:显示所有导航
|
||||
$('#app-header').removeClass('header-hidden');
|
||||
$('#app-nav').removeClass('nav-hidden');
|
||||
$('#app-content').removeClass('detail-mode');
|
||||
}
|
||||
$('#app-content').removeClass('reader-mode').removeClass('detail-mode');
|
||||
$('#reader-toolbar').addClass('hidden');
|
||||
}
|
||||
|
||||
// 更新页面标题
|
||||
@ -129,7 +134,19 @@ const App = (function() {
|
||||
|
||||
// 返回按钮
|
||||
$('#btn-back').on('click', function() {
|
||||
// 如果有历史记录就返回,否则跳转到书架
|
||||
if (window.history.length > 1) {
|
||||
const currentHash = window.location.hash;
|
||||
window.history.back();
|
||||
// 检查是否真的返回了,如果没有就跳转到书架
|
||||
setTimeout(() => {
|
||||
if (window.location.hash === currentHash) {
|
||||
navigate('#/shelf');
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
navigate('#/shelf');
|
||||
}
|
||||
});
|
||||
|
||||
// 搜索按钮
|
||||
@ -217,18 +234,22 @@ const App = (function() {
|
||||
Pages.loadNovels(0, tag);
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
// 加载更多(追加模式,保持当前筛选条件)
|
||||
$(document).on('click', '.load-more-btn', function() {
|
||||
if (Pages.hasMore()) {
|
||||
Pages.loadNovels(Pages.currentPage() + 1, null, true);
|
||||
Pages.loadNovels(Pages.currentPage() + 1, null, true); // append=true 会使用已保存的标签
|
||||
}
|
||||
});
|
||||
|
||||
// 小说卡片点击
|
||||
// 小说卡片点击(包括搜索结果中的)
|
||||
$(document).on('click', '.novel-card, .novel-grid-card, .shelf-item', function(e) {
|
||||
if ($(e.target).closest('button').length) return;
|
||||
const novelId = $(this).data('novel-id') || $(this).closest('[data-novel-id]').data('novel-id');
|
||||
if (novelId) {
|
||||
// 如果在搜索面板中,先关闭搜索面板
|
||||
if ($('#search-panel').is(':visible')) {
|
||||
hideSearch();
|
||||
}
|
||||
navigate('#/novel/' + novelId);
|
||||
}
|
||||
});
|
||||
|
||||
@ -187,10 +187,10 @@ const Pages = (function() {
|
||||
|
||||
// 加载随机推荐
|
||||
async function loadRandomNovels() {
|
||||
$('#random-novels').html(renderSkeletonScroll(5));
|
||||
$('#random-novels').html(renderSkeletonScroll(6));
|
||||
|
||||
try {
|
||||
const novels = await API.getRandomNovels(8);
|
||||
const novels = await API.getRandomNovels(12);
|
||||
|
||||
if (novels.length === 0) {
|
||||
$('#random-novels').html('<p style="padding:20px;color:var(--text-muted);">暂无推荐</p>');
|
||||
@ -245,6 +245,7 @@ const Pages = (function() {
|
||||
let currentPage = 0;
|
||||
let isLoadingMore = false;
|
||||
let hasMore = true;
|
||||
let currentTag = null; // 保存当前选择的标签
|
||||
|
||||
async function loadTags() {
|
||||
try {
|
||||
@ -263,15 +264,20 @@ const Pages = (function() {
|
||||
if (isLoadingMore) return;
|
||||
isLoadingMore = true;
|
||||
|
||||
// 如果不是追加加载,保存当前标签
|
||||
if (!append) {
|
||||
currentPage = 0;
|
||||
hasMore = true;
|
||||
currentTag = tag; // 保存当前选择的标签
|
||||
$('#novel-list').html(renderSkeletonList(5));
|
||||
}
|
||||
|
||||
// 追加加载时使用已保存的标签
|
||||
const useTag = append ? currentTag : tag;
|
||||
|
||||
try {
|
||||
const params = { page, size: 20 };
|
||||
if (tag) params.tag = tag;
|
||||
if (useTag) params.tag = useTag;
|
||||
|
||||
const data = await API.searchNovels(params);
|
||||
const novels = data.content || [];
|
||||
|
||||
@ -493,10 +493,7 @@ const Reader = (function() {
|
||||
// 保存进度
|
||||
saveReadingProgress();
|
||||
|
||||
// 显示导航栏
|
||||
$('#app-header').removeClass('header-hidden');
|
||||
$('#app-nav').removeClass('nav-hidden');
|
||||
$('#app-content').removeClass('reader-mode');
|
||||
// 隐藏阅读器工具栏
|
||||
$('#reader-toolbar').addClass('hidden').removeClass('visible');
|
||||
|
||||
// 隐藏面板
|
||||
@ -510,7 +507,7 @@ const Reader = (function() {
|
||||
// 解绑事件
|
||||
unbindEvents();
|
||||
|
||||
// 返回详情页
|
||||
// 返回详情页(showPage会处理导航栏显示状态)
|
||||
if (currentNovelId) {
|
||||
window.location.hash = '#/novel/' + currentNovelId;
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user