仅正式环境判断设备在线

This commit is contained in:
kron
2026-01-04 11:36:31 +08:00
parent 60b1006447
commit 9f7523839d
6 changed files with 44 additions and 90 deletions

View File

@@ -12,40 +12,15 @@ import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user, device, online } = storeToRefs(store);
import { debounce } from "@/util";
import { debounce, canEenter } from "@/util";
const showModal = ref(false);
const warnning = ref("");
const roomNumber = ref("");
const data = ref({});
const checkBeforeEnter = async () => {
if (!device.value.deviceId) {
uni.showToast({
title: "请先绑定设备",
icon: "none",
});
return true;
}
if (!online.value) {
uni.showToast({
title: "智能弓未连接",
icon: "none",
});
return true;
}
if (!user.value.trio) {
uni.showToast({
title: "请先完成新手试炼",
icon: "none",
});
return true;
}
return false;
};
const enterRoom = debounce(async () => {
if (checkBeforeEnter()) return;
if (!canEenter(user.value, device.value, online.value)) return;
const isGaming = await isGamingAPI();
if (isGaming) {
uni.$showHint(1);
@@ -80,7 +55,7 @@ const enterRoom = debounce(async () => {
}
});
const onCreateRoom = async () => {
if (checkBeforeEnter()) return;
if (!canEenter(user.value, device.value, online.value)) return;
const isGaming = await isGamingAPI();
if (isGaming) {
uni.$showHint(1);