添加还在游戏中提示
This commit is contained in:
@@ -20,6 +20,10 @@ function request(method, url, data = {}) {
|
|||||||
resolve({});
|
resolve({});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (res.data.message === "ERROR_BATTLE_GAMING") {
|
||||||
|
resolve({});
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.data.message,
|
title: res.data.message,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
import { joinRoomAPI, createRoomAPI } from "@/apis";
|
import { joinRoomAPI, createRoomAPI, isGamingAPI } from "@/apis";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
onConfirm: {
|
onConfirm: {
|
||||||
@@ -16,6 +16,11 @@ const loading = ref(false);
|
|||||||
const roomNumber = ref("");
|
const roomNumber = ref("");
|
||||||
|
|
||||||
const createRoom = async () => {
|
const createRoom = async () => {
|
||||||
|
const isGaming = await isGamingAPI();
|
||||||
|
if (isGaming) {
|
||||||
|
uni.$showHint("当前正在对战中");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (loading.value === true) return;
|
if (loading.value === true) return;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const result = await createRoomAPI(
|
const result = await createRoomAPI(
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ const warnning = ref("");
|
|||||||
const roomNumber = ref("");
|
const roomNumber = ref("");
|
||||||
|
|
||||||
const enterRoom = debounce(async () => {
|
const enterRoom = debounce(async () => {
|
||||||
// const isGaming = await isGamingAPI();
|
const isGaming = await isGamingAPI();
|
||||||
|
if (isGaming) {
|
||||||
|
uni.$showHint("当前正在对战中");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!roomNumber.value) {
|
if (!roomNumber.value) {
|
||||||
warnning.value = "请输入房间号";
|
warnning.value = "请输入房间号";
|
||||||
showModal.value = true;
|
showModal.value = true;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
import { getRankListAPI } from "@/apis";
|
import { getRankListAPI, isGamingAPI } from "@/apis";
|
||||||
import { topThreeColors } from "@/constants";
|
import { topThreeColors } from "@/constants";
|
||||||
import { getHomeData } from "@/apis";
|
import { getHomeData } from "@/apis";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
@@ -66,25 +66,35 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const toTeamMatchPage = (gameType, teamSize) => {
|
const toTeamMatchPage = async (gameType, teamSize) => {
|
||||||
if (!device.value.deviceId) {
|
if (!device.value.deviceId) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "请先绑定设备",
|
title: "请先绑定设备",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const isGaming = await isGamingAPI();
|
||||||
|
if (isGaming) {
|
||||||
|
uni.$showHint("当前正在对战中");
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/team-match?gameType=${gameType}&teamSize=${teamSize}`,
|
url: `/pages/team-match?gameType=${gameType}&teamSize=${teamSize}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const toMeleeMatchPage = (gameType, teamSize) => {
|
const toMeleeMatchPage = async (gameType, teamSize) => {
|
||||||
if (!device.value.deviceId) {
|
if (!device.value.deviceId) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: "请先绑定设备",
|
title: "请先绑定设备",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const isGaming = await isGamingAPI();
|
||||||
|
if (isGaming) {
|
||||||
|
uni.$showHint("当前正在对战中");
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/melee-match?gameType=${gameType}&teamSize=${teamSize}`,
|
url: `/pages/melee-match?gameType=${gameType}&teamSize=${teamSize}`,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user