feat: add book detail, notes detail, recommendation page and MySQL schema

新增功能:
- 书籍详情弹窗:点击书架书籍展示详细信息(书名、作者、出版社、ISBN、字数、评分、简介、阅读进度),数据实时从微信读书 API 获取并入库
- 笔记详情弹窗:点击有笔记的书展示划线和想法/点评,按章节分组展示,数据实时获取并入库
- 推荐页面:个性化推荐(为你推荐)+ 关键词搜索书籍,数据从微信读书 API 获取并入库
- 修复 Flask 中文 URL 参数编码问题

后端新增 API:
- GET /api/book/detail?book_id=xxx — 书籍详情
- GET /api/book/notes?book_id=xxx — 笔记详情(划线+想法)
- GET /api/recommend?maxIdx=0 — 个性化推荐
- GET /api/search?keyword=xxx — 搜索书籍

数据库新增表:
- book_details, book_progress, book_highlights, book_chapters
- book_reviews, recommended_books, search_results

MySQL 版本建表语句 schema_mysql.sql:
- 18 张表的完整 DDL,含索引、字符集 utf8mb4、字段注释
- 适用于后续从 SQLite 迁移至 MySQL
This commit is contained in:
admin committed 2026-07-17 10:07:05 +08:00
1 parent 1e9c537b86
commit ebfa3a1852
6 files changed
+1660 -4

No files matched your search

+448
View File
@@ -678,6 +678,454 @@ body {
to { transform: rotate(360deg); }
}
/* ===== 推荐发现区 ===== */
.discover-section {
padding: 60px 0;
}
.discover-tabs {
display: flex;
justify-content: center;
gap: 12px;
margin-bottom: 24px;
}
.discover-tab {
padding: 8px 24px;
border: 1px solid var(--border);
border-radius: 20px;
background: var(--bg-card);
color: var(--text-secondary);
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s;
}
.discover-tab.active {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
.discover-controls {
display: flex;
justify-content: center;
gap: 12px;
margin-bottom: 24px;
}
.btn-primary {
padding: 8px 20px;
border: none;
border-radius: var(--radius-sm);
background: var(--accent);
color: #fff;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: background 0.2s;
}
.btn-primary:hover {
background: var(--accent-dark);
}
.btn-secondary {
padding: 8px 20px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg-card);
color: var(--text-secondary);
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
}
.btn-secondary:hover {
border-color: var(--accent);
color: var(--accent);
}
.search-box {
display: flex;
gap: 12px;
max-width: 500px;
margin: 0 auto 24px;
}
.search-input {
flex: 1;
padding: 10px 16px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
font-size: 14px;
background: var(--bg-card);
color: var(--text-primary);
}
.search-input:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(193, 123, 74, 0.15);
}
.discover-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 20px;
}
.discover-card {
background: var(--bg-card);
border-radius: var(--radius);
overflow: hidden;
box-shadow: var(--shadow);
border: 1px solid var(--border);
transition: transform 0.2s, box-shadow 0.2s;
cursor: pointer;
}
.discover-card:hover {
transform: translateY(-4px);
box-shadow: var(--shadow-hover);
}
.discover-cover {
width: 100%;
height: 180px;
object-fit: cover;
background: var(--bg-primary);
}
.discover-info {
padding: 14px 16px;
}
.discover-title {
font-size: 14px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.discover-author {
font-size: 12px;
color: var(--text-light);
margin-bottom: 6px;
}
.discover-meta {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.discover-rating {
font-size: 13px;
color: #e65100;
font-weight: 600;
}
.discover-rating-label {
font-size: 11px;
padding: 2px 6px;
border-radius: 4px;
background: #fff3e0;
color: #e65100;
}
.discover-reading-count {
font-size: 11px;
color: var(--text-light);
}
.discover-reason {
margin-top: 6px;
font-size: 12px;
color: var(--accent);
background: rgba(193, 123, 74, 0.08);
padding: 4px 8px;
border-radius: 4px;
}
.discover-category {
font-size: 11px;
color: var(--text-light);
margin-top: 4px;
}
/* ===== 弹窗通用 ===== */
.modal-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
justify-content: center;
align-items: flex-start;
padding: 40px 20px;
overflow-y: auto;
}
.modal-overlay.active {
display: flex;
}
.modal-content {
background: var(--bg-card);
border-radius: var(--radius);
max-width: 700px;
width: 100%;
position: relative;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
margin-bottom: 40px;
}
.modal-close {
position: absolute;
top: 12px;
right: 16px;
font-size: 28px;
color: var(--text-light);
cursor: pointer;
z-index: 10;
line-height: 1;
}
.modal-close:hover {
color: var(--text-primary);
}
.modal-body {
padding: 32px;
}
/* ===== 书籍详情弹窗 ===== */
.book-detail-modal .detail-header {
display: flex;
gap: 20px;
margin-bottom: 24px;
}
.book-detail-modal .detail-cover {
width: 120px;
height: 160px;
border-radius: 8px;
object-fit: cover;
box-shadow: var(--shadow);
flex-shrink: 0;
}
.book-detail-modal .detail-meta {
flex: 1;
}
.book-detail-modal .detail-title {
font-size: 20px;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 8px;
line-height: 1.4;
}
.book-detail-modal .detail-author {
font-size: 14px;
color: var(--text-secondary);
margin-bottom: 8px;
}
.book-detail-modal .detail-tags {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-bottom: 8px;
}
.book-detail-modal .detail-tag {
font-size: 12px;
padding: 2px 10px;
border-radius: 10px;
background: rgba(193, 123, 74, 0.1);
color: var(--accent-dark);
}
.book-detail-modal .detail-progress-info {
margin-top: 12px;
padding: 12px;
background: var(--bg-primary);
border-radius: var(--radius-sm);
}
.book-detail-modal .detail-progress-bar {
height: 8px;
background: var(--border);
border-radius: 4px;
overflow: hidden;
margin-top: 8px;
}
.book-detail-modal .detail-progress-fill {
height: 100%;
background: var(--accent);
border-radius: 4px;
transition: width 0.3s;
}
.book-detail-modal .detail-intro {
font-size: 14px;
color: var(--text-secondary);
line-height: 1.8;
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid var(--border);
}
.book-detail-modal .detail-info-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px 16px;
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid var(--border);
}
.book-detail-modal .detail-info-item {
font-size: 13px;
color: var(--text-secondary);
}
.book-detail-modal .detail-info-item strong {
color: var(--text-primary);
}
.book-detail-modal .detail-actions {
margin-top: 20px;
display: flex;
gap: 12px;
}
/* ===== 笔记详情弹窗 ===== */
.notes-detail-modal {
max-width: 800px;
}
.notes-detail-modal .notes-header {
display: flex;
gap: 16px;
margin-bottom: 20px;
padding-bottom: 16px;
border-bottom: 1px solid var(--border);
}
.notes-detail-modal .notes-cover {
width: 60px;
height: 80px;
border-radius: 6px;
object-fit: cover;
flex-shrink: 0;
box-shadow: var(--shadow);
}
.notes-detail-modal .notes-title {
font-size: 18px;
font-weight: 700;
color: var(--text-primary);
}
.notes-detail-modal .notes-author {
font-size: 13px;
color: var(--text-light);
margin-top: 4px;
}
.notes-detail-modal .notes-counts {
display: flex;
gap: 16px;
margin-top: 8px;
font-size: 13px;
color: var(--text-secondary);
}
.notes-detail-modal .notes-counts strong {
color: var(--accent-dark);
}
.notes-detail-modal .notes-section-title {
font-size: 15px;
font-weight: 600;
color: var(--text-primary);
margin: 20px 0 12px;
padding-bottom: 8px;
border-bottom: 1px solid var(--border);
}
.notes-detail-modal .chapter-group {
margin-bottom: 20px;
}
.notes-detail-modal .chapter-title {
font-size: 13px;
font-weight: 600;
color: var(--accent-dark);
margin-bottom: 8px;
padding: 4px 0;
border-left: 3px solid var(--accent);
padding-left: 10px;
}
.notes-detail-modal .highlight-item {
padding: 10px 14px;
background: var(--bg-primary);
border-radius: var(--radius-sm);
margin-bottom: 8px;
font-size: 14px;
color: var(--text-primary);
line-height: 1.7;
border-left: 3px solid var(--accent-light);
}
.notes-detail-modal .highlight-date {
font-size: 11px;
color: var(--text-light);
margin-top: 4px;
}
.notes-detail-modal .review-item {
padding: 10px 14px;
background: #fff8e1;
border-radius: var(--radius-sm);
margin-bottom: 8px;
font-size: 14px;
color: var(--text-primary);
line-height: 1.7;
border-left: 3px solid #ffc107;
}
.notes-detail-modal .review-meta {
font-size: 11px;
color: var(--text-light);
margin-top: 4px;
}
.notes-detail-modal .review-star {
color: #ff9800;
}
.notes-detail-modal .empty-state {
text-align: center;
padding: 40px;
color: var(--text-light);
font-size: 14px;
}
/* ===== 响应式 ===== */
@media (max-width: 768px) {
.nav-links {