fix:好友约战首页调整完成
This commit is contained in:
@@ -29,6 +29,18 @@ const players = ref([]);
|
||||
const blueTeam = ref([]);
|
||||
const redTeam = ref([]);
|
||||
|
||||
/**
|
||||
* 根据对战类型和房间人数动态生成页面标题
|
||||
* battleType=1: 组队对战;count 2/4/6 分别对应 1v1/2v2/3v3
|
||||
* battleType=2: 多人乱斗
|
||||
*/
|
||||
const battleTitle = computed(() => {
|
||||
if (!room.value.battleType) return "好友约战";
|
||||
if (room.value.battleType === 2) return "多人乱斗";
|
||||
const half = room.value.count / 2;
|
||||
return `${half}v${half}对抗赛`;
|
||||
});
|
||||
|
||||
const ready = ref(false);
|
||||
const allReady = ref(false);
|
||||
const timer = ref(null);
|
||||
@@ -96,6 +108,9 @@ async function refreshRoomData() {
|
||||
}
|
||||
if (timer.value) clearInterval(timer.value);
|
||||
// timer.value = setTimeout(refreshRoomData, 2000);
|
||||
|
||||
// 通知 Header 组件更新房号展示
|
||||
uni.$emit("battle-room-info", { roomNumber: roomNumber.value });
|
||||
}
|
||||
|
||||
const startGame = async () => {
|
||||
@@ -236,7 +251,7 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Container :title="`好友约战 - ${roomNumber}`">
|
||||
<Container :title="battleTitle">
|
||||
<view class="standby-phase">
|
||||
<GuideTwo>
|
||||
<view class="battle-guide">
|
||||
@@ -247,7 +262,6 @@ onBeforeUnmount(() => {
|
||||
}}</text>
|
||||
<text v-if="room.battleType === 2">大乱斗即将开始! </text>
|
||||
</view>
|
||||
<!-- <button hover-class="none" open-type="share">邀请</button> -->
|
||||
</view>
|
||||
</GuideTwo>
|
||||
<view v-if="room.battleType === 1 && room.count === 2" class="team-mode">
|
||||
@@ -380,7 +394,7 @@ onBeforeUnmount(() => {
|
||||
.team-mode {
|
||||
width: calc(100vw - 30px);
|
||||
height: 125vw;
|
||||
margin: 15px;
|
||||
margin: 0 15px 15px 15px;
|
||||
}
|
||||
|
||||
.team-mode>image:first-child {
|
||||
|
||||
Reference in New Issue
Block a user