新版房间1v1对战数据调试完成

This commit is contained in:
kron
2026-02-04 17:45:57 +08:00
parent a2674aae5b
commit 7f73f3ebb3
18 changed files with 524 additions and 843 deletions

View File

@@ -2,7 +2,7 @@
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { onShow } from "@dcloudio/uni-app";
import { getCurrentGameAPI, getUserGameState } from "@/apis";
import { getBattleAPI, getUserGameState } from "@/apis";
import { debounce } from "@/util";
import useStore from "@/store";
@@ -44,10 +44,21 @@ const onClick = debounce(async () => {
if (loading.value) return;
try {
loading.value = true;
if (game.value.inBattle) {
await uni.$checkAudio();
const result = await getCurrentGameAPI();
} else if (game.value.roomID) {
const result = await getBattleAPI();
if (result && result.matchId) {
// await uni.$checkAudio();
if (result.way === 1) {
uni.navigateTo({
url: `/pages/team-battle?battleId=${result.matchId}`,
});
} else if (result.way === 2) {
uni.navigateTo({
url: `/pages/melee-match?battleId=${result.matchId}`,
});
}
return;
}
if (game.value.roomID) {
uni.navigateTo({
url: "/pages/battle-room?roomNumber=" + game.value.roomID,
});