Skip to content

Commit 8493bda

Browse files
committed
docs(frontend): 更新 API 文档并部署到 GitHub Pages
1 parent 8d29ab9 commit 8493bda

7 files changed

Lines changed: 1854 additions & 23 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 部署到 GitHub Pages 的工作流
2+
name: Deploy VitePress site to Pages
3+
4+
on:
5+
# 在推送到 main 分支时触发
6+
push:
7+
branches: [main]
8+
# 允许手动触发工作流
9+
workflow_dispatch:
10+
11+
# 设置 GITHUB_TOKEN 的权限,允许部署到 GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# 只允许一个并发部署,跳过正在运行和最新队列之间的运行队列
18+
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
19+
concurrency:
20+
group: pages
21+
cancel-in-progress: false
22+
23+
jobs:
24+
# 构建工作
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 18
37+
cache: npm
38+
cache-dependency-path: frontend/package-lock.json
39+
40+
- name: Setup Pages
41+
uses: actions/configure-pages@v4
42+
43+
- name: Install dependencies
44+
run: |
45+
cd frontend
46+
npm ci
47+
48+
- name: Build with VitePress
49+
run: |
50+
cd frontend
51+
npm run docs:build
52+
53+
- name: Upload artifact
54+
uses: actions/upload-pages-artifact@v3
55+
with:
56+
path: frontend/docs/.vitepress/dist
57+
58+
# 部署工作
59+
deploy:
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
needs: build
64+
runs-on: ubuntu-latest
65+
name: Deploy
66+
steps:
67+
- name: Deploy to GitHub Pages
68+
id: deployment
69+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/frontend/node_modules/
44
/.idea/
55
/frontend/docs/.vitepress/cache/
6+
/frontend/docs/.vitepress/dist/

README.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,47 @@
66

77
这是一个获取滴答清单API接口项目,提供包括任务管理、专注记录、习惯打卡、数据导出等功能。
88

9+
## 🌐 在线文档
10+
11+
- **📖 API文档**: [https://2977094657.github.io/DidaAPI/](https://2977094657.github.io/DidaAPI/)
12+
- **💻 项目地址**: [https://github.com/2977094657/DidaAPI](https://github.com/2977094657/DidaAPI)
13+
914
## 📋 API接口清单
1015

11-
### 🔐 认证相关 (/auth)
12-
- [x] **微信登录**
16+
- [x] **🔐 认证相关 (/auth)**
1317
- [x] `GET /auth/wechat/qrcode` - 获取微信登录二维码
1418
- [x] `GET /auth/wechat/poll` - 轮询登录状态(自动检测)
1519
- [x] `GET /auth/wechat/validate` - 验证微信登录
16-
- [x] **密码登录**
1720
- [x] `POST /auth/password/login` - 密码登录
18-
- [x] **手动认证**
1921
- [x] `POST /tasks/set-auth` - 手动设置认证(通常不需要)
2022

21-
### 📝 任务管理 (/tasks)
22-
- [x] **任务查询**
23+
- [x] **📝 任务管理 (/tasks)**
2324
- [x] `GET /tasks/all` - 获取所有任务
2425
- [x] `GET /tasks/completed` - 获取已完成/已放弃任务(支持分页)
2526
- [x] `GET /tasks/trash` - 获取垃圾桶任务
2627
- [x] `GET /tasks/summary` - 获取任务统计
2728

28-
### 📂 清单管理 (/projects)
29-
- [x] **清单查询**
29+
- [x] **📂 清单管理 (/projects)**
3030
- [x] `GET /projects/all` - 获取清单列表
3131

32-
### 📊 统计分析 (/statistics)
33-
- [x] **用户统计**
32+
- [x] **📊 统计分析 (/statistics)**
3433
- [x] `GET /statistics/ranking` - 获取用户排名统计
3534
- [x] `GET /statistics/general` - 获取通用统计信息
36-
- [x] **任务统计**
3735
- [x] `GET /statistics/tasks` - 获取任务统计信息
3836

39-
### 🍅 专注记录 (/pomodoros)
40-
- [x] **专注查询**
37+
- [x] **🍅 专注记录 (/pomodoros)**
4138
- [x] `GET /pomodoros/general` - 获取番茄专注概览
4239
- [x] `GET /pomodoros/distribution` - 获取专注详情分布
4340
- [x] `GET /pomodoros/timeline` - 获取专注记录时间线
4441

45-
### 🎯 习惯管理 (/habits)
46-
- [x] **习惯查询**
42+
- [x] **🎯 习惯管理 (/habits)**
4743
- [x] `GET /habits/all` - 获取所有习惯
4844
- [x] `GET /habits/statistics/week/current` - 获取本周习惯打卡统计
4945

50-
### 👤 用户信息 (/user)
51-
- [x] **用户资料**
46+
- [x] **👤 用户信息 (/user)**
5247
- [x] `GET /user/info` - 获取用户信息
5348

54-
### 📤 数据导出 (/custom/export)
55-
- [x] **Excel导出**
49+
- [x] **📤 数据导出 (/custom/export)**
5650
- [x] `GET /custom/export/tasks/excel` - 导出任务到Excel
5751
- [x] `GET /custom/export/focus/excel` - 导出专注记录到Excel
5852

frontend/docs/.vitepress/config.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export default defineConfig({
44
title: '滴答清单API文档',
55
description: '滴答清单API接口文档',
66
lang: 'zh-CN',
7+
base: '/DidaAPI/',
78

89
head: [
910
['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }],
@@ -16,7 +17,7 @@ export default defineConfig({
1617
nav: [
1718
{ text: '首页', link: '/' },
1819
{ text: 'API文档', link: '/api/' },
19-
{ text: '项目地址', link: 'https://github.com/your-repo' }
20+
{ text: '项目地址', link: 'https://github.com/2977094657/DidaAPI' }
2021
],
2122

2223
sidebar: {
@@ -109,7 +110,7 @@ export default defineConfig({
109110
},
110111

111112
socialLinks: [
112-
{ icon: 'github', link: 'https://github.com/your-repo' }
113+
{ icon: 'github', link: 'https://github.com/2977094657/DidaAPI' }
113114
],
114115

115116

frontend/docs/api/tasks/get-all-tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,5 +401,5 @@ X-Tz: Asia/Shanghai
401401
## 相关接口
402402

403403
- [验证微信登录](../auth/validate-wechat-login.md) - 获取认证令牌
404-
- [创建任务](./create-task.md) - 创建新任务
405-
- [更新任务](./update-task.md) - 更新任务信息
404+
- [获取已完成任务](./get-completed-tasks.md) - 获取已完成任务列表
405+
- [获取垃圾桶任务](./get-trash-tasks.md) - 获取垃圾桶任务列表

frontend/docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ hero:
1111
- theme: brand
1212
text: 查看API文档
1313
link: /api/
14+
- theme: alt
15+
text: GitHub项目
16+
link: https://github.com/2977094657/DidaAPI
1417

1518

1619
---

0 commit comments

Comments
 (0)