Files
dukang/.cursor/rules/frontend-h5.mdc
T
2026-07-01 15:04:53 +08:00

49 lines
1.1 KiB
Plaintext
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.
---
description: 杜康好客前端 H5 / Admin 编码规范
globs: apps/**/*.{tsx,ts}
alwaysApply: false
---
# 前端规范
## 目录约定
```
src/
├── components/ # PascalCaseAppToast.tsx
├── pages/ # *Page.tsx
├── layouts/ # *Layout.tsx
├── contexts/ # *Context.tsx
├── lib/ # kebab-caseapi.ts, client-location.ts
├── App.tsx
└── main.tsx
```
## 四 App 与样式
| App | 端口 | 样式 |
|-----|------|------|
| h5-user | 5173 | shared-ui tokens |
| h5-shop | 5174 | shared-ui tokens |
| h5-partner | 5175 | shared-ui tokens |
| admin-web | 5175 | Ant Design 5 |
H5 三端通过 Vite alias 引用 `@dukang/shared-ui`admin-web 独立 Ant Design。
## API 请求
```typescript
export const apiBase = '/api/v1';
// 请求头:Authorization + X-Client-App
// preV1 值:USER_H5 | SHOP_H5 | PARTNER_H5 | HQ_WEB
```
Vite dev 代理 `/api` → `localhost:3000`。
## 新页面
1. 对照 `pages/{user,shop,partner,hq}/` 原型命名
2. 类型从 `@dukang/shared-types` 导入
3. C 端订单列表 **5 Tab**(含 `pending_ship`
4. 单引号 + 分号,与现有文件保持一致