feat: scaffold taro h5 frontends

This commit is contained in:
Codex
2026-06-29 11:40:32 +08:00
parent f74db433cc
commit c090008f52
40 changed files with 18033 additions and 16 deletions

View File

@@ -33,7 +33,7 @@
- Excel/CSV 导入解析已完成并复用 `content_import_jobs/items/issues` 管线;大批量异步导入 worker 基础已接入,支持 queued job 消费、重试和审计;导入后复检、模板下载和字段映射 API 已完成,前端 UI 待接。
- 题库导出目前完成服务端结构化 payloadPDF/Word 二进制生成、导出水印、发布到资料下载和导出 worker 还没完成。
- 勋章管理/手动发放已可联调;自动发放规则、积分活动联动、分佣真实打款、结算导出、发票/凭证、CRM 轮询/定向分配、富卡片模板、失败告警、销售转化看板、公共题库版本通知和冲突处理操作台还没完成。
- Taro 跨端前端还没开始 scaffold
- `apps/taro` 已建立 Taro 4 React 跨端前端地基,包含 H5 学生端、租户后台、平台后台三套构建入口、租户解析、统一 API client 和 Supabase Auth client 初始化;完整页面和端到端联调仍需继续补
- 根目录已清理为新 Supabase SaaS monorepo 编排层;旧 PocketBase/React 项目和旧构建产物仅保留在 `参考/` 目录作为迁移参考,不进入 Git 提交。
更完整的进度看这些文档:
@@ -59,6 +59,7 @@
```text
apps/api/ Node.js 业务 API
apps/taro/ Taro 4 React 跨端前端H5 三入口,后续扩展小程序
apps/worker/ 后台异步任务CRM webhook、支付/退款补偿、资源复检、导入执行、公共题库同步等
packages/config/ 共享配置
packages/db/ PostgreSQL 连接池和查询封装
@@ -92,6 +93,30 @@ npm run db:smoke-seed
npm run dev:api
```
Taro H5 本地开发:
```bash
npm run dev:taro:h5
```
三套 H5 构建:
```bash
npm run build:taro:h5:student
npm run build:taro:h5:tenant
npm run build:taro:h5:platform
```
对应产物:
```text
apps/taro/dist/h5-student
apps/taro/dist/h5-tenant-admin
apps/taro/dist/h5-platform-admin
```
推荐分别部署到学生端域名、租户后台域名、平台后台域名;三者共用 `apps/taro/src/services/api.ts` 请求层,业务数据默认调用 `apps/api`,不要在页面里直写 Supabase 表。
单次运行 CRM worker
```bash
@@ -157,6 +182,8 @@ npm run check:refactor
npm run check:api
npm run check:worker
npm run check:importer
npm run check:taro
npm run audit:runtime
npm run pb:import:dry-run
npm run pb:import:validate
npm run test:readiness
@@ -250,16 +277,22 @@ API 身份上下文:
npx supabase db reset
npm run check:refactor
npm run test:readiness
npm run audit:runtime
npm run test:worker:imports
npm run test:worker:crm
npm run test:worker:commerce
npm run test:worker:assets
npm run test:worker:public-banks
npm audit --audit-level=high
npm run check:taro
npm run build:taro:h5:student
npm run build:taro:h5:tenant
npm run build:taro:h5:platform
git diff --check
```
结果:通过。`npm audit --audit-level=high` 无高危漏洞;当前依赖树仍有 `exceljs -> uuid` 的 moderate 级提示,修复需要破坏性降级 `exceljs`,后续应在导入 Excel 回归充分后单独处理。
结果:通过。`npm run audit:runtime` 无 high/critical 漏洞;当前运行时依赖树仍有 `exceljs -> uuid` 的 moderate 级提示,修复需要破坏性降级 `exceljs`,后续应在导入 Excel 回归充分后单独处理。
注意:`apps/taro` 是静态构建工程,线上发布 `apps/taro/dist/**`,不发布 `node_modules`。Taro 4.2.0 当前构建工具链仍会触发 `npm run audit:taro:toolchain` 的上游 high/critical 提示,不能用 `npm audit fix --force` 降级到 Taro 3 破坏构建;上线验收时以 `audit:runtime`、构建产物、前端密钥检查和静态服务器配置为准,并持续跟进 Taro 官方修复。
## 下一步建议