fix:全部对战页面对接新结算页面
This commit is contained in:
@@ -223,16 +223,24 @@ function closeOverlay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回对应的战斗房间
|
* 底部按钮文案:好友约战显示“返回房间”,排位赛等其他模式显示“返回”
|
||||||
* 若有 roomId 则跳转到房间页,否则返回上一页
|
*/
|
||||||
|
const exitBtnText = computed(() => data.value.way === 1 ? '返回房间' : '返回');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击底部按钮跳转
|
||||||
|
* - 好友约战(way=1):返回对战房间
|
||||||
|
* - 其他模式(排位赛等):跳转到排位赛首页
|
||||||
*/
|
*/
|
||||||
function exit() {
|
function exit() {
|
||||||
if (data.value.roomId) {
|
if (data.value.way === 1) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/battle-room?roomNumber=${data.value.roomId}`,
|
url: `/pages/battle-room?roomNumber=${data.value.roomId}`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.navigateBack();
|
uni.redirectTo({
|
||||||
|
url: '/pages/ranking',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +436,7 @@ function goBack() {
|
|||||||
<view
|
<view
|
||||||
:class="['btn-return', data.mode > 3 ? 'btn-return-melee' : 'btn-return-battle']"
|
:class="['btn-return', data.mode > 3 ? 'btn-return-melee' : 'btn-return-battle']"
|
||||||
@click="exit"
|
@click="exit"
|
||||||
>返回房间</view>
|
>{{ exitBtnText }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- ===== 进场覆盖动效层(初始显示,点击或2.5s后消失)===== -->
|
<!-- ===== 进场覆盖动效层(初始显示,点击或2.5s后消失)===== -->
|
||||||
|
|||||||
@@ -30,10 +30,6 @@ const playersScores = ref([]);
|
|||||||
const halfTimeTip = ref(false);
|
const halfTimeTip = ref(false);
|
||||||
const halfRest = ref(false);
|
const halfRest = ref(false);
|
||||||
|
|
||||||
const navigateToResult = () => {
|
|
||||||
uni.redirectTo({ url: `/pages/battle-result?battleId=${battleId.value}` });
|
|
||||||
};
|
|
||||||
|
|
||||||
function recoverData(battleInfo, { force = false } = {}) {
|
function recoverData(battleInfo, { force = false } = {}) {
|
||||||
if (!battleInfo) return;
|
if (!battleInfo) return;
|
||||||
try {
|
try {
|
||||||
@@ -126,16 +122,10 @@ async function onReceiveMessage(msg) {
|
|||||||
tips.value = "准备下半场";
|
tips.value = "准备下半场";
|
||||||
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 好友约战(way=1)跳转新结算页,其余跳旧结算页
|
// 全部跳转到新结算页
|
||||||
if (way.value === 1) {
|
uni.redirectTo({
|
||||||
uni.redirectTo({
|
url: "/pages/friend-battle-result?battleId=" + msg.matchId,
|
||||||
url: "/pages/friend-battle-result?battleId=" + msg.matchId,
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: "/pages/battle-result?battleId=" + msg.matchId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,17 +129,10 @@ function onAudioEnded(s) {
|
|||||||
|
|
||||||
function onBattleEnd() {
|
function onBattleEnd() {
|
||||||
if (matchStatus.value === 2) {
|
if (matchStatus.value === 2) {
|
||||||
// 好友约战(way===1)跳转专属结算页,其他模式保持跳转旧结算页
|
// 全部跳转到新结算页
|
||||||
// 后期如需新增更多模式的专属页面,在此扩展 if/else 分支即可
|
uni.redirectTo({
|
||||||
if (battleWay.value === 1) {
|
url: `/pages/friend-battle-result?battleId=${battleId.value}`,
|
||||||
uni.redirectTo({
|
});
|
||||||
url: `/pages/friend-battle-result?battleId=${battleId.value}`,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/battle-result?battleId=${battleId.value}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,17 +208,10 @@ onShow(async () => {
|
|||||||
const result = await getBattleAPI(battleId.value);
|
const result = await getBattleAPI(battleId.value);
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
if (result.status === 2) {
|
if (result.status === 2) {
|
||||||
// 比赛已结束(如切后台再回来):跳结算页,按 way 分流
|
// 比赛已结束(如切后台再回来):跳新结算页
|
||||||
// 与 onBattleEnd 保持一致,避免返回首页
|
uni.redirectTo({
|
||||||
if (result.way === 1) {
|
url: `/pages/friend-battle-result?battleId=${result.matchId}`,
|
||||||
uni.redirectTo({
|
});
|
||||||
url: `/pages/friend-battle-result?battleId=${result.matchId}`,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/battle-result?battleId=${result.matchId}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
recoverData(result, {force: true});
|
recoverData(result, {force: true});
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Reference in New Issue
Block a user