添加设备在线离线处理

This commit is contained in:
kron
2025-12-31 13:39:16 +08:00
parent 25f51ad53a
commit af852d9b59
8 changed files with 104 additions and 57 deletions

View File

@@ -8,7 +8,7 @@ import { isGamingAPI, getHomeData } from "@/apis";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user, device } = storeToRefs(store);
const { user, device, online } = storeToRefs(store);
const { getLvlName } = store;
const defaultSeasonData = {
@@ -26,7 +26,6 @@ const seasonData = ref([]);
const rankData = ref({ user: {} });
const showSeasonList = ref(false);
const currentSeasonData = ref(defaultSeasonData);
const calibration = ref(false);
const handleSelect = (index) => {
selectedIndex.value = index;
@@ -48,11 +47,11 @@ const toMatchPage = async (gameType, teamSize) => {
icon: "none",
});
}
if (
!calibration.value &&
uni.getAccountInfoSync().miniProgram.envVersion === "release"
) {
return uni.$showHint(4);
if (!online.value) {
return uni.showToast({
title: "智能弓未连接",
icon: "none",
});
}
if (!user.value.trio) {
return uni.showToast({
@@ -125,7 +124,6 @@ const updateData = () => {
}
};
onShow(async () => {
calibration.value = uni.getStorageSync("calibration");
const result = await getHomeData();
rankData.value = result;
handleSelect(selectedIndex.value);