Commit fac05cba292fe68ddbbd117e3e5da7f114607526
1 parent
c656f30b
转换成uni-cli项目
Showing
11 changed files
with
173 additions
and
75 deletions
Too many changes to show.
To preserve performance only 11 of 715 files are displayed.
.gitignore
| @@ -19,4 +19,6 @@ gen | @@ -19,4 +19,6 @@ gen | ||
| 19 | /.idea/ | 19 | /.idea/ |
| 20 | /project-wl-kuaidiyuan-android/usbPrinter/build | 20 | /project-wl-kuaidiyuan-android/usbPrinter/build |
| 21 | /project-wl-kuaidiyuan-uniapp-vue3/unpackage | 21 | /project-wl-kuaidiyuan-uniapp-vue3/unpackage |
| 22 | +/project-wl-kuaidiyuan-uniapp-vue3/node_modules | ||
| 23 | +/project-wl-kuaidiyuan-uniapp-vue3/dist | ||
| 22 | /project-wl-kuaidiyuan-android/simpleDemo/src/main/assets/apps | 24 | /project-wl-kuaidiyuan-android/simpleDemo/src/main/assets/apps |
project-wl-kuaidiyuan-uniapp-vue3/CLI_README.md
0 → 100644
| 1 | +# 神领物流快递员端 - Uni-CLI 项目 | ||
| 2 | + | ||
| 3 | +## 项目说明 | ||
| 4 | + | ||
| 5 | +本项目已从 HBuilderX 项目成功转换为 uni-cli 项目,现在支持在 Linux 环境下进行开发和打包。 | ||
| 6 | + | ||
| 7 | +## 项目结构 | ||
| 8 | + | ||
| 9 | +``` | ||
| 10 | +project-wl-kuaidiyuan-uniapp-vue3/ | ||
| 11 | +├── src/ # 源代码目录 | ||
| 12 | +│ ├── pages/ # 页面文件 | ||
| 13 | +│ ├── components/ # 组件 | ||
| 14 | +│ ├── static/ # 静态资源 | ||
| 15 | +│ ├── store/ # Vuex 状态管理 | ||
| 16 | +│ ├── utils/ # 工具函数 | ||
| 17 | +│ ├── styles/ # 样式文件 | ||
| 18 | +│ ├── uni_modules/ # uni-app 插件 | ||
| 19 | +│ ├── App.vue # 应用入口组件 | ||
| 20 | +│ ├── main.js # 应用入口文件 | ||
| 21 | +│ ├── pages.json # 页面配置 | ||
| 22 | +│ └── manifest.json # 应用配置 | ||
| 23 | +├── package.json # 项目依赖配置 | ||
| 24 | +├── vite.config.js # Vite 构建配置 | ||
| 25 | +└── index.html # HTML 模板 | ||
| 26 | + | ||
| 27 | +## 环境要求 | ||
| 28 | + | ||
| 29 | +- Node.js >= 16.0.0 | ||
| 30 | +- npm >= 7.0.0 | ||
| 31 | + | ||
| 32 | +## 安装依赖 | ||
| 33 | + | ||
| 34 | +```bash | ||
| 35 | +npm install | ||
| 36 | +``` | ||
| 37 | + | ||
| 38 | +## 开发命令 | ||
| 39 | + | ||
| 40 | +### H5 开发 | ||
| 41 | +```bash | ||
| 42 | +npm run dev:h5 | ||
| 43 | +``` | ||
| 44 | + | ||
| 45 | +### 小程序开发 | ||
| 46 | +```bash | ||
| 47 | +# 微信小程序 | ||
| 48 | +npm run dev:mp-weixin | ||
| 49 | + | ||
| 50 | +# 支付宝小程序 | ||
| 51 | +npm run dev:mp-alipay | ||
| 52 | + | ||
| 53 | +# 百度小程序 | ||
| 54 | +npm run dev:mp-baidu | ||
| 55 | + | ||
| 56 | +# QQ小程序 | ||
| 57 | +npm run dev:mp-qq | ||
| 58 | + | ||
| 59 | +# 头条小程序 | ||
| 60 | +npm run dev:mp-toutiao | ||
| 61 | +``` | ||
| 62 | + | ||
| 63 | +### App 开发 | ||
| 64 | +```bash | ||
| 65 | +# Android | ||
| 66 | +npm run dev:app-android | ||
| 67 | + | ||
| 68 | +# iOS | ||
| 69 | +npm run dev:app-ios | ||
| 70 | + | ||
| 71 | +# 通用 App | ||
| 72 | +npm run dev:app | ||
| 73 | +``` | ||
| 74 | + | ||
| 75 | +## 生产构建 | ||
| 76 | + | ||
| 77 | +### H5 构建 | ||
| 78 | +```bash | ||
| 79 | +npm run build:h5 | ||
| 80 | +``` | ||
| 81 | + | ||
| 82 | +### 小程序构建 | ||
| 83 | +```bash | ||
| 84 | +# 微信小程序 | ||
| 85 | +npm run build:mp-weixin | ||
| 86 | + | ||
| 87 | +# 支付宝小程序 | ||
| 88 | +npm run build:mp-alipay | ||
| 89 | + | ||
| 90 | +# 其他小程序平台... | ||
| 91 | +``` | ||
| 92 | + | ||
| 93 | +### App 构建 | ||
| 94 | +```bash | ||
| 95 | +# Android | ||
| 96 | +npm run build:app-android | ||
| 97 | + | ||
| 98 | +# iOS | ||
| 99 | +npm run build:app-ios | ||
| 100 | + | ||
| 101 | +# 通用 App | ||
| 102 | +npm run build:app | ||
| 103 | +``` | ||
| 104 | + | ||
| 105 | +## 构建输出 | ||
| 106 | + | ||
| 107 | +构建完成后,文件将输出到 `dist/build/` 目录下: | ||
| 108 | + | ||
| 109 | +- H5: `dist/build/h5/` | ||
| 110 | +- 小程序: `dist/build/mp-[平台]/` | ||
| 111 | +- App: `dist/build/app/` | ||
| 112 | + | ||
| 113 | +## App 打包说明 | ||
| 114 | + | ||
| 115 | +### Android 打包 | ||
| 116 | + | ||
| 117 | +1. 执行构建命令: | ||
| 118 | + ```bash | ||
| 119 | + npm run build:app-android | ||
| 120 | + ``` | ||
| 121 | + | ||
| 122 | +2. 构建完成后,打开 HBuilderX,导入 `dist/build/app` 目录 | ||
| 123 | + | ||
| 124 | +3. 在 HBuilderX 中进行云打包或本地打包 | ||
| 125 | + | ||
| 126 | +### Linux 环境下的替代方案 | ||
| 127 | + | ||
| 128 | +由于 App 的最终打包仍需要原生环境,在 Linux 下有以下选择: | ||
| 129 | + | ||
| 130 | +1. **使用 HBuilderX Linux 版本**(推荐) | ||
| 131 | + - 下载 HBuilderX Linux 版本 | ||
| 132 | + - 导入 `dist/build/app` 目录进行打包 | ||
| 133 | + | ||
| 134 | +2. **使用离线打包** | ||
| 135 | + - 将 `dist/build/app` 目录中的资源集成到原生 Android/iOS 工程 | ||
| 136 | + - 使用 Android Studio 或 Xcode 进行打包 | ||
| 137 | + | ||
| 138 | +3. **CI/CD 集成** | ||
| 139 | + - 在 CI/CD 流程中使用 uni-cli 构建 | ||
| 140 | + - 构建产物可以上传到云打包服务 | ||
| 141 | + | ||
| 142 | +## 主要变更 | ||
| 143 | + | ||
| 144 | +从 HBuilderX 项目转换为 uni-cli 项目的主要变更: | ||
| 145 | + | ||
| 146 | +1. ✅ 添加了 `package.json`,包含完整的依赖和构建脚本 | ||
| 147 | +2. ✅ 添加了 `vite.config.js` 配置文件 | ||
| 148 | +3. ✅ 源代码移动到 `src/` 目录 | ||
| 149 | +4. ✅ 添加了 vuex 依赖(项目使用了状态管理) | ||
| 150 | +5. ✅ 配置了所有主流平台的开发和构建命令 | ||
| 151 | + | ||
| 152 | +## 依赖版本 | ||
| 153 | + | ||
| 154 | +- Vue: 3.3.4 | ||
| 155 | +- Vite: 5.2.8 | ||
| 156 | +- Vuex: 4.0.2 | ||
| 157 | +- @dcloudio/vite-plugin-uni: 3.0.0-alpha-4080720251125001 | ||
| 158 | + | ||
| 159 | +## 注意事项 | ||
| 160 | + | ||
| 161 | +1. 构建时会有一些 SASS 弃用警告,这是 uni-app 内置样式库的问题,不影响功能 | ||
| 162 | +2. 开发时建议使用 H5 模式进行快速调试:`npm run dev:h5` | ||
| 163 | +3. App 打包前请确保 manifest.json 中的配置正确 | ||
| 164 | +4. 首次构建可能需要较长时间,请耐心等待 | ||
| 165 | + | ||
| 166 | +## 技术支持 | ||
| 167 | + | ||
| 168 | +如有问题,请参考: | ||
| 169 | +- [uni-app 官方文档](https://uniapp.dcloud.net.cn/) | ||
| 170 | +- [Vite 官方文档](https://vitejs.dev/) |
project-wl-kuaidiyuan-uniapp-vue3/index.html
| @@ -9,6 +9,6 @@ | @@ -9,6 +9,6 @@ | ||
| 9 | </head> | 9 | </head> |
| 10 | <body> | 10 | <body> |
| 11 | <div id="app"><!--app-html--></div> | 11 | <div id="app"><!--app-html--></div> |
| 12 | - <script type="module" src="/main.js"></script> | 12 | + <script type="module" src="/src/main.js"></script> |
| 13 | </body> | 13 | </body> |
| 14 | </html> | 14 | </html> |
project-wl-kuaidiyuan-uniapp-vue3/node_modules/_esbuild-windows-64@0.14.53@esbuild-windows-64/README.md deleted
100644 → 0
project-wl-kuaidiyuan-uniapp-vue3/node_modules/_esbuild-windows-64@0.14.53@esbuild-windows-64/bin/esbuild deleted
100644 → 0
| 1 | -#!/usr/bin/env node | ||
| 2 | - | ||
| 3 | -// Unfortunately even though npm shims "bin" commands on Windows with auto- | ||
| 4 | -// generated forwarding scripts, it doesn't strip the ".exe" from the file name | ||
| 5 | -// first. So it's possible to publish executables via npm on all platforms | ||
| 6 | -// except Windows. I consider this a npm bug. | ||
| 7 | -// | ||
| 8 | -// My workaround is to add this script as another layer of indirection. It'll | ||
| 9 | -// be slower because node has to boot up just to shell out to the actual exe, | ||
| 10 | -// but Windows is somewhat of a second-class platform to npm so it's the best | ||
| 11 | -// I can do I think. | ||
| 12 | -const esbuild_exe = require.resolve('esbuild-windows-64/esbuild.exe'); | ||
| 13 | -const child_process = require('child_process'); | ||
| 14 | -child_process.spawnSync(esbuild_exe, process.argv.slice(2), { stdio: 'inherit' }); |
project-wl-kuaidiyuan-uniapp-vue3/node_modules/_esbuild-windows-64@0.14.53@esbuild-windows-64/esbuild.exe deleted
100644 → 0
No preview for this file type
project-wl-kuaidiyuan-uniapp-vue3/node_modules/_esbuild-windows-64@0.14.53@esbuild-windows-64/package.json deleted
100644 → 0
| 1 | -{ | ||
| 2 | - "name": "esbuild-windows-64", | ||
| 3 | - "version": "0.14.53", | ||
| 4 | - "description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.", | ||
| 5 | - "repository": "https://github.com/evanw/esbuild", | ||
| 6 | - "license": "MIT", | ||
| 7 | - "preferUnplugged": false, | ||
| 8 | - "engines": { | ||
| 9 | - "node": ">=12" | ||
| 10 | - }, | ||
| 11 | - "os": [ | ||
| 12 | - "win32" | ||
| 13 | - ], | ||
| 14 | - "cpu": [ | ||
| 15 | - "x64" | ||
| 16 | - ], | ||
| 17 | - "__npminstall_done": true, | ||
| 18 | - "_from": "esbuild-windows-64@0.14.53", | ||
| 19 | - "_resolved": "https://registry.npmmirror.com/esbuild-windows-64/-/esbuild-windows-64-0.14.53.tgz" | ||
| 20 | -} | ||
| 21 | \ No newline at end of file | 0 | \ No newline at end of file |
project-wl-kuaidiyuan-uniapp-vue3/node_modules/esbuild-windows-64/README.md deleted
100644 → 0
project-wl-kuaidiyuan-uniapp-vue3/node_modules/esbuild-windows-64/bin/esbuild deleted
100644 → 0
| 1 | -#!/usr/bin/env node | ||
| 2 | - | ||
| 3 | -// Unfortunately even though npm shims "bin" commands on Windows with auto- | ||
| 4 | -// generated forwarding scripts, it doesn't strip the ".exe" from the file name | ||
| 5 | -// first. So it's possible to publish executables via npm on all platforms | ||
| 6 | -// except Windows. I consider this a npm bug. | ||
| 7 | -// | ||
| 8 | -// My workaround is to add this script as another layer of indirection. It'll | ||
| 9 | -// be slower because node has to boot up just to shell out to the actual exe, | ||
| 10 | -// but Windows is somewhat of a second-class platform to npm so it's the best | ||
| 11 | -// I can do I think. | ||
| 12 | -const esbuild_exe = require.resolve('esbuild-windows-64/esbuild.exe'); | ||
| 13 | -const child_process = require('child_process'); | ||
| 14 | -child_process.spawnSync(esbuild_exe, process.argv.slice(2), { stdio: 'inherit' }); |
project-wl-kuaidiyuan-uniapp-vue3/node_modules/esbuild-windows-64/esbuild.exe deleted
100644 → 0
No preview for this file type
project-wl-kuaidiyuan-uniapp-vue3/node_modules/esbuild-windows-64/package.json deleted
100644 → 0
| 1 | -{ | ||
| 2 | - "name": "esbuild-windows-64", | ||
| 3 | - "version": "0.14.53", | ||
| 4 | - "description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.", | ||
| 5 | - "repository": "https://github.com/evanw/esbuild", | ||
| 6 | - "license": "MIT", | ||
| 7 | - "preferUnplugged": false, | ||
| 8 | - "engines": { | ||
| 9 | - "node": ">=12" | ||
| 10 | - }, | ||
| 11 | - "os": [ | ||
| 12 | - "win32" | ||
| 13 | - ], | ||
| 14 | - "cpu": [ | ||
| 15 | - "x64" | ||
| 16 | - ], | ||
| 17 | - "__npminstall_done": true, | ||
| 18 | - "_from": "esbuild-windows-64@0.14.53", | ||
| 19 | - "_resolved": "https://registry.npmmirror.com/esbuild-windows-64/-/esbuild-windows-64-0.14.53.tgz" | ||
| 20 | -} | ||
| 21 | \ No newline at end of file | 0 | \ No newline at end of file |