From 16d3670b5dc48ffc23fe55776e53e09b9c4f46fc Mon Sep 17 00:00:00 2001 From: Azure <983547216@qq.com> Date: Tue, 23 Jun 2026 11:11:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=92=8C=E8=8E=B7=E5=8F=96=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E8=AF=A6=E6=83=85=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/game/room.ts | 16 +++++++++++++++- src/router/routes.ts | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/api/modules/game/room.ts b/src/api/modules/game/room.ts index 95a5ecc..08b1257 100644 --- a/src/api/modules/game/room.ts +++ b/src/api/modules/game/room.ts @@ -3,7 +3,8 @@ import type { CreateRoomRequest, CreateRoomResponse, GetRoomListRequest, - GetRoomListResponse + GetRoomListResponse, + RoomDetailResponse } from './types' /** @@ -35,3 +36,16 @@ export function getRoomList(params: GetRoomListRequest) { export function createRoom(data: CreateRoomRequest) { return requestClient.post('/game/room/create', data) } + +/** + * 获取房间详情 + * + * 用于进入房间页时获取初始快照(棋盘状态、玩家信息等)。 + * 无需登录即可调用(观战者也需访问)。 + * + * @param roomId 房间 ID + * @returns 房间详情 + */ +export function getRoomDetail(roomId: string) { + return requestClient.get(`/game/room/${roomId}`) +} diff --git a/src/router/routes.ts b/src/router/routes.ts index 36d1212..7f2d062 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -7,6 +7,12 @@ const routes: RouteRecordRaw[] = [ component: () => import('@/layouts/BaseLayout.vue'), children: [] }, + { + path: '/room/:roomId', + name: 'Room', + component: () => import('@/views/game/RoomPage.vue'), + meta: { requiresAuth: true } + }, { path: '/auth', name: 'Authentication',