diff --git a/ak/config.uts b/ak/config.uts index 690cbaab..6035d50e 100644 --- a/ak/config.uts +++ b/ak/config.uts @@ -6,15 +6,15 @@ //自己的配置自己解开即可 //export const SUPA_URL: string = 'http://192.168.1.61:18000' //export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' -//export const SUPA_URL: string = 'http://192.168.1.62:18000' -//export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' -export const SUPA_URL: string = 'http://192.168.1.63:18000' -export const SUPA_KEY: string = 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJyb2xlIjogImFub24iLCAiaXNzIjogInN1cGFiYXNlIiwgImlhdCI6IDE3Njk4NDczMzQsICJleHAiOiAyMDg1MjA3MzM0fQ.js-2CS5_cUmf4iVv8aCmmx9iyFsQvLNDbt8YYOngeLU' +export const SUPA_URL: string = 'http://192.168.1.62:18000' +export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' +// export const SUPA_URL: string = 'http://192.168.1.63:18000' +// export const SUPA_KEY: string = 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJyb2xlIjogImFub24iLCAiaXNzIjogInN1cGFiYXNlIiwgImlhdCI6IDE3Njk4NDczMzQsICJleHAiOiAyMDg1MjA3MzM0fQ.js-2CS5_cUmf4iVv8aCmmx9iyFsQvLNDbt8YYOngeLU' // WebSocket 实时连接(内网使用 ws:// 而非 wss://) // export const WS_URL: string = 'ws://192.168.1.61:18000/realtime/v1/websocket' -//export const WS_URL: string = 'ws://192.168.1.62:18000/realtime/v1/websocket' -export const WS_URL: string = 'ws://192.168.1.63:18000/realtime/v1/websocket' +export const WS_URL: string = 'ws://192.168.1.62:18000/realtime/v1/websocket' +// export const WS_URL: string = 'ws://192.168.1.63:18000/realtime/v1/websocket' // 备用配置(已注释,如需切换可取消注释) // 开发环境 - 其他内网地址 diff --git a/pages.json b/pages.json index 104a6e64..c2b7c1fa 100644 --- a/pages.json +++ b/pages.json @@ -1,12 +1,5 @@ { "pages": [ - { - "path": "pages/mall/admin/homePage/index", - "style": { - "navigationBarTitleText": "管理后台", - "navigationStyle": "custom" - } - }, { "path": "pages/user/login", "style": { diff --git a/pages/mall/analytics/profile.uvue b/pages/mall/analytics/profile.uvue index d0d6c65c..3b4c99d4 100644 --- a/pages/mall/analytics/profile.uvue +++ b/pages/mall/analytics/profile.uvue @@ -1013,8 +1013,6 @@ function goToFeedback() { font-size: 22rpx; color: #8c929b; } - color: #999; -} .trend-legend { display: flex; diff --git a/pages/mall/delivery/delivery.md b/pages/mall/delivery/delivery.md deleted file mode 100644 index 0f8863a2..00000000 --- a/pages/mall/delivery/delivery.md +++ /dev/null @@ -1,190 +0,0 @@ - ---- - -# 🚚 配送端模块项目结构说明(`/pages/mall/delivery/`) - -> 本模块为配送员使用的移动端应用核心功能区,涵盖个人中心、任务管理、收入统计、车辆管理等核心功能。 - ---- - -## 📁 目录结构概览 - -``` -delivery/ -├── index.uvue # 配送端首页(工作台) -├── profile.uvue # 个人中心 -├── profile-edit.uvue # 编辑个人信息 -├── settings.uvue # 设置页面 -├── tasks.uvue # 配送任务列表(按状态筛选) -├── task-detail.uvue # 单个任务详情页 -├── order-history.uvue # 历史订单列表 -├── order-detail.uvue # 订单详情页(从历史或当前跳转) -├── earnings.uvue # 收入明细 -├── ratings.uvue # 评价记录 -├── vehicle.uvue # 车辆管理主页 -├── vehicle-add.uvue # 添加车辆 -├── vehicle-edit.uvue # 编辑车辆信息 -└── index.uvue # 首页(与上面重复?应统一命名) -``` - -> 💡 注:`index.uvue` 出现两次,建议保留一个作为首页入口,另一个可重命名为 `dashboard.uvue` 或 `home.uvue` - ---- - -## 🧭 各页面功能说明 - -### 1. `index.uvue` —— **配送端首页 / 工作台** -- ✅ 核心入口页面 -- 📍 展示当前任务、今日数据、快捷操作入口 -- 🔄 可跳转到“个人中心”、“任务列表”、“收入明细”等 - ---- - -### 2. `profile.uvue` —— **个人中心** -- 👤 显示配送员基本信息(头像、姓名、评分、总单数) -- 📊 展示今日配送数据(完成单数、收入、里程、准时率) -- 📈 收入统计图表(最近7天) -- 🚗 功能菜单:收入明细、车辆管理、评价记录、帮助中心、意见反馈 - ---- - -### 3. `profile-edit.uvue` —— **编辑个人信息** -- 🖋️ 修改头像、姓名、身份证号、驾驶证、车辆信息、服务区域等 -- 📱 界面包含表单输入 + 保存按钮 -- ⬅️ 左上角返回按钮(箭头+文字垂直排列) -- 💾 数据本地模拟或调用API更新 - ---- - -### 4. `settings.uvue` —— **设置页面** -- ⚙️ 通用设置项(如通知、隐私、退出登录等) -- 🔐 安全相关设置(修改密码、绑定手机等) -- 📲 通常由 `profile.uvue` 中的“⚙️”图标进入 - ---- - -### 5. `tasks.uvue` —— **配送任务列表** -- 📋 按状态分类展示任务: - - 全部任务 - - 待接单 - - 配送中 - - 已完成 -- 🚀 点击任一任务 → 跳转至 `task-detail.uvue` -- 📈 页面顶部有“工作状态”切换开关(工作中/休息中) - ---- - -### 6. `task-detail.uvue` —— **任务详情页** -- 📍 显示取货地址、送达地址、距离、预计时间 -- 📞 “联系客户”按钮 -- 📝 查看任务详情(可选) -- ✅ 适用于“当前任务”或“待接单”的操作场景 - ---- - -### 7. `order-history.uvue` —— **历史订单列表** -- 📜 展示已完成、已接受、配送中的历史订单 -- 📌 包含订单号、状态、取送货地址、配送费、距离、时间 -- 🔍 点击“查看详情” → 跳转至 `order-detail.uvue`,并携带参数 `?from=history` -- 📅 支持查看“已完成”的订单(仅显示“联系客服”按钮) - ---- - -### 8. `order-detail.uvue` —— **订单详情页(多来源)** -- 🔄 从 `tasks.uvue` 或 `order-history.uvue` 进入 -- 🎯 **关键逻辑**: - - 若来自历史订单(`from=history`)且状态为“已完成” → 只显示“联系客服” - - 若来自历史订单且状态为“进行中” → 显示“接受/拒绝/导航/完成”等操作按钮 - - 若非历史来源 → 显示完整操作按钮 -- 📞 包含联系顾客、联系商家、联系客服三个联系方式 - ---- - -### 9. `earnings.uvue` —— **收入明细** -- 💰 展示总收入、用户打赏、商家打赏、总订单数 -- 📊 按订单聚合的收入数据列表 -- 📈 图表展示最近7天收入趋势 -- ➕ 加载更多按钮 - ---- - -### 10. `ratings.uvue` —— **评价记录** -- ⭐ 展示用户对配送员的评价 -- 📝 包含评分、评价内容、订单号、时间 -- 📊 统计平均分、好评率等 - ---- - -### 11. `vehicle.uvue` —— **车辆管理主页** -- 🚗 列出当前绑定的所有车辆 -- ➕ “添加车辆”按钮 -- 🖋️ 点击车辆 → 跳转至 `vehicle-edit.uvue` -- 🗑️ 支持删除、设为主用车等操作 - ---- - -### 12. `vehicle-add.uvue` —— **添加车辆** -- 📝 表单填写:车牌号、车型、行驶证照片、车辆类型等 -- ✅ 提交后绑定到当前账户 -- ⬅️ 返回车辆管理页 - ---- - -### 13. `vehicle-edit.uvue` —— **编辑车辆信息** -- 🖋️ 修改已有车辆信息(车牌、车型、照片等) -- 📸 支持重新上传行驶证照片 -- ✅ 保存后更新车辆信息 - ---- - -## 🔄 页面跳转关系图(简化版) - -``` -index.uvue - │ - ├──→ profile.uvue → profile-edit.uvue - │ - ├──→ tasks.uvue → task-detail.uvue - │ - ├──→ order-history.uvue → order-detail.uvue (from=history) - │ - ├──→ earnings.uvue - │ - ├──→ ratings.uvue - │ - └──→ vehicle.uvue → vehicle-add.uvue / vehicle-edit.uvue -``` - ---- - -## 🎯 设计原则 - -- ✅ **一致性**:所有页面使用相同导航栏样式(左上角返回按钮 + 居中标题) -- ✅ **响应式**:适配 H5、APP、小程序等平台 -- ✅ **状态驱动**:根据订单状态动态显示不同操作按钮 -- ✅ **用户体验优先**:历史订单跳转后只显示必要操作,避免冗余按钮 - ---- - -## 📌 建议优化点 - -| 问题 | 建议 | -|------|------| -| `index.uvue` 重复 | 重命名为 `dashboard.uvue` 或 `home.uvue` | -| 页面间参数传递 | 使用 `uni.navigateTo({ url: '?param=value' })` 并在 `onLoad` 中接收 | -| UTS 语法兼容性 | 如遇问题,可临时改用标准 TS 语法调试 | - ---- - -## ✅ 总结 - -这个 `delivery` 模块是一个完整的配送员工作系统,涵盖了: - -- **个人管理**(资料、设置) -- **任务处理**(接单、配送、完成) -- **数据统计**(收入、评价、历史) -- **车辆管理** - -结构清晰、功能完整,适合用于实际配送平台开发。 - ---- diff --git a/pages/mall/delivery/STATE_1-5_LOGIC.md b/pages/mall/delivery/doc/STATE_1-5_LOGIC.md similarity index 100% rename from pages/mall/delivery/STATE_1-5_LOGIC.md rename to pages/mall/delivery/doc/STATE_1-5_LOGIC.md diff --git a/pages/user/login.uvue b/pages/user/login.uvue index 6276d66a..bbf23664 100644 --- a/pages/user/login.uvue +++ b/pages/user/login.uvue @@ -142,7 +142,8 @@ import { ref, onMounted } from 'vue' import supa from '@/components/supadb/aksupainstance.uts' import { IS_TEST_MODE } from '@/ak/config.uts' -import { getCurrentUser, logout } from '@/utils/store.uts' +import { getCurrentUser, logout, setIsLoggedIn, setUserProfile } from '@/utils/store.uts' +import { UserProfile } from '@/pages/user/types.uts' const cssVars = { '--bg': '#f5f6f8', @@ -172,17 +173,20 @@ const codeCountdown = ref(0) onMounted(() => { try { - if (IS_TEST_MODE) return const sessionInfo = supa.getSession() if (sessionInfo != null && sessionInfo.user != null) { + // 生产模式或主动进入登录页时,若已登录则尝试跳转回原页面或首页 const pages = getCurrentPages() as any[] const currentPage = pages.length > 0 ? pages[pages.length - 1] : null const opts = currentPage?.options as any const redirect = opts?.redirect as string | null + + // 注意:IS_TEST_MODE 仅在 boot 页禁止自动跳转,在登录页若已有 Session,建议还是允许其进入首页 if (redirect != null && redirect.length > 0) { uni.redirectTo({ url: decodeURIComponent(redirect) }) - } else { - uni.switchTab({ url: '/pages/mall/consumer/index' }) + } else if (!IS_TEST_MODE) { + // 非测试模式下,自动跳转首页 + uni.switchTab({ url: '/pages/mall/consumer/index' }) } } } catch (e) { @@ -347,19 +351,18 @@ const handleLogin = async () => { } uni.showToast({ title: '登录成功', icon: 'success' }) - if (!IS_TEST_MODE) { - setTimeout(() => { - const pages = getCurrentPages() as any[] - const currentPage = pages.length > 0 ? pages[pages.length - 1] : null - const opts = currentPage?.options as any - const redirect = opts?.redirect as string | null - if (redirect != null && redirect.length > 0) { - uni.redirectTo({ url: decodeURIComponent(redirect) }) - } else { + // 登录成功后的跳转不应受 IS_TEST_MODE 限制,否则用户点击登录后无反馈 + setTimeout(() => { + const pages = getCurrentPages() as any[] + const currentPage = pages.length > 0 ? pages[pages.length - 1] : null + const opts = currentPage?.options as any + const redirect = opts?.redirect as string | null + if (redirect != null && redirect.length > 0) { + uni.redirectTo({ url: decodeURIComponent(redirect) }) + } else { uni.switchTab({ url: '/pages/mall/consumer/index' }) - } - }, 500) - } + } + }, 500) } catch (err) { console.error('登录错误:', err) let msg = '登录失败,请重试'