加入房间逻辑完善

This commit is contained in:
kron
2025-06-19 21:49:16 +08:00
parent 35d544003d
commit 6d063d56ab
3 changed files with 13 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
<script setup>
import { ref } from "vue";
import SButton from "@/components/SButton.vue";
import { createRoomAPI } from "@/apis";
import { joinRoomAPI, createRoomAPI } from "@/apis";
const props = defineProps({
onConfirm: {
@@ -26,9 +26,10 @@ const createRoom = async () => {
step.value = 2;
loading.value = false;
};
const enterRoom = () => {
const enterRoom = async () => {
step.value = 1;
props.onConfirm();
await joinRoomAPI(roomNumber.value);
uni.navigateTo({
url: `/pages/battle-room?roomNumber=${roomNumber.value}`,
});