bug修复

This commit is contained in:
kron
2025-07-16 12:09:27 +08:00
parent d5bc1a6a89
commit c1fa8b9469
5 changed files with 93 additions and 58 deletions

View File

@@ -42,16 +42,17 @@ onMounted(async () => {
const battleInfo = uni.getStorageSync("last-battle");
console.log("----battleInfo", battleInfo);
data.value = battleInfo;
if (battleInfo.mode === 1) {
battleInfo.playerStats.forEach((p) => {
if (p.id === user.value.id) {
totalPoints.value = p.totalScore;
if (p.team === battleInfo.winner) ifWin.value = true;
}
});
} else if (battleInfo.mode === 2) {
const mine = battleInfo.playerStats.find((p) => p.id === user.value.id);
if (mine) totalPoints.value = mine.totalScore;
const mine = battleInfo.playerStats.find((p) => p.id === user.value.id);
if (mine) {
if (battleInfo.mode === 1) {
totalPoints.value = mine.roundStats.reduce(
(last, next) => last + next.arrows.length,
0
);
if (mine.team === battleInfo.winner) ifWin.value = true;
} else if (battleInfo.mode === 2) {
totalPoints.value = mine.totalScore;
}
}
// const result = await getHomeData();
// if (result.user) updateUser(result.user);
@@ -151,7 +152,7 @@ const checkBowData = () => {
:borderColor="topThreeColors[index] || ''"
/>
<view class="player-title">
<text>{{ player.name }}</text>
<text class="truncate">{{ player.name }}</text>
<text>{{ getLvlName(player.totalScore) }}</text>
</view>
<text
@@ -164,12 +165,12 @@ const checkBowData = () => {
<view class="battle-e">
<image src="../static/row-yellow-bg.png" mode="widthFix" />
<Avatar v-if="data.mode === 1" :src="user.avatar" :size="40" />
<text v-if="data.battleMode === 1"
>经验 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}</text
>
<text v-if="data.battleMode === 2"
>积分 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}</text
>
<text v-if="data.battleMode === 1">
经验 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}
</text>
<text v-if="data.battleMode === 2">
积分 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}
</text>
</view>
<text v-if="data.mode === 1" class="description">{{
ifWin ? "你已经奔跑在通向王者的路上了" : "失败是成功之母儿子在等你"
@@ -350,6 +351,7 @@ const checkBowData = () => {
.player-title > text:first-child {
color: #fff;
margin-bottom: 3px;
width: 40vw;
}
.player-title > text:last-child {
font-size: 13px;