From 834841a3d5eada9b8aa5f439b5fddccf02b0b520 Mon Sep 17 00:00:00 2001 From: chenlimao Date: Sat, 9 May 2026 15:51:51 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=85=A8=E9=83=A8=E5=AF=B9?= =?UTF-8?q?=E6=88=98=E9=A1=B5=E9=9D=A2=E5=AF=B9=E6=8E=A5=E6=96=B0=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/friend-battle-result.vue | 18 ++++++++--- src/pages/melee-battle.vue | 18 +++-------- src/pages/team-battle.vue | 30 +++++------------- .../{ => friend-battle-result}/you-lost.png | Bin .../{ => friend-battle-result}/you-win.png | Bin 5 files changed, 25 insertions(+), 41 deletions(-) rename src/static/{ => friend-battle-result}/you-lost.png (100%) rename src/static/{ => friend-battle-result}/you-win.png (100%) diff --git a/src/pages/friend-battle-result.vue b/src/pages/friend-battle-result.vue index 411f9bb..bae1fe2 100644 --- a/src/pages/friend-battle-result.vue +++ b/src/pages/friend-battle-result.vue @@ -223,16 +223,24 @@ function closeOverlay() { } /** - * 返回对应的战斗房间 - * 若有 roomId 则跳转到房间页,否则返回上一页 + * 底部按钮文案:好友约战显示“返回房间”,排位赛等其他模式显示“返回” + */ +const exitBtnText = computed(() => data.value.way === 1 ? '返回房间' : '返回'); + +/** + * 点击底部按钮跳转 + * - 好友约战(way=1):返回对战房间 + * - 其他模式(排位赛等):跳转到排位赛首页 */ function exit() { - if (data.value.roomId) { + if (data.value.way === 1) { uni.redirectTo({ url: `/pages/battle-room?roomNumber=${data.value.roomId}`, }); } else { - uni.navigateBack(); + uni.redirectTo({ + url: '/pages/ranking', + }); } } @@ -428,7 +436,7 @@ function goBack() { 返回房间 + >{{ exitBtnText }} diff --git a/src/pages/melee-battle.vue b/src/pages/melee-battle.vue index fa7a5b9..b102bd7 100644 --- a/src/pages/melee-battle.vue +++ b/src/pages/melee-battle.vue @@ -30,10 +30,6 @@ const playersScores = ref([]); const halfTimeTip = ref(false); const halfRest = ref(false); -const navigateToResult = () => { - uni.redirectTo({ url: `/pages/battle-result?battleId=${battleId.value}` }); -}; - function recoverData(battleInfo, { force = false } = {}) { if (!battleInfo) return; try { @@ -126,16 +122,10 @@ async function onReceiveMessage(msg) { tips.value = "准备下半场"; } else if (msg.type === MESSAGETYPESV2.BattleEnd) { setTimeout(() => { - // 好友约战(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, - }); - } + // 全部跳转到新结算页 + uni.redirectTo({ + url: "/pages/friend-battle-result?battleId=" + msg.matchId, + }); }, 1000); } } diff --git a/src/pages/team-battle.vue b/src/pages/team-battle.vue index 6778f6c..074bc3b 100644 --- a/src/pages/team-battle.vue +++ b/src/pages/team-battle.vue @@ -129,17 +129,10 @@ function onAudioEnded(s) { function onBattleEnd() { if (matchStatus.value === 2) { - // 好友约战(way===1)跳转专属结算页,其他模式保持跳转旧结算页 - // 后期如需新增更多模式的专属页面,在此扩展 if/else 分支即可 - if (battleWay.value === 1) { - uni.redirectTo({ - url: `/pages/friend-battle-result?battleId=${battleId.value}`, - }); - } else { - uni.redirectTo({ - url: `/pages/battle-result?battleId=${battleId.value}`, - }); - } + // 全部跳转到新结算页 + uni.redirectTo({ + url: `/pages/friend-battle-result?battleId=${battleId.value}`, + }); } } @@ -215,17 +208,10 @@ onShow(async () => { const result = await getBattleAPI(battleId.value); if (!result) return; if (result.status === 2) { - // 比赛已结束(如切后台再回来):跳结算页,按 way 分流 - // 与 onBattleEnd 保持一致,避免返回首页 - if (result.way === 1) { - uni.redirectTo({ - url: `/pages/friend-battle-result?battleId=${result.matchId}`, - }); - } else { - uni.redirectTo({ - url: `/pages/battle-result?battleId=${result.matchId}`, - }); - } + // 比赛已结束(如切后台再回来):跳新结算页 + uni.redirectTo({ + url: `/pages/friend-battle-result?battleId=${result.matchId}`, + }); } else { recoverData(result, {force: true}); } diff --git a/src/static/you-lost.png b/src/static/friend-battle-result/you-lost.png similarity index 100% rename from src/static/you-lost.png rename to src/static/friend-battle-result/you-lost.png diff --git a/src/static/you-win.png b/src/static/friend-battle-result/you-win.png similarity index 100% rename from src/static/you-win.png rename to src/static/friend-battle-result/you-win.png