Commit Graph
18 Commits
Author SHA1 Message Date
admin d33601c987 fix(discovery): 修复真实书籍封面显示 2026-09-12 08:38:58 +08:00
admin a1f54e765e Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	.gitignore
#	app.py
#	static/js/app.js
2026-09-11 18:25:03 +08:00
admin 8af75454a4 feat(web): v2 看板前端接入真实数据接口
前端样式完全沿用 2.0 设计稿,仅替换数据来源。

- templates/index.html 改用设计稿 DOM 结构与类名,引用 styles.css + weapi.js + app.js
- static/css/styles.css 引入 2.0 设计稿样式
- static/js/weapi.js 新增,封装 /api/v2/* 调用为全局 WeApi
- static/js/app.js 重写:保留设计稿全部渲染函数与 CSS 类名,
  数据源由 demo-data.js 静态假数据改为真实接口,
  补充异步加载器、加载/错误状态机与重试按钮
- static/js/demo-data.js 保留为设计稿原始假数据对照
2026-09-11 18:21:06 +08:00
admin 92a48d14cd feat: 添加配置读取工具,支持从环境变量和 .env 文件加载 WEREAD_API_KEY
fix: 修复启动脚本中的 Python 解释器路径识别
style: 更新样式以支持按钮最小宽度和灵活布局
docs: 添加项目最终文档,整合各类信息与说明
2026-07-17 22:11:27 +08:00
admin c3f5c0ff03 刷新按钮改用 span 结构 + flex 布局,彻底修复高度抖动\n\n问题:\n- width:120px + 字符 ↻ 在某些字体下被当成大尺寸字符渲染\n- 文字强制换行成两行,按钮高度暴涨到 150px+ 变成竖长方形\n\n修复:\n- 改用 ⟳ (U+27F3) 字符,更稳定\n- HTML 结构:<span class="btn-icon">⟳</span><span class="btn-text">刷新</span>\n- CSS 改用 display:inline-flex + align-items:center + justify-content:center\n- 固定 height:36px + padding:0 16px\n- JS 通过 .btn-text 选择器单独更新文字,保留图标 span 2026-07-17 13:28:08 +08:00
admin baeda63646 修复刷新按钮宽度抖动:改用固定 width:120px
- min-width 改为固定 width:120px,容纳最长文案'↻ 同步中...'
- transition 从 all 改为仅 color/border/opacity,避免宽度动画
- 添加 box-sizing:border-box 确保 padding 不撑大按钮
2026-07-17 13:24:13 +08:00
admin 7bc02075bd 刷新按钮支持数据同步:调用 /api/sync 拉取最新数据
- app.py 新增 /api/sync POST 接口:运行 fetch_data.py + migrate_to_mysql.py
- refreshShelf() 先调用 /api/sync 同步数据,再重新加载书架
- 按钮文案三阶段:同步中... → 加载中... → 刷新
- CSS 增加 min-width 防止按钮宽度抖动
- launchd plist 和 start_server.sh 均配置 WEREAD_API_KEY 环境变量
2026-07-17 13:22:19 +08:00
admin 8333230f77 添加书架刷新按钮 + 后端服务保活方案
前端:
- 书架筛选栏新增「↻ 刷新」按钮,点击重新加载分类和书架数据
- 新增 refreshShelf() 函数,带 loading 状态反馈
- 新增 .shelf-refresh-btn CSS 样式

后端保活:
- 新增 start_server.sh 启动脚本 (start/daemon/stop/restart/status)
- 新增 com.weread-dashboard.plist launchd 服务配置
  - KeepAlive=true: 崩溃自动重启
  - RunAtLoad=true: 开机自动启动
  - 日志输出到 /tmp/weread_server.log
2026-07-17 13:14:55 +08:00
admin 7d983e38da 书架恢复横向网格展示,移除分类分组标题
- loadShelf 始终用简单网格渲染,不再调用 renderBooksGroupedByCategory
- 删除 renderBooksGroupedByCategory 函数
- 清理 .shelf-group-header / .shelf-group-count CSS 样式
- 后端 sort=category 仍生效(按分类排序),前端不显示分组标题
- 分类筛选标签保留
2026-07-17 12:33:04 +08:00
admin 8b24052ab6 移除分类排序按钮,默认按分类排序展示
- 删除 index.html 中的 shelfSortBtn 按钮
- shelfSortMode 默认改为 category,始终按分类排序
- 删除 toggleShelfSort 函数和 .shelf-sort-btn CSS 样式
- 书架列表默认以分类分组渲染
2026-07-17 12:29:01 +08:00
admin e578a90543 feat: collapsible hierarchical category tags + category sort for shelf
- Backend: add parent_category param (matches '历史-*' sub-categories),
  sort=category mode (ORDER BY category ASC), return category_tree with
  parent→sub→count hierarchy
- Frontend: replace flat 63-tag list with collapsible parent tags showing
  book counts, click parent to expand sub-category pills with fade-in
  animation, click sub to filter to exact category
- Add '分类排序' toggle button: when active, books are grouped by
  category with colored section headers showing category name + count
- Clicking same parent again collapses it; '全部' resets everything
- Mobile responsive: smaller tag sizes, reduced indent on narrow screens
2026-07-17 12:21:36 +08:00
admin 90b9614b5e feat: add search and sort to thoughts detail page
- Search box: real-time filter across highlights, book reviews, and
  thoughts content (mark_text, content, abstract fields)
- Sort dropdown: 3 modes - newest first, oldest first, by chapter order
  (chapter_uid + range position)
- Chapter sort mode groups highlights by chapter with titles
- Time sort mode flattens highlights with chapter labels
- Empty state shows search keyword when no results match
- Mobile responsive: toolbar stacks vertically on narrow screens
2026-07-17 12:16:19 +08:00
admin 4c916eceb7 feat: add global search bar, fix search cover blur, shelf title search + category tags
1. Fix hdCover() to also replace s_ prefix (search results use s_ not t6_)
2. Add persistent search bar below navbar, switches to discover tab on search
3. Shelf search now supports book title and author search (new keyword param)
4. Add category tag pills above book grid, click to filter by category
5. Update /api/shelf backend: keyword param for title/author, category for exact match
6. Mobile responsive styles for search bar and category tags
2026-07-17 12:12:23 +08:00
admin 7c918140b3 feat: add thoughts detail page, tab navigation, vertical ranking, back-to-top
1. Thoughts detail page: standalone full-page view replacing modal,
   classifies content into 3 categories (highlights/book reviews/thoughts)
   with filter tabs, visual badges, and chapter grouping
2. Tab navigation: sections converted from vertical scroll to horizontal
   tab switching with lazy-loaded charts
3. Reading ranking: changed from card grid to vertical list with smaller
   covers matching shelf size, gold/silver/bronze rank badges
4. Back-to-top button: floating button appears after scrolling 400px
5. Book detail modal: added 'View Thoughts' button to navigate to
   thoughts page
2026-07-17 11:30:24 +08:00
admin ae40ed93d6 feat: add dark/light theme toggle, fix cover display, refine overall style
- Add theme toggle button in navbar with sun/moon icons
- Define [data-theme=dark] CSS variables (warm dark palette)
- Persist theme preference in localStorage
- Follow system prefers-color-scheme on first visit
- Anti-flash inline script sets theme before render
- ECharts charts re-render with theme-aware colors on toggle
- Fix reading ranking covers: aspect-ratio 3/4 instead of fixed height
- Fix discover covers: aspect-ratio 3/4 for proper portrait display
- Replace purple hero gradient with warm brown/amber matching accent
- All hardcoded colors replaced with CSS variables
- Smooth 0.3s transitions on all theme-dependent elements
- Update footer text from SQLite to MySQL
2026-07-17 11:13:11 +08:00
admin 507b9c5704 feat: switch to MySQL, add Chinese comments, health check, and technical docs
1. 数据源切换至 MySQL:
   - app.py 从 SQLite 切换到 PyMySQL,所有 API 读取 MySQL weread_dashboard 数据库
   - 新增 db_required 装饰器统一管理数据库连接和异常处理
   - 新增 /api/health 健康检查接口,检测 MySQL 连接状态
   - MySQL 连接失败时返回 HTTP 503 和告警信息
   - 修复 fetched_at 字段 Unix 时间戳到 MySQL TIMESTAMP 的兼容问题

2. 前端数据库连接告警:
   - 页面加载时优先调用 /api/health 检查 MySQL 连接
   - 连接失败时显示固定告警横幅,阻止后续数据加载
   - CSS 告警横幅样式(黄色背景、下滑动画)

3. 代码中文注释:
   - app.py:所有函数、API 接口、工具函数添加完整中文文档注释
   - fetch_data.py:所有 SQLite 建表语句添加列级中文注释
   - migrate_to_mysql.py:保留已有中文注释

4. 技术文档与元数据文档:
   - docs/TECHNICAL_DOC.md:项目概述、系统架构、API 设计、部署指南
   - docs/METADATA_DOC.md:18 张表完整字段说明、索引、表关系、数据类型规范
2026-07-17 10:26:07 +08:00
admin ebfa3a1852 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
2026-07-17 10:07:05 +08:00
admin 1e9c537b86 feat: init weread data dashboard
- 数据采集脚本 fetch_data.py:从微信读书 API 拉取书架、阅读统计、笔记数据存入 SQLite
- Flask 后端 app.py:提供 8 个 API 接口(总览、年度趋势、读书排行、偏好分类、偏好作者、时段分布、书架、笔记)
- 前端页面:ECharts 图表(年度趋势、时段分布、分类饼图、作者排行)、书架网格、笔记概览
- 数据规模:404 本书架、339 小时阅读、304 天阅读、1709 条笔记
2026-07-17 09:59:37 +08:00