diff --git a/src/components/gobang/GobangHeaderContent.vue b/src/components/gobang/GobangHeaderContent.vue index f744123..464efbf 100644 --- a/src/components/gobang/GobangHeaderContent.vue +++ b/src/components/gobang/GobangHeaderContent.vue @@ -1,15 +1,16 @@ diff --git a/src/router/index.ts b/src/router/index.ts index fbbd5c9..6473294 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -39,9 +39,17 @@ const routes: RouteRecordRaw[] = [ shouldLogin: true, }, }, + { + path: '/gobang/single', + name: 'GobangPlaySingle', + component: () => import('@/views/GobangPlayPage.vue'), + meta: { + shouldLogin: true, + }, + }, { path: '/gobang/:id', - name: 'GobangPlay', + name: 'GobangPlayMulti', component: () => import('@/views/GobangPlayPage.vue'), meta: { shouldLogin: true, diff --git a/src/views/GobangListPage.vue b/src/views/GobangListPage.vue index ae5e390..e820fe0 100644 --- a/src/views/GobangListPage.vue +++ b/src/views/GobangListPage.vue @@ -146,7 +146,7 @@ const { send } = useGobangSocket({ loading.value = false; }, RoomCreated(p) { - // play(p.roomId); + play(p.roomId); }, }); function refresh() { @@ -172,7 +172,7 @@ function onJoinButtonClick(room: RoomRender) { } function play(roomId: RoomId) { router.push({ - name: 'GobangPlay', + name: 'GobangPlayMulti', params: { id: roomId }, }); } diff --git a/src/views/GobangPlayPage.vue b/src/views/GobangPlayPage.vue index 79ee93e..5faaaef 100644 --- a/src/views/GobangPlayPage.vue +++ b/src/views/GobangPlayPage.vue @@ -8,6 +8,7 @@

蓝色基因对战平台

#{{ roomId.slice(0, 8) }}

+

单人游戏

@@ -27,9 +28,9 @@ ? 'gobang-chessboard__cell--white' : 'gobang-chessboard__cell--black' : undefined, - ]" + ]" :style="getCellStyle(cell, x, y)" - > + > @@ -153,7 +154,6 @@ watchEffect(() => { ); ctx.stroke(); } - console.log('rerender'); }); interface Chess { isWhite: boolean; @@ -195,6 +195,8 @@ function playerJoin(roomId: RoomId) { onMounted(() => { if (roomId) { playerJoin(roomId); + } else { + state.value = 'idle'; } });