Refactor frontend to Vue 3 + Vite + Pinia + Cypress E2E
- Replace single-file 8441-line HTML with Vue 3 SPA - Pinia stores: auth, oils, recipes, diary, ui - Composables: useApi, useDialog, useSmartPaste, useOilTranslation - 6 shared components: RecipeCard, RecipeDetailOverlay, TagPicker, etc. - 9 page views: RecipeSearch, RecipeManager, Inventory, OilReference, etc. - 14 Cypress E2E test specs (113 tests), all passing - Multi-stage Dockerfile (Node build + Python runtime) - Demo video generation scripts (TTS + subtitles + screen recording) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
86
README.md
Normal file
86
README.md
Normal file
@@ -0,0 +1,86 @@
|
||||
# doTERRA 精油配方计算器
|
||||
|
||||
精油配方成本计算、配方管理、配方卡片导出工具。
|
||||
|
||||
## 功能
|
||||
|
||||
- **配方查询** - 搜索配方,按名称/精油/标签筛选,分类浏览
|
||||
- **配方编辑** - 可视化编辑精油成分、滴数,自动计算成本
|
||||
- **容量换算** - 支持单次/5ml/10ml/30ml 容量,自动稀释比例换算
|
||||
- **智能粘贴** - 粘贴文本自动识别精油名称和滴数(支持模糊匹配、同音字纠错)
|
||||
- **配方卡片** - 生成精美配方卡片图片,支持中英双语,品牌水印
|
||||
- **个人配方** - 保存私人配方,记录使用日记
|
||||
- **精油库存** - 标记已有精油,自动推荐可做配方
|
||||
- **收藏系统** - 收藏喜欢的配方,快速访问
|
||||
- **商业核算** - 项目成本利润分析(企业用户专属)
|
||||
- **Excel 导出** - 批量导出配方到 Excel 表格
|
||||
- **多角色权限** - 查看者 / 编辑者 / 高级编辑者 / 管理员
|
||||
- **Bug 追踪** - 内置问题反馈和追踪系统
|
||||
|
||||
## 技术栈
|
||||
|
||||
### 前端
|
||||
- **Vue 3** (Composition API + `<script setup>`)
|
||||
- **Vite** 构建工具
|
||||
- **Pinia** 状态管理
|
||||
- **Vue Router** 路由
|
||||
- **html2canvas** 配方卡片图片生成
|
||||
- **ExcelJS** Excel 导出
|
||||
|
||||
### 后端
|
||||
- **FastAPI** (Python)
|
||||
- **SQLite** 数据库
|
||||
- **Uvicorn** ASGI 服务器
|
||||
|
||||
### 部署
|
||||
- **Docker** 多阶段构建
|
||||
- **Kubernetes** (k3s)
|
||||
- **Traefik** 反向代理 + 自动 TLS
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 前端开发
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
开发服务器启动在 `http://localhost:5173`,自动代理 `/api` 请求到后端。
|
||||
|
||||
### 后端开发
|
||||
|
||||
```bash
|
||||
pip install -r backend/requirements.txt
|
||||
uvicorn backend.main:app --reload --port 8000
|
||||
```
|
||||
|
||||
### Docker 构建
|
||||
|
||||
```bash
|
||||
docker build -t oil-calculator .
|
||||
docker run -p 8000:8000 -v oil-data:/data oil-calculator
|
||||
```
|
||||
|
||||
访问 `http://localhost:8000`。
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
frontend/src/
|
||||
router/ # 路由配置
|
||||
stores/ # Pinia stores (auth, oils, recipes, diary, ui)
|
||||
composables/ # useApi, useDialog, useSmartPaste, useOilTranslation
|
||||
components/ # 共享组件 (RecipeCard, TagPicker, LoginModal...)
|
||||
views/ # 页面 (RecipeSearch, RecipeManager, Inventory...)
|
||||
assets/ # 全局样式
|
||||
|
||||
backend/
|
||||
main.py # FastAPI 应用 + 所有 API 端点
|
||||
database.py # SQLite 数据库初始化和迁移
|
||||
```
|
||||
|
||||
## 部署
|
||||
|
||||
详见 [doc/deploy.md](doc/deploy.md)。
|
||||
Reference in New Issue
Block a user