完成加入,退出房间
This commit is contained in:
@@ -23,10 +23,11 @@ const createRoom = async () => {
|
||||
}
|
||||
if (loading.value === true) return;
|
||||
loading.value = true;
|
||||
const result = await createRoomAPI(
|
||||
battleMode.value,
|
||||
battleMode.value === 1 ? 2 : 10
|
||||
);
|
||||
let size = 2;
|
||||
if (battleMode.value === 2) size = 10;
|
||||
if (battleMode.value === 3) size = 4;
|
||||
if (battleMode.value === 4) size = 6;
|
||||
const result = await createRoomAPI(battleMode.value === 2 ? 2 : 1, size);
|
||||
if (result.number) roomNumber.value = result.number;
|
||||
step.value = 2;
|
||||
loading.value = false;
|
||||
|
||||
@@ -17,7 +17,7 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const barColor = ref("linear-gradient( 180deg, #FFA0A0 0%, #FF6060 100%)");
|
||||
const remain = ref(10);
|
||||
const remain = ref(15);
|
||||
const timer = ref(null);
|
||||
|
||||
watch(
|
||||
|
||||
@@ -9,17 +9,24 @@ const props = defineProps({
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
currentShooterId: {
|
||||
type: Number,
|
||||
default: "",
|
||||
},
|
||||
youTurn: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const players = ref(props.team);
|
||||
const youTurn = ref(false);
|
||||
watch(
|
||||
() => props.youTurn,
|
||||
() => props.currentShooterId,
|
||||
(newVal) => {
|
||||
players.value = props.team;
|
||||
}
|
||||
const exit = props.team.some((p) => p.id === newVal);
|
||||
youTurn.value = !!exit;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user