Files
dukang/apps/mini-user/README.md
T
2026-07-12 14:45:57 +08:00

46 lines
1.5 KiB
Markdown
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.
# @dukang/mini-user
杜康好客 C 端微信小程序(Taro 4 + React)。
## 启动
```bash
# H5 预览(联调 API
pnpm --filter @dukang/mini-user dev
# → http://localhost:5177
# 微信小程序
pnpm --filter @dukang/mini-user dev:weapp
# 用微信开发者工具打开 apps/mini-userminiprogramRoot = dist/
```
## API 地址
| 环节 | 文件 | 说明 |
|------|------|------|
| **编译注入** | `config/index.ts``defineConstants.TARO_APP_API_ORIGIN` | 默认 `https://dkapi.runxian.top`;可用环境变量 `VITE_API_TARGET` 覆盖 |
| **运行时拼装** | `src/lib/api.ts``resolveApiBase()` | `{origin}/api/v1`,例如 `https://dkapi.runxian.top/api/v1` |
本地联调 API`localhost:3000`)时,启动前设置环境变量并重新编译:
```powershell
$env:VITE_API_TARGET = "http://localhost:3000"
pnpm dev:mini-user:weapp
```
微信小程序还需在公众平台配置 request 合法域名:`dkapi.runxian.top`
## 约定
- `X-Client-App: USER_MINI`(与 `USER_H5` 共用用户端 APIJWT 与 Header 一致)
- 功能对照源:`apps/h5-user` + `pages/user/` 原型
- 底栏使用本地 PNG 图标(weapp 无法加载 Google Material 字体)
- Tab 页:`navigationStyle: custom` + `TabMainHeader`,对齐 h5 浅色顶栏
## 迁移路线(建议)
1. 登录(短信 → 小程序 `wx.login` + 手机号组件)
2. 商品详情 / 下单 / 支付
3. 订单 3 Tab、权益、核销码
4. 地址管理、门店详情