Files
OpticalSystem/uniapp/README.md
一休哥哥6666 721543f423 feat:uniapp模块
2026-07-14 14:53:45 +08:00

87 lines
3.0 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.

# 功能镜片配镜系统 - UniApp 移动端
基于 `developer-front` 门户端的 UniApp 实现,覆盖认证、配片单/制片单、消息通知、账户中心等核心业务。
## 项目结构
```
uniapp/
├── src/
│ ├── api/ # 接口封装
│ ├── components/ # NavBar、DictTag
│ ├── config/ # API 配置
│ ├── pages/ # 页面
│ ├── store/ # Pinia 状态
│ ├── utils/ # 工具函数
│ ├── App.vue
│ ├── main.js
│ ├── pages.json
│ └── manifest.json
├── index.html
├── vite.config.js
└── package.json
```
## 快速开始
```bash
cd uniapp
npm install
npm run dev:h5
```
默认端口 `2093`API 代理至 `http://localhost:8082/dev-api`
## 与 developer-front 的对应关系
| Web 端 | UniApp |
|--------|--------|
| Cookie Developer-Token | uni.setStorageSync |
| axios + Element UI | uni.request + 原生组件 |
| vue-router | pages.json |
| Vuex | Pinia |
| NavBar.vue | components/NavBar |
| lens-order.vue | pages/order/lens-order |
| factory-order.vue | pages/order/factory-order |
## Android 编译器/SDK 版本不匹配
若 APK 提示「HBuilderX 4.15 编译SDK 5.07 不匹配」:
- **原因:** CLI 项目编译器在 `package.json`,不随 HBuilderX 升级;云打包 SDK 已是 5.x。
- **处理:** HBuilderX 升级到 **5.07** → 执行 `npm run update:uni``npm install` → 删除 `unpackage` → 重新云打包。
- **验证后可选:** `manifest.json``app-plus.compatible.ignoreVersion` 设为 `true` 关闭弹窗。
## APK 卡在 Logo 启动页
1. 已在 `App.vue` 中调用 `plus.navigator.closeSplashscreen()` 手动关闭启动页
2. CLI 构建产物里 `autoclose` 可能为 `false`,需重新云打包
3. **adb 包名过滤错误**AppID 为 `__UNI__C17C074`,应使用:
```powershell
adb logcat -c
adb logcat | findstr /i "UNIC17C074 DCloud console uni-app JS"
adb logcat *:E | findstr /i "uni dcloud"
```
4. 查看已安装包名:`adb shell pm list packages | findstr uni`
## AppID 配置(打包 Android/iOS 必做)
CLI 创建的项目不会自动生成 AppID需在 **HBuilderX** 中获取并写入 `src/manifest.json`
1. 安装 [HBuilderX](https://www.dcloud.io/hbuilderx.html),使用 DCloud 账号登录
2. **文件 → 打开目录**,选择本项目的 `uniapp` 文件夹
3. 打开 `src/manifest.json`,切换到 **「基础配置」** 可视化界面
4. 点击 **「应用标识(AppID)」** 右侧的 **「重新获取」**
5. 保存后,`appid` 会自动写入(格式类似 `__UNI__1A2B3C4`
也可在 [DCloud 开发者中心](https://dev.dcloud.net.cn) 手动创建应用,将生成的 AppID 粘贴到 `manifest.json` 的 `"appid"` 字段。
> AppID 与 DCloud 账号绑定,请勿使用他人 AppID 或随意编造(如 `__UNI__OPTICAL_SYSTEM`)。
## 待完善项
- 收货地址 CRUD
- 商城模块
- 配片单完整验光表单与附件上传
- 小程序/App 支付