feat: 实现大厅到房间页面的导航跳转

This commit is contained in:
2026-06-23 11:19:33 +08:00
parent eecec1aae1
commit 78c172cce0

View File

@@ -47,6 +47,7 @@
import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import TableCard from './TableCard.vue'
import CreateRoomDialog from './CreateRoomDialog.vue'
import { useRouter } from 'vue-router'
import type { RoomItem } from '@/api/modules/game'
import { useBaseLayoutStore } from '@/stores'
import { storeToRefs } from 'pinia'
@@ -61,6 +62,7 @@ const statusFilters = [
]
const activeFilter = ref('all')
const router = useRouter()
const baseLayoutStore = useBaseLayoutStore()
const { activeGameId } = storeToRefs(baseLayoutStore)
@@ -129,20 +131,17 @@ const filteredRooms = computed(() => {
/** 加入房间 */
function handleJoin(roomId: string) {
// eslint-disable-next-line no-console
console.log('加入房间:', roomId)
router.push(`/room/${roomId}`)
}
/** 加入指定座位 */
function handleJoinSeat(roomId: string, seatIndex: number) {
// eslint-disable-next-line no-console
console.log('加入房间:', roomId, '座位:', seatIndex)
router.push({ path: `/room/${roomId}`, query: { seat: String(seatIndex) } })
}
/** 观战 */
function handleSpectate(roomId: string) {
// eslint-disable-next-line no-console
console.log('观战房间:', roomId)
router.push(`/room/${roomId}`)
}
/** 创建房间对话框可见性 */