|
@@ -1,16 +1,21 @@
|
|
|
<template>
|
|
|
<view class="waiting-room-page">
|
|
|
- <!-- 房间头部信息 保持不变 -->
|
|
|
- <view class="room-header">
|
|
|
- <view class="room-title">
|
|
|
- <view class="title">{{ currentRoom?.name || '等待房间' }}</view>
|
|
|
- <view class="tag" :class="isHost ? 'host-tag' : 'player-tag'">
|
|
|
- {{ isHost ? '主持人' : '玩家' }}
|
|
|
- </view>
|
|
|
+ <!-- 顶部标题 -->
|
|
|
+ <view
|
|
|
+ class="room-header"
|
|
|
+ :class="{ 'host-background': isHost, 'player-background': !isHost }"
|
|
|
+ >
|
|
|
+ <view
|
|
|
+ class="room-title"
|
|
|
+ :class="{ 'host-title': isHost, 'player-title': !isHost }"
|
|
|
+ >
|
|
|
+ {{ currentRoom?.name || '等待房间' }}
|
|
|
</view>
|
|
|
- <view class="status-info">
|
|
|
- <view class="players-count">{{ playerCount }}/{{ currentRoom?.maxPlayers || 0 }}人已加入</view>
|
|
|
- <view class="status-text">{{ statusText }}</view>
|
|
|
+ <view
|
|
|
+ class="room-status"
|
|
|
+ :class="{ 'host-status': isHost, 'player-status': !isHost }"
|
|
|
+ >
|
|
|
+ {{ playerCount }}/{{ currentRoom?.maxPlayers || 0 }} 已加入,{{ statusText }}
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -312,6 +317,7 @@ import Taro from '@tarojs/taro'
|
|
|
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
|
|
import { useRoomStore } from '@/stores/room'
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
+import { useTabBarStore } from '@/stores/tabbar'
|
|
|
import { useTurtleSoupStore } from '@/stores/games/turtlesoup'
|
|
|
import Tabbar from '@/components/Tabbar.vue'
|
|
|
import RoomCode from '@/components/RoomCode/index.vue'
|
|
@@ -349,6 +355,7 @@ export default {
|
|
|
// 初始化store
|
|
|
const roomStore = useRoomStore()
|
|
|
const userStore = useUserStore()
|
|
|
+ const tabbarStore = useTabBarStore()
|
|
|
const turtleSoupStore = useTurtleSoupStore()
|
|
|
|
|
|
// 房间ID
|
|
@@ -764,8 +771,11 @@ export default {
|
|
|
await roomStore.updateRoomStatus(RoomStatus.PLAYING)
|
|
|
|
|
|
// 导航到游戏页面
|
|
|
- Taro.redirectTo({
|
|
|
- url: `/pages/room/play/index?roomId=${currentRoom.value.id}&gameId=${result.gameId}`
|
|
|
+ tabbarStore.switchToRoomTab('/pages/room/play/index', {
|
|
|
+ params: {
|
|
|
+ roomId: currentRoom.value.id,
|
|
|
+ gameId: result.gameId
|
|
|
+ }
|
|
|
})
|
|
|
} else {
|
|
|
throw new Error('创建游戏失败')
|
|
@@ -796,8 +806,10 @@ export default {
|
|
|
stopRoomListener()
|
|
|
|
|
|
// 跳转到游戏页面
|
|
|
- Taro.redirectTo({
|
|
|
- url: `/pages/room/play/index?roomId=${roomId.value}`
|
|
|
+ tabbarStore.switchToRoomTab('/pages/room/play/index', {
|
|
|
+ params: {
|
|
|
+ roomId: roomId.value
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -914,47 +926,43 @@ export default {
|
|
|
padding-bottom: $spacing-large * 4; // 为底部tabbar留出空间
|
|
|
|
|
|
.room-header {
|
|
|
- margin-bottom: $spacing-base;
|
|
|
-
|
|
|
+ padding: 8px;
|
|
|
+ height: 45px;
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
.room-title {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- margin-bottom: $spacing-base;
|
|
|
-
|
|
|
- .title {
|
|
|
- font-size: $font-size-large;
|
|
|
- font-weight: $font-weight-bold;
|
|
|
- color: $text-color-primary;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 4px;
|
|
|
+
|
|
|
+ &.host-title {
|
|
|
+ color: $text-color-orange;
|
|
|
}
|
|
|
-
|
|
|
- .tag {
|
|
|
- margin-left: $spacing-base;
|
|
|
- padding: $spacing-mini $spacing-base;
|
|
|
- border-radius: $border-radius-mini;
|
|
|
- font-size: $font-size-small;
|
|
|
-
|
|
|
- &.host-tag {
|
|
|
- background-color: $orange-color;
|
|
|
- color: white;
|
|
|
- }
|
|
|
-
|
|
|
- &.player-tag {
|
|
|
- background-color: $blue-light-color;
|
|
|
- color: white;
|
|
|
- }
|
|
|
+
|
|
|
+ &.player-title {
|
|
|
+ color: $text-color-blue;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- .status-info {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- .players-count, .status-text {
|
|
|
- font-size: $font-size-base;
|
|
|
- color: $text-color-secondary;
|
|
|
+ .room-status {
|
|
|
+ font-size: 8px;
|
|
|
+ margin-bottom: 4px;
|
|
|
+
|
|
|
+ &.host-status {
|
|
|
+ color: $text-color-orange;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.player-status {
|
|
|
+ color: $text-color-blue;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ &.host-background {
|
|
|
+ background-color: $orange-light-color;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.player-background {
|
|
|
+ background-color: $blue-light-color;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.host-view, .player-view {
|