新版房间1v1对战数据调试完成
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user