diff --git a/mini_program/driver-mp/.env.development b/mini_program/driver-mp/.env.development new file mode 100644 index 0000000..0d59fd9 --- /dev/null +++ b/mini_program/driver-mp/.env.development @@ -0,0 +1,3 @@ +# 开发环境配置 +VUE_APP_API_BASE_URL=http://localhost:3002/api/driver +VUE_APP_USE_MOCK=false \ No newline at end of file diff --git a/mini_program/driver-mp/.env.production b/mini_program/driver-mp/.env.production new file mode 100644 index 0000000..f5565ae --- /dev/null +++ b/mini_program/driver-mp/.env.production @@ -0,0 +1,3 @@ +# 生产环境配置 +VUE_APP_API_BASE_URL=https://yourdomain.com/api/driver +VUE_APP_USE_MOCK=false \ No newline at end of file diff --git a/mini_program/driver-mp/README.md b/mini_program/driver-mp/README.md new file mode 100644 index 0000000..0ab3d37 --- /dev/null +++ b/mini_program/driver-mp/README.md @@ -0,0 +1,122 @@ +# 司机端小程序 + +活牛运输司机小程序,用于活牛采购智能数字化系统中的运输环节管理。 + +## 项目介绍 + +司机端小程序是活牛采购智能数字化系统的重要组成部分,主要服务于活牛运输司机,提供任务接收、位置上报、状态监控、交付确认等功能。 + +## 功能特性 + +- 用户认证:手机号验证码登录 +- 任务管理:查看、接受、拒绝运输任务 +- 运输监控:实时位置上报、牛只状态监控 +- 车辆管理:车辆信息维护 +- 交付确认:完成运输任务并确认交付 + +## 技术栈 + +- 框架:uni-app + Vue 3 +- 状态管理:Pinia +- 语言:JavaScript/TypeScript +- 构建工具:Vite +- UI:uni-ui + +## 目录结构 + +``` +src/ +├── components/ # 公共组件 +├── pages/ # 页面 +│ ├── auth/ # 认证相关页面 +│ ├── index/ # 首页 +│ ├── task/ # 任务相关页面 +│ ├── transport/ # 运输相关页面 +│ ├── delivery/ # 交付相关页面 +│ └── vehicle/ # 车辆相关页面 +├── static/ # 静态资源 +├── stores/ # 状态管理 +├── utils/ # 工具函数 +├── App.vue # 根组件 +├── main.js # 入口文件 +├── manifest.json # 项目配置 +└── pages.json # 页面配置 +``` + +## 开发环境 + +### 环境要求 + +- Node.js >= 16.0.0 +- 微信开发者工具 + +### 安装依赖 + +```bash +npm install +``` + +### 启动开发服务器 + +```bash +# 启动微信小程序开发环境 +npm run dev + +# 启动H5开发环境 +npm run dev:h5 +``` + +### 构建生产版本 + +```bash +# 构建微信小程序生产版本 +npm run build + +# 构建H5生产版本 +npm run build:h5 +``` + +## 页面说明 + +| 页面路径 | 功能说明 | +|---------|---------| +| /pages/auth/login | 登录页面 | +| /pages/index/index | 首页 | +| /pages/task/task-list | 任务列表 | +| /pages/task/task-detail | 任务详情 | +| /pages/transport/location-report | 位置上报 | +| /pages/transport/status-report | 状态上报 | +| /pages/delivery/delivery-confirm | 交付确认 | +| /pages/vehicle/vehicle-info | 车辆信息 | + +## 状态管理 + +使用 Pinia 进行状态管理,包含以下模块: + +- user: 用户信息管理 +- task: 任务信息管理 + +## 网络请求 + +封装了统一的网络请求模块,包含: + +- request.js: 基础请求封装 +- api.js: 接口封装 + +## 工具函数 + +包含常用的工具函数: + +- formatDate: 时间格式化 +- debounce: 防抖函数 +- throttle: 节流函数 +- deepClone: 深拷贝 +- validatePhone: 手机号验证 +- validatePlateNumber: 车牌号验证 + +## 注意事项 + +1. 开发时请遵循项目代码规范 +2. 新增页面需要在 pages.json 中注册 +3. 接口请求统一使用封装的 request 模块 +4. 状态管理使用 Pinia,避免直接操作全局数据 \ No newline at end of file diff --git a/mini_program/driver-mp/package.json b/mini_program/driver-mp/package.json index f0e5ab2..bfc2f47 100644 --- a/mini_program/driver-mp/package.json +++ b/mini_program/driver-mp/package.json @@ -2,12 +2,25 @@ "name": "driver-mp", "version": "1.0.0", "description": "活牛运输司机小程序", - "main": "main.js", + "main": "src/main.js", "scripts": { - "dev": "uni -p mp-weixin" + "dev": "uni -p mp-weixin", + "build": "uni build -p mp-weixin", + "dev:h5": "uni -p h5", + "build:h5": "uni build -p h5" }, "dependencies": { "@dcloudio/uni-app": "^3.0.0", - "pinia": "^2.0.0" + "@dcloudio/uni-ui": "^1.4.0", + "pinia": "^2.0.0", + "@dcloudio/uni-components": "^3.0.0" + }, + "devDependencies": { + "@dcloudio/uni-cli-shared": "^3.0.0", + "@dcloudio/uni-template-compiler": "^3.0.0", + "@dcloudio/types": "^3.3.0", + "typescript": "^5.0.0", + "vite": "^4.4.0", + "@vue/tsconfig": "^0.1.3" } } \ No newline at end of file diff --git a/mini_program/driver-mp/src/App.vue b/mini_program/driver-mp/src/App.vue new file mode 100644 index 0000000..45531dc --- /dev/null +++ b/mini_program/driver-mp/src/App.vue @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/mini_program/driver-mp/src/main.js b/mini_program/driver-mp/src/main.js new file mode 100644 index 0000000..4f64df3 --- /dev/null +++ b/mini_program/driver-mp/src/main.js @@ -0,0 +1,11 @@ +import { createSSRApp } from 'vue'; +import App from './App.vue'; +import store from './stores'; + +export function createApp() { + const app = createSSRApp(App); + app.use(store); + return { + app + }; +} \ No newline at end of file diff --git a/mini_program/driver-mp/src/manifest.json b/mini_program/driver-mp/src/manifest.json new file mode 100644 index 0000000..5038302 --- /dev/null +++ b/mini_program/driver-mp/src/manifest.json @@ -0,0 +1,19 @@ +{ + "name": "driver-mp", + "appid": "__UNI__DRIVERMP", + "description": "活牛运输司机小程序", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "mp-weixin": { + "appid": "wx-your-driver-appid-here", + "setting": { + "urlCheck": false, + "es6": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + }, + "vueVersion": "3" +} \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages.json b/mini_program/driver-mp/src/pages.json new file mode 100644 index 0000000..05acad7 --- /dev/null +++ b/mini_program/driver-mp/src/pages.json @@ -0,0 +1,84 @@ +{ + "pages": [ + { + "path": "pages/auth/login", + "style": { + "navigationBarTitleText": "登录" + } + }, + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "司机首页" + } + }, + { + "path": "pages/task/task-list", + "style": { + "navigationBarTitleText": "任务列表" + } + }, + { + "path": "pages/task/task-detail", + "style": { + "navigationBarTitleText": "任务详情" + } + }, + { + "path": "pages/transport/location-report", + "style": { + "navigationBarTitleText": "位置上报" + } + }, + { + "path": "pages/transport/status-report", + "style": { + "navigationBarTitleText": "状态上报" + } + }, + { + "path": "pages/delivery/delivery-confirm", + "style": { + "navigationBarTitleText": "交付确认" + } + }, + { + "path": "pages/vehicle/vehicle-info", + "style": { + "navigationBarTitleText": "车辆信息" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "司机端", + "navigationBarBackgroundColor": "#f8f8f8", + "backgroundColor": "#f8f8f8" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#1989fa", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "static/tabbar/home.png", + "selectedIconPath": "static/tabbar/home-active.png", + "text": "首页" + }, + { + "pagePath": "pages/task/task-list", + "iconPath": "static/tabbar/task.png", + "selectedIconPath": "static/tabbar/task-active.png", + "text": "任务" + }, + { + "pagePath": "pages/transport/location-report", + "iconPath": "static/tabbar/location.png", + "selectedIconPath": "static/tabbar/location-active.png", + "text": "运输" + } + ] + } +} \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages/auth/login.vue b/mini_program/driver-mp/src/pages/auth/login.vue new file mode 100644 index 0000000..92c6c8f --- /dev/null +++ b/mini_program/driver-mp/src/pages/auth/login.vue @@ -0,0 +1,241 @@ + + + + + \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages/delivery/delivery-confirm.vue b/mini_program/driver-mp/src/pages/delivery/delivery-confirm.vue new file mode 100644 index 0000000..da45874 --- /dev/null +++ b/mini_program/driver-mp/src/pages/delivery/delivery-confirm.vue @@ -0,0 +1,342 @@ + + + + + \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages/index/index.vue b/mini_program/driver-mp/src/pages/index/index.vue new file mode 100644 index 0000000..f721cb0 --- /dev/null +++ b/mini_program/driver-mp/src/pages/index/index.vue @@ -0,0 +1,420 @@ + + + + + \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages/task/task-detail.vue b/mini_program/driver-mp/src/pages/task/task-detail.vue new file mode 100644 index 0000000..60f75b4 --- /dev/null +++ b/mini_program/driver-mp/src/pages/task/task-detail.vue @@ -0,0 +1,287 @@ + + + + + \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages/task/task-list.vue b/mini_program/driver-mp/src/pages/task/task-list.vue new file mode 100644 index 0000000..e6ca93c --- /dev/null +++ b/mini_program/driver-mp/src/pages/task/task-list.vue @@ -0,0 +1,210 @@ + + + + + \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages/transport/location-report.vue b/mini_program/driver-mp/src/pages/transport/location-report.vue new file mode 100644 index 0000000..f86ffde --- /dev/null +++ b/mini_program/driver-mp/src/pages/transport/location-report.vue @@ -0,0 +1,266 @@ + + + + + \ No newline at end of file diff --git a/mini_program/driver-mp/src/pages/transport/status-report.vue b/mini_program/driver-mp/src/pages/transport/status-report.vue new file mode 100644 index 0000000..1fc5f9e --- /dev/null +++ b/mini_program/driver-mp/src/pages/transport/status-report.vue @@ -0,0 +1,354 @@ + + +