fix:大乱斗比赛页面结束跳转到新结算页面

This commit is contained in:
2026-05-09 15:23:58 +08:00
parent c4ad44b02a
commit 45cb785ba4
2 changed files with 45 additions and 31 deletions

View File

@@ -20,6 +20,8 @@ const { user } = storeToRefs(store);
const title = ref("");
const start = ref(null);
const battleId = ref("");
/** 对战模式1=好友约战 2=排位赛,用于结算页跳转判断 */
const way = ref(0);
const currentRound = ref(1);
const tips = ref("即将开始...");
const players = ref([]);
@@ -37,6 +39,8 @@ function recoverData(battleInfo, { force = false } = {}) {
try {
if (battleInfo.way === 1) title.value = "好友约战 - 大乱斗";
if (battleInfo.way === 2) title.value = "排位赛 - 大乱斗";
// 保存 way 供结算跳转时使用
way.value = battleInfo.way ?? 0;
// 优先使用接口数据,否则使用缓存
if (battleInfo.teams?.[0]?.players) {
@@ -122,9 +126,16 @@ async function onReceiveMessage(msg) {
tips.value = "准备下半场";
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
setTimeout(() => {
uni.redirectTo({
url: "/pages/battle-result?battleId=" + msg.matchId,
});
// 好友约战way=1跳转新结算页其余跳旧结算页
if (way.value === 1) {
uni.redirectTo({
url: "/pages/friend-battle-result?battleId=" + msg.matchId,
});
} else {
uni.redirectTo({
url: "/pages/battle-result?battleId=" + msg.matchId,
});
}
}, 1000);
}
}