Files
xiaoxia-saas/apps/web
xiaoxia be3ed6487e
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 22s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 54s
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 / Validate - Type Check (mypy) (pull_request) Successful in 1m49s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 58s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m50s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 2m33s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 46s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
PR Automation / Auto Approve on CI Green (pull_request) Successful in 50s
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m48s
AI Code Review / AI Code Review (pull_request) Successful in 1m48s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 2m26s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 16s
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (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 / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 46m25s
refactor(template-editor): API层按模块拆分(744行→88行入口, -88%)
将 template-editor.ts 单文件拆分为目录结构,按业务模块组织:

- types.ts — 所有类型定义(EditPlan/Clip/MediaAsset 等)
- constants.ts — 常量(TRANSITION_OPTIONS/QUALITY_OPTIONS 等)
- editPlans.ts — 模板草稿 CRUD + 生成 + 复制 + 取消
- clips.ts — 片段 CRUD + 批量操作(重排序/批量删除/从素材创建)
- aiFeatures.ts — AI 推荐 + AI 封面生成
- mediaAssets.ts — 素材库 API + AssetItem→MediaAsset 映射
- index.ts — 统一入口,re-export 所有类型/常量/函数

入口文件从 744 行精简到 88 行(仅 re-export),
各模块职责单一,便于维护和 tree-shaking。
导入路径 @/api/template-editor 保持向后兼容。
2026-07-26 16:31:25 +08:00
..
2026-06-15 15:17:40 +08:00

小虾 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

开发指南

添加新页面

  1. src/pages/ 下创建页面组件
  2. src/router/index.tsx 中添加路由
  3. 确保导出 Component 用于懒加载

添加新 API

  1. src/api/ 下创建服务模块
  2. 定义 TypeScript 接口
  3. 使用 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