fix:大乱斗比赛页面结束跳转到新结算页面
This commit is contained in:
@@ -165,16 +165,10 @@ function getMeleeAvatarBorderColor(rank) {
|
||||
// ---- 生命周期 ----
|
||||
|
||||
onLoad(async (options) => {
|
||||
// TODO: 调试用固定 battleId,联调完成后删除 fallback
|
||||
const battleId = options.battleId || "92368717727535104";
|
||||
if (!battleId) return;
|
||||
if (!options.battleId) return;
|
||||
|
||||
const result = await getBattleAPI(battleId);
|
||||
const result = await getBattleAPI(options.battleId);
|
||||
data.value = result;
|
||||
// DEBUG: 打印接口原始数据,联调完成后删除
|
||||
console.log("[friend-battle-result] raw result:", JSON.stringify(result));
|
||||
console.log("[friend-battle-result] mode:", result.mode, "resultList:", result.resultList, "teams keys:", result.teams ? Object.keys(result.teams) : null);
|
||||
console.log("[friend-battle-result] current user.id:", user.value.id, "type:", typeof user.value.id);
|
||||
|
||||
// 判断当前用户是否在胜利队伍中
|
||||
// 优先使用接口返回的 winTeam 字段;若缺失则以队伍得分高低作为兜底判断
|
||||
@@ -361,9 +355,9 @@ function goBack() {
|
||||
<!-- 排行榜滚动列表(显示 6.5 条,第 7 条半显示提示可滚动)-->
|
||||
<scroll-view class="melee-rank-scroll" scroll-y>
|
||||
<view
|
||||
v-for="item in meleeRankList"
|
||||
v-for="(item, index) in meleeRankList"
|
||||
:key="item.id"
|
||||
:class="['rank-item', item.isSelf ? 'rank-item-self' : '']"
|
||||
:class="['rank-item', item.isSelf ? 'rank-item-self' : '', index % 2 !== 0 ? 'rank-item-light' : '']"
|
||||
>
|
||||
<!-- 前三名左侧渐变背景装饰(绝对定位于内容层之下)-->
|
||||
<image
|
||||
@@ -400,7 +394,7 @@ function goBack() {
|
||||
<!-- 总环数 -->
|
||||
<view class="rank-score">
|
||||
<text class="rank-score-num">{{ item.totalRing }}</text>
|
||||
<text class="rank-score-unit"> 环</text>
|
||||
<text class="rank-score-unit">环</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -737,8 +731,9 @@ function goBack() {
|
||||
.exp-gained {
|
||||
display: block;
|
||||
text-align: center;
|
||||
color: #FFD700;
|
||||
font-size: 24rpx;
|
||||
color: #FAE6BC;
|
||||
font-size: 20rpx;
|
||||
font-weight: 400;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
@@ -757,17 +752,19 @@ function goBack() {
|
||||
|
||||
.exp-bar-bg {
|
||||
flex: 1;
|
||||
height: 16rpx;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 8rpx;
|
||||
height: 10rpx;
|
||||
background: #454545;
|
||||
border-radius: 5rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.exp-bar-fg {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #FF8C00 0%, #FFD200 100%);
|
||||
border-radius: 8rpx;
|
||||
background: linear-gradient(90deg, #DD7B13 0%, #DD7B13 75%, rgba(244, 255, 176, 0.84) 100%);
|
||||
border-radius: 5rpx;
|
||||
transition: width 0.8s ease-out;
|
||||
/* 发光效果:近似 rgba(244,255,176,0.84) + blur 7.7px 叠加层 */
|
||||
box-shadow: 0 0 14rpx rgba(244, 255, 176, 0.84);
|
||||
}
|
||||
|
||||
.exp-progress {
|
||||
@@ -936,22 +933,25 @@ function goBack() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 116rpx;
|
||||
box-sizing: border-box;
|
||||
background: rgba(35, 33, 30, 0.85);
|
||||
/* 透明边框占位,避免 isSelf 时撑开布局 */
|
||||
border: 2rpx solid transparent;
|
||||
/* 相对定位,使背景装饰图可绝对定位于行内 */
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 当前用户所在行:红色边框高亮 */
|
||||
/* 当前用户所在行:内嵌阴影高亮,不影响尺寸与相邻条目间距 */
|
||||
.rank-item-self {
|
||||
border-color: #ff4d4d;
|
||||
box-shadow: inset 0 0 0 2rpx #ff4d4d;
|
||||
}
|
||||
|
||||
/* 斑马色块侸数行(rank 1/3/5...):白色 5% 透明底 */
|
||||
.rank-item-light {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
/* 前三名行背景装饰图(SVG 设计尺寸 156×58@2x = 312×116rpx,左对齐绝对定位)*/
|
||||
.rank-bg-deco {
|
||||
display: block; /* 消除 image 默认 inline-block 行高撑开导致的条目间缝隙 */
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
@@ -1033,19 +1033,22 @@ function goBack() {
|
||||
/* 总环数(靠右对齐,与用户信息区对比)*/
|
||||
.rank-score {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 2rpx;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rank-score-num {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.rank-score-unit {
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user