添加游戏中途挂起,返回同步数据

This commit is contained in:
kron
2025-07-22 15:47:07 +08:00
parent e5a28fd4ac
commit eb1c2f7f41
6 changed files with 330 additions and 232 deletions

View File

@@ -1,4 +1,5 @@
import websocket from "@/websocket";
import { isGamingAPI } from "@/apis";
export const formatTimestamp = (timestamp) => {
const date = new Date(timestamp * 1000);
@@ -264,3 +265,17 @@ export const wxShare = async () => {
});
}
};
export const isGameEnded = async () => {
const isGaming = await isGamingAPI();
if (!isGaming) {
uni.showToast({
title: "比赛已结束",
icon: "none",
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
return !isGaming;
};