diff --git a/src/main/resources/static/css/components.css b/src/main/resources/static/css/components.css index b1f9f52..b88a77e 100644 --- a/src/main/resources/static/css/components.css +++ b/src/main/resources/static/css/components.css @@ -467,6 +467,22 @@ body:has(.reader-mode) #toast { color: var(--text-secondary); } +.clickable-author { + cursor: pointer; + color: var(--primary); + transition: color var(--transition-fast); + display: inline-block; + position: relative; + padding: 2px 4px; + margin: -2px -4px; + border-radius: var(--radius-sm); +} + +.clickable-author:active { + color: var(--primary-dark); + background: var(--bg-hover); +} + .novel-synopsis { font-size: var(--font-size-sm); color: var(--text-muted); diff --git a/src/main/resources/static/css/pages.css b/src/main/resources/static/css/pages.css index 2ebbd05..37d8b5d 100644 --- a/src/main/resources/static/css/pages.css +++ b/src/main/resources/static/css/pages.css @@ -169,6 +169,49 @@ color: var(--bg-primary); } +/* 筛选信息 */ +.filter-info { + display: flex; + align-items: center; + gap: var(--spacing-sm); + padding: var(--spacing-sm) var(--spacing-md); + margin-bottom: var(--spacing-md); + background: var(--bg-hover); + border-radius: var(--radius-md); + font-size: var(--font-size-sm); +} + +.filter-label { + color: var(--text-secondary); +} + +.filter-value { + color: var(--primary); + font-weight: 500; +} + +.clear-filter-btn { + margin-left: auto; + width: 24px; + height: 24px; + display: flex; + align-items: center; + justify-content: center; + background: transparent; + border: none; + color: var(--text-muted); + font-size: 20px; + line-height: 1; + cursor: pointer; + border-radius: var(--radius-full); + transition: all var(--transition-fast); +} + +.clear-filter-btn:active { + background: var(--bg-card); + color: var(--text-primary); +} + /* 小说列表 */ .novel-list { display: flex; @@ -465,6 +508,11 @@ color: var(--text-secondary); } +.detail-author.clickable-author { + color: var(--primary); + font-weight: 500; +} + .detail-stats { display: flex; gap: var(--spacing-lg); diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js index d99988c..4d922ed 100644 --- a/src/main/resources/static/js/app.js +++ b/src/main/resources/static/js/app.js @@ -231,7 +231,7 @@ const App = (function() { $('.tag-btn').removeClass('active'); $(this).addClass('active'); const tag = $(this).data('tag'); - Pages.loadNovels(0, tag); + Pages.loadNovels(0, tag, null); // 清除作者筛选,只按标签筛选 }); // 加载更多(追加模式,保持当前筛选条件) @@ -255,10 +255,22 @@ const App = (function() { } }); + // 点击作者名字,筛选该作者的作品 + $(document).on('click', '.clickable-author', function(e) { + e.preventDefault(); + e.stopPropagation(); + const author = $(this).data('author'); + if (author) { + Pages.searchByAuthor(author); + } + }); + // 其他页面的小说卡片点击 $(document).on('click', '.novel-card, .novel-grid-card, .shelf-item', function(e) { // 如果是搜索结果中的,上面的事件已处理,这里跳过 if ($(this).closest('#search-results').length) return; + // 如果点击的是作者名字,跳过(上面的事件已处理) + if ($(e.target).hasClass('clickable-author') || $(e.target).closest('.clickable-author').length) return; e.preventDefault(); if ($(e.target).closest('button').length) return; @@ -386,6 +398,13 @@ const App = (function() { $text.toggleClass('text-clamp-3'); $(this).text($text.hasClass('text-clamp-3') ? '展开' : '收起'); }); + + // 加载更多按钮(使用事件委托,在pages.js中也有绑定,这里作为备用) + $(document).on('click', '.load-more-btn', function() { + if (Pages.hasMore()) { + Pages.loadNovels(Pages.currentPage() + 1); + } + }); } // ========== 搜索功能 ========== diff --git a/src/main/resources/static/js/pages.js b/src/main/resources/static/js/pages.js index 7d3ab1f..03ae2ef 100644 --- a/src/main/resources/static/js/pages.js +++ b/src/main/resources/static/js/pages.js @@ -208,7 +208,7 @@ const Pages = (function() {
暂无小说
暂无小说