django-vue3-admin-web/public/README_EPUB.md
2025-10-22 22:13:19 +08:00

71 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# EPUB 文件配置说明
## 测试文件放置
为了测试在线阅读功能,请将 EPUB 格式的测试文件放置在以下位置:
```
public/static/books/sample.epub
```
## 目录结构
```
public/
└── static/
└── books/
└── sample.epub (测试用的 EPUB 文件)
```
## 后续集成
实际使用时,应该:
1. 在后端添加图书文件上传功能
2. 在图书表中添加 `file_path``file_url` 字段
3. 修改前端阅读器,从后端 API 获取文件 URL
4. 支持多种格式EPUB, PDF, MOBI 等
## API 接口建议
### 获取图书文件 URL
```
GET /api/CrudBookModelViewSet/{id}/file/
Response: {
"file_url": "http://example.com/books/xxx.epub",
"file_type": "epub"
}
```
### 保存阅读进度
```
POST /api/reading-progress/
{
"book_id": 1,
"location": "epubcfi(...)",
"progress": 45.5
}
```
### 获取阅读进度
```
GET /api/reading-progress/{book_id}/
Response: {
"location": "epubcfi(...)",
"progress": 45.5,
"updated_at": "2025-10-20T10:00:00Z"
}
```
### 翻译接口
```
POST /api/translate/
{
"text": "Hello World",
"target_lang": "zh"
}
Response: {
"translation": "你好世界"
}
```