添加分享房间链接和对战结束返回房间
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { isGamingAPI, getGameAPI } from "@/apis";
|
||||
import { getUserGameState, getGameAPI } from "@/apis";
|
||||
|
||||
export const formatTimestamp = (timestamp) => {
|
||||
const date = new Date(timestamp * 1000);
|
||||
@@ -90,8 +90,8 @@ export const wxShare = async (canvasId = "shareCanvas") => {
|
||||
};
|
||||
|
||||
export const isGameEnded = async (battleId) => {
|
||||
const isGaming = await isGamingAPI();
|
||||
if (!isGaming) {
|
||||
const state = await getUserGameState();
|
||||
if (!state.gaming) {
|
||||
const result = await getGameAPI(battleId);
|
||||
if (result.mode) {
|
||||
uni.redirectTo({
|
||||
@@ -107,7 +107,7 @@ export const isGameEnded = async (battleId) => {
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
return !isGaming;
|
||||
return !state.gaming;
|
||||
};
|
||||
|
||||
// 获取元素尺寸和位置信息
|
||||
|
||||
Reference in New Issue
Block a user