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 @@