feat: split DA and API layers by domain, add parallel route docs

This commit is contained in:
2026-08-10 01:56:09 +08:00
parent 68c5e8ee04
commit 0394da6771
38 changed files with 1156 additions and 437 deletions
+5 -5
View File
@@ -30,8 +30,8 @@ smart-engraving-miniapp/
│ │ └── index.ts # TypeScript 类型定义(ProductCategory、DesignItem、OrderItem 等)
│ ├── utils/
│ │ ├── productConfig.ts # 产品品类配置(5 个品类 + iconImg 映射)
│ │ ├── store.ts # Data Access 层(Storage 读写openid 隔离)
│ │ ├── api.ts / request.ts # 后端 HTTP 封装(wx.request + token
│ │ ├── store/ # Data Access 层(按域拆分openid 隔离)
│ │ ├── api/ # 后端 HTTP 封装(按域拆分,wx.request + token
│ │ ├── authState.ts # 登录态校验缓存(isAuthVerified / invalidateAuthCache
│ │ └── themeBackground.ts # 页面窗口背景同步(backgroundColorTop/Bottom
│ ├── context/
@@ -139,16 +139,16 @@ smart-engraving-miniapp/
### 前端 DA 层设计
所有数据操作通过 `src/utils/store.ts` 抽象:
所有数据操作通过 `src/utils/store/` 抽象(按域拆分,详见 `docs/parallel-development-guide.md`
```
pages/
└─ 调用 store.getDesignList() / addDesign() / designToOrder() 等业务接口
└─ store.ts 内封装 Taro.getStorageSync / setStorageSync
└─ store/<domain>.ts 内封装 Taro.getStorageSync / setStorageSync
└─ key = ${scope}_${openid} 实现多用户数据隔离
```
**后端替换方案**上线时只需重写 `store.ts` 中的函数为 `wx.request` HTTP 调用,页面层零改动。
**后端替换方案**按域在 `store/<domain>.ts``api/<domain>.ts` 中替换为 HTTP 调用,页面层零改动。
### Icon 系统(emoji 已完全移除)