Files

82 lines
3.6 KiB
Markdown
Raw Permalink 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.
# 山峡化工 · 微信小程序(miniprogram)
基于 [uni-app](https://uniapp.dcloud.net.cn/) 的微信小程序工程。地磅业务 UI 使用自研 `components/db-ui/*`(视觉对齐 mobile-h5 Vant4 主色 `#52B788`)。
> 说明:`@vant/weapp` 依赖微信原生 `Behavior`,在 uni-app H5/Vite 下会报 `Behavior is not defined`,故地磅页不直接引用 Weapp 组件。
## 技术栈
- uni-app(Vue 3 + Composition API)
- Pinia + Vuex(遗留壳)
- 地磅 UI:`components/db-ui`(对齐 Vant 视觉)
- RSA 登录加密 + `utils/request.js` / 地磅 `utils/dbRequest.js`
## 已接通业务:地磅管理
工作台「地磅管理」四菜单(自 `mobile-h5` 迁移):
| 菜单 | 路径 |
|------|------|
| 仪表盘 | `pages/db/dashboard/index` |
| 计划管理 | `pages/db/plans/*` |
| 出入库管理 | `pages/db/inventory/*` |
| 地磅单管理 | `pages/db/weighing/*` |
- API:`pages/db/api/db.js`(分包内,避免占用主包)→ `/dashboard` `/plans` `/inventory` `/weighing`(裸 JSON)
- 表单选择:`api/dbOptions.js`(CRM 客户/产品 + 运输车辆;主包组件共用)
- 日期工具:`pages/db/utils/dbDate.js`
- 样式:`styles/db-theme.scss`(局部主题,不改全局三墙壳色)
- 仪表盘图表:数字卡片 + 简易条形列表(非 ECharts)
未迁:基础资料/用户管理菜单、免登录第三方填写页。
## 壳页面
登录 / 首页 / 待办 / 工作台 / 我的;CRM / 报销 / 运输菜单仍为灰卡。
## 本地开发
1. HBuilderX 打开 `miniprogram/`(`manifest.json` → `mp-weixin.appid` 已填生产 AppID)
2. 环境开关:只改 `config/env.js` 的 **`APP_ENV`**(勿再单独改地址)
- `local`:本机 API + 本机 H5
- `test`:测试门户 API + H5(`121.43.228.102:9911`)
- `testLocalH5`:测试 API + 本机 H5(仅联调 webview 样式)
- `production`:生产 `https://w.shanxiachem.com`
3. 启动 `backend/`(local 时)→ 运行到微信开发者工具
上生产时:将 `APP_ENV` 改为 `'production'` 即可,无需再改其它 URL。
### 正式发版上传(微信)
**务必先确认环境,再发行上传**(HBuilderX 不会自动改 `APP_ENV`):
1. 终端执行 `npm run env:show` 查看当前 `APP_ENV`;或打开小程序看底部彩色条 / 启动弹窗
2. 改为生产:`config/env.js` 中 `export const APP_ENV = 'production'`
3. `npm run release:check-api`(非 production 会直接失败,禁止继续)
4. HBuilderX:**发行 → 小程序-微信**(会压缩 JS)
5. 用发行产物在微信开发者工具中上传
非生产包在登录页 / 工作台 / 我的底部有常驻环境条(本机=红、测试=橙),启动也会弹窗提示。
已配置:`pages/db`、`pages/bx` 分包;`lazyCodeLoading=requiredComponents`;`mp-weixin.setting.minified=true`。
```bash
cd miniprogram
npm install
npm run release:check-api # 发版前:要求 APP_ENV=production
```
### 生产信息(来自 https://w.shanxiachem.com/)
| 项 | 地址 |
|----|------|
| Web | https://w.shanxiachem.com/ |
| API | https://w.shanxiachem.com/api |
| 静态资源 | https://w.shanxiachem.com/shanxia-static/ |
| MinIO 附件 | https://res.shanxiachem.com/ruoyi |
| 微信 AppID | `wx7db1ddb2a90c9425` |
微信公众平台合法域名请配置:`w.shanxiachem.com`(request / uploadFile / downloadFile)。
维护入口:[小程序工程规则](AGENTS.md)、[小程序 UI 规范](../docs/miniprogram-ui-spec-sanqiang.md);地磅页面与公共组件见上文「已接通业务:地磅管理」。