0a6473e5d7
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m4s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m47s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m57s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m54s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 2m12s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 2m17s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m35s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 2m43s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 3m2s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m7s
AI Code Review / AI Code Review (pull_request) Successful in 6m35s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 8m12s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Failing after 9m12s
CI/CD Pipeline / CI Gate (pull_request) Failing after 0s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 6m14s
问题1:模板卡片不显示预览图 - 之前写死渐变色+🖼️emoji,完全没用 thumbnail_url 字段 - 新增 TemplateThumb 子组件:优先渲染 tpl.thumbnail_url(object-fit:cover), 图片加载失败或无URL时回退到按模板id哈希的柔和渐变色占位 - 选中态✓覆盖在图片上层 问题2:自动生成封面 POST /generation/generate-cover 返回404 根因:前端用魔法字符串 "default" 作为 template_id 发给后端,但后端 模板库中不存在 id="default" 的记录,resolve_draft_plan_id 返回404。 修复: 1. 前端 useSharedCover:挂载时拉模板列表,把初始 "default" 占位符自动 解析为第一个系统模板的真实id;用户未选模板时传空串给API层 2. 前端 api/generation/cover.ts:templateId 为空或 "default" 时不传 template_id query 参数(而非传 "default") 3. 后端 generation_cover.py: - template_id Query 改为可选(默认空串) - 移除原来强依赖 get_draft_plan_id(auto_create_default=False) 的 Depends - 在函数体内手动 resolve:空串时 auto_create_default=True 自动兜底到 用户默认模板;非空时走原校验逻辑 4. useBatchCovers:批量一键生成同样不传 "default" 5. Step6CoverSettings:透传原始 selectedTemplateId 给 useBatchCovers 6. 保留 selectedTemplateId==="default" 的UI展示分支("默认模板"文案) 用于首次挂载模板列表加载完成前的过渡态 验证: - tsc --noEmit ✅ - eslint --max-warnings=0 ✅ - prettier ✅ - vite build ✅ - 后端 Python 语法检查 ✅ - 未修改 CI 配置
小虾 SaaS - 前端应用
基于 Vite + React 18 + TypeScript + Ant Design 的现代化 SaaS 前端应用。
快速开始
# 安装依赖
npm install
# 启动开发服务器
npm run dev
# 构建生产版本
npm run build
# 预览生产版本
npm run preview
技术栈
- 框架: React 18.3.1
- 语言: TypeScript 5.5.3
- 构建工具: Vite 5.3.1
- UI 组件库: Ant Design 5.18.0
- 路由: React Router 6.24.0
- 状态管理: Zustand 4.5.2
- 数据获取: React Query 5.45.0
- HTTP 客户端: Axios 1.7.2
- 表单: React Hook Form 7.52.0 + Zod 3.23.8
项目结构
src/
├── api/ # API 服务层
├── components/ # React 组件
│ ├── common/ # 通用组件
│ ├── layout/ # 布局组件
│ └── business/ # 业务组件
├── pages/ # 页面组件
│ ├── auth/ # 认证页面
│ ├── workspace/ # 工作空间
│ ├── subscription/# 订阅管理
│ ├── admin/ # Admin 后台
│ └── profile/ # 个人中心
├── hooks/ # 自定义 Hooks
├── store/ # 状态管理
├── router/ # 路由配置
├── types/ # TypeScript 类型
├── utils/ # 工具函数
└── styles/ # 全局样式
功能特性
- ✅ 用户认证(登录/注册/密码重置)
- ✅ 工作空间管理
- ✅ 成员管理和权限控制
- ✅ 订阅计划和升级
- ✅ 配额使用监控
- ✅ Admin 管理后台
- ✅ 个人设置和安全
- ✅ 响应式设计
环境变量
创建 .env 文件:
VITE_API_URL=http://localhost:8000
开发指南
添加新页面
- 在
src/pages/下创建页面组件 - 在
src/router/index.tsx中添加路由 - 确保导出
Component用于懒加载
添加新 API
- 在
src/api/下创建服务模块 - 定义 TypeScript 接口
- 使用
apiClient发起请求
状态管理
使用 Zustand 创建 Store:
import { create } from "zustand"
interface MyStore {
data: any
setData: (data: any) => void
}
export const useMyStore = create<MyStore>((set) => ({
data: null,
setData: (data) => set({ data }),
}))
部署
# 构建
npm run build
# 产物在 dist/ 目录
License
MIT