添加还在游戏中提示
This commit is contained in:
@@ -20,6 +20,10 @@ function request(method, url, data = {}) {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
if (res.data.message === "ERROR_BATTLE_GAMING") {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: "none",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import SButton from "@/components/SButton.vue";
|
||||
import { joinRoomAPI, createRoomAPI } from "@/apis";
|
||||
import { joinRoomAPI, createRoomAPI, isGamingAPI } from "@/apis";
|
||||
|
||||
const props = defineProps({
|
||||
onConfirm: {
|
||||
@@ -16,6 +16,11 @@ const loading = ref(false);
|
||||
const roomNumber = ref("");
|
||||
|
||||
const createRoom = async () => {
|
||||
const isGaming = await isGamingAPI();
|
||||
if (isGaming) {
|
||||
uni.$showHint("当前正在对战中");
|
||||
return;
|
||||
}
|
||||
if (loading.value === true) return;
|
||||
loading.value = true;
|
||||
const result = await createRoomAPI(
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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}`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user