docs: 创建分模块需求文档(每个模块独立说明)
This commit is contained in:
57
docs/STATS.md
Normal file
57
docs/STATS.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# 统计面板需求说明
|
||||
|
||||
_位置:`frontend/index.html`_
|
||||
|
||||
---
|
||||
|
||||
## 📋 统计卡片
|
||||
|
||||
| 卡片 | 数据来源 | API |
|
||||
|------|---------|-----|
|
||||
| 总日记数 | `stats.total_entries` | `/api/entries/stats/` |
|
||||
| 总任务数 | `stats.total_tasks` | `/api/entries/stats/` |
|
||||
| 进行中 | `stats.progressing` | `/api/entries/stats/` |
|
||||
| 已完成 | `stats.completed` | `/api/entries/stats/` |
|
||||
| 完成率 | `stats.completion_rate` | `/api/entries/stats/` |
|
||||
| 经验数 | `experiences.length` | `/api/experiences/recent/` |
|
||||
|
||||
---
|
||||
|
||||
## 🎨 UI 结构
|
||||
|
||||
```html
|
||||
<div class="stats">
|
||||
<div class="stat-card">
|
||||
<h3 id="stat-total-diaries">-</h3>
|
||||
<p>总日记</p>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<h3 id="stat-total-tasks">-</h3>
|
||||
<p>总任务</p>
|
||||
</div>
|
||||
...
|
||||
</div>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 修改指南
|
||||
|
||||
### 可以修改的
|
||||
- ✅ 添加新的统计卡片
|
||||
- ✅ 修改样式
|
||||
- ✅ 修改统计维度
|
||||
|
||||
### 不能删除的
|
||||
- ❌ `.stats` 容器
|
||||
- ❌ `.stat-card` 样式
|
||||
- ❌ 统计 API 调用
|
||||
|
||||
### 添加新统计时
|
||||
1. 后端 API 添加统计字段
|
||||
2. 前端添加新的统计卡片
|
||||
3. 更新数据绑定
|
||||
|
||||
---
|
||||
|
||||
_此文档必须与代码一起维护_
|
||||
Reference in New Issue
Block a user