From 6fb5de204c80478f1f7b4af4a740ec252487afcd Mon Sep 17 00:00:00 2001 From: yml Date: Wed, 27 May 2026 09:46:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B6=88=E6=81=AF=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=EF=BC=9A=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8=E3=80=81?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=BE=A4=E8=81=8A=E3=80=81=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E5=AF=B9=E6=96=B9=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增消息列表页和聊天详情页,支持 SSE 实时推送 - 订单详情页新增"联系对方"按钮,一键进入订单群聊 - 导航栏新增"消息"入口 - 修复 mobileHost 路径匹配 bug,避免 /m 前缀误匹配 - 优化 dev.sh:提取 mysql 辅助函数、修复空 PID 处理、条件检查依赖 Co-Authored-By: Claude Opus 4.7 --- frontend/src/layouts/AppLayout.vue | 2 + frontend/src/router/accountRoutes.ts | 12 + frontend/src/router/mobileHost.ts | 10 +- frontend/src/views/account/ChatView.vue | 413 ++++++++++++++++++ frontend/src/views/account/MessagesView.vue | 290 ++++++++++++ .../src/views/account/OrderDetailView.vue | 35 +- scripts/dev.sh | 44 +- 7 files changed, 792 insertions(+), 14 deletions(-) create mode 100644 frontend/src/views/account/ChatView.vue create mode 100644 frontend/src/views/account/MessagesView.vue diff --git a/frontend/src/layouts/AppLayout.vue b/frontend/src/layouts/AppLayout.vue index dd4da62..dc80192 100644 --- a/frontend/src/layouts/AppLayout.vue +++ b/frontend/src/layouts/AppLayout.vue @@ -3,6 +3,7 @@ import { ref } from "vue"; import { useRouter } from "vue-router"; import { Bell, + ChatDotRound, CirclePlus, House, Search, @@ -21,6 +22,7 @@ const navItems = [ { label: "首页", to: "/", icon: House }, { label: "租号大厅", to: "/listings", icon: Shop }, { label: "我的订单", to: "/orders", icon: Tickets }, + { label: "消息", to: "/messages", icon: ChatDotRound }, { label: "钱包", to: "/wallet", icon: Wallet }, ]; diff --git a/frontend/src/router/accountRoutes.ts b/frontend/src/router/accountRoutes.ts index bf55ac0..15c1d73 100644 --- a/frontend/src/router/accountRoutes.ts +++ b/frontend/src/router/accountRoutes.ts @@ -42,4 +42,16 @@ export const accountRoutes: RouteRecordRaw[] = [ component: () => import('@/views/account/RealnameView.vue'), meta: { requiresAuth: true }, }, + { + path: '/messages', + name: 'messages', + component: () => import('@/views/account/MessagesView.vue'), + meta: { requiresAuth: true }, + }, + { + path: '/messages/:id', + name: 'chat', + component: () => import('@/views/account/ChatView.vue'), + meta: { requiresAuth: true }, + }, ] diff --git a/frontend/src/router/mobileHost.ts b/frontend/src/router/mobileHost.ts index 766adb8..98168d3 100644 --- a/frontend/src/router/mobileHost.ts +++ b/frontend/src/router/mobileHost.ts @@ -14,7 +14,7 @@ export function getMobilePath(path: string): string { if (path === "/" || path === "") { return "/m"; } - if (path.startsWith("/m") || path.startsWith("/admin")) { + if (path === "/m" || path.startsWith("/m/") || path.startsWith("/admin")) { return path; } @@ -31,6 +31,9 @@ export function getMobilePath(path: string): string { if (path === "/seller/listings/create") { return "/m/seller/listings/create"; } + if (path === "/messages" || path.startsWith("/messages/")) { + return "/m/messages"; + } // PC-only views that don't have mobile counterparts go to mobile profile as fallback if (path === "/wallet" || path === "/notifications" || path.startsWith("/seller")) { @@ -41,7 +44,7 @@ export function getMobilePath(path: string): string { } export function getPcPath(path: string): string { - if (!path.startsWith("/m") || path.startsWith("/admin")) { + if ((path !== "/m" && !path.startsWith("/m/")) || path.startsWith("/admin")) { return path; } @@ -62,7 +65,8 @@ export function getPcPath(path: string): string { if (subPath === "/realname") return "/realname"; if (subPath === "/seller/listings/create") return "/seller/listings/create"; - if (subPath === "/messages") return "/"; + if (subPath === "/messages") return "/messages"; + if (subPath.startsWith("/chats/")) return "/messages/" + subPath.substring(7); if (subPath === "/profile") return "/wallet"; return subPath || "/"; diff --git a/frontend/src/views/account/ChatView.vue b/frontend/src/views/account/ChatView.vue new file mode 100644 index 0000000..b499a2c --- /dev/null +++ b/frontend/src/views/account/ChatView.vue @@ -0,0 +1,413 @@ + + + + + + diff --git a/frontend/src/views/account/MessagesView.vue b/frontend/src/views/account/MessagesView.vue new file mode 100644 index 0000000..e9f64ee --- /dev/null +++ b/frontend/src/views/account/MessagesView.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/frontend/src/views/account/OrderDetailView.vue b/frontend/src/views/account/OrderDetailView.vue index 99552dc..7d82a10 100644 --- a/frontend/src/views/account/OrderDetailView.vue +++ b/frontend/src/views/account/OrderDetailView.vue @@ -1,8 +1,10 @@