添加还在游戏中提示

This commit is contained in:
kron
2025-07-02 17:16:56 +08:00
parent 997e2ee756
commit 5c5b72d556
4 changed files with 28 additions and 5 deletions

View File

@@ -18,7 +18,11 @@ const warnning = ref("");
const roomNumber = ref("");
const enterRoom = debounce(async () => {
// const isGaming = await isGamingAPI();
const isGaming = await isGamingAPI();
if (isGaming) {
uni.$showHint("当前正在对战中");
return;
}
if (!roomNumber.value) {
warnning.value = "请输入房间号";
showModal.value = true;

View File

@@ -2,7 +2,7 @@
import { ref, onMounted } from "vue";
import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue";
import { getRankListAPI } from "@/apis";
import { getRankListAPI, isGamingAPI } from "@/apis";
import { topThreeColors } from "@/constants";
import { getHomeData } from "@/apis";
import useStore from "@/store";
@@ -66,25 +66,35 @@ onMounted(async () => {
}
});
const toTeamMatchPage = (gameType, teamSize) => {
const toTeamMatchPage = async (gameType, teamSize) => {
if (!device.value.deviceId) {
return uni.showToast({
title: "请先绑定设备",
icon: "none",
});
}
const isGaming = await isGamingAPI();
if (isGaming) {
uni.$showHint("当前正在对战中");
return;
}
uni.navigateTo({
url: `/pages/team-match?gameType=${gameType}&teamSize=${teamSize}`,
});
};
const toMeleeMatchPage = (gameType, teamSize) => {
const toMeleeMatchPage = async (gameType, teamSize) => {
if (!device.value.deviceId) {
return uni.showToast({
title: "请先绑定设备",
icon: "none",
});
}
const isGaming = await isGamingAPI();
if (isGaming) {
uni.$showHint("当前正在对战中");
return;
}
uni.navigateTo({
url: `/pages/melee-match?gameType=${gameType}&teamSize=${teamSize}`,
});