细节完善
This commit is contained in:
40
src/util.js
40
src/util.js
@@ -89,26 +89,26 @@ export const wxShare = async (canvasId = "shareCanvas") => {
|
||||
}
|
||||
};
|
||||
|
||||
export const isGameEnded = async (battleId) => {
|
||||
const state = await getUserGameState();
|
||||
if (!state.gaming) {
|
||||
const result = await getGameAPI(battleId);
|
||||
if (result.mode) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/battle-result?battleId=${battleId}`,
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "比赛已结束",
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
return !state.gaming;
|
||||
};
|
||||
// export const isGameEnded = async (battleId) => {
|
||||
// const state = await getUserGameState();
|
||||
// if (!state.gaming) {
|
||||
// const result = await getGameAPI(battleId);
|
||||
// if (result.mode) {
|
||||
// uni.redirectTo({
|
||||
// url: `/pages/battle-result?battleId=${battleId}`,
|
||||
// });
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: "比赛已结束",
|
||||
// icon: "none",
|
||||
// });
|
||||
// setTimeout(() => {
|
||||
// uni.navigateBack();
|
||||
// }, 1000);
|
||||
// }
|
||||
// }
|
||||
// return !state.gaming;
|
||||
// };
|
||||
|
||||
// 获取元素尺寸和位置信息
|
||||
export const getElementRect = (classname) => {
|
||||
|
||||
Reference in New Issue
Block a user