细节完善

This commit is contained in:
kron
2025-08-15 11:23:23 +08:00
parent 2a9a373743
commit b46bc7aaa5
9 changed files with 121 additions and 80 deletions

View File

@@ -21,12 +21,10 @@ function exit() {
}
onLoad(async (options) => {
// const myId = user.value.id;
const myId = 39;
const myId = user.value.id;
if (options.battleId) {
const result = await getGameAPI(
options.battleId || "BATTLE-1754302650041171466-546"
// options.battleId || "BATTLE-1754017978280570919-571"
options.battleId || "BATTLE-1755156795334880000-865"
);
data.value = {
...result,
@@ -58,12 +56,17 @@ onLoad(async (options) => {
} else {
const battleInfo = uni.getStorageSync("last-battle");
if (!battleInfo) return;
data.value = battleInfo;
data.value = {
mvps: [],
...battleInfo,
};
if (battleInfo.mode === 1) {
battleInfo.playerStats.forEach((p) => {
if (p.team === 1) data.value.bluePlayers = [p];
if (p.team === 0) data.value.redPlayers = [p];
if (p.mvp) data.value.mvps.push(p);
});
data.value.mvps.sort((a, b) => b.totalRings - a.totalRings);
}
rank.value = 0;
const mine = battleInfo.playerStats.find((p, index) => {
@@ -90,7 +93,7 @@ const checkBowData = () => {
<block v-if="data.mode === 1">
<view class="header-team" :style="{ marginTop: '25%' }">
<image src="../static/battle-result.png" mode="widthFix" />
<!-- <view class="header-solo">
<view class="header-solo" v-if="data.teamSize === 2">
<text
:style="{
background:
@@ -110,47 +113,38 @@ const checkBowData = () => {
:borderColor="data.winner === 1 ? '#5FADFF' : '#FF5656'"
mode="widthFix"
/>
</view> -->
</view>
</view>
<view class="header-mvp">
<image src="../static/red-team-win.png" mode="widthFix" />
<view class="header-mvp" v-if="data.teamSize !== 2">
<image
:src="`../static/${data.winner === 1 ? 'blue' : 'red'}-team-win.png`"
mode="widthFix"
/>
<view>
<view>
<view v-if="data.mvps && data.mvps[0].totalRings">
<image src="../static/title-mvp.png" mode="widthFix" />
<text
>斩获<text
:style="{ color: '#fed847', fontSize: '18px', margin: '0 2px' }"
>60</text
>{{ data.mvps[0].totalRings }}</text
></text
>
</view>
<view>
<view>
<view v-if="data.mvps && data.mvps.length">
<view v-for="(player, index) in data.mvps" :key="index">
<view class="team-avatar">
<Avatar
:src="user.avatar"
:src="player.avatar"
:size="40"
:borderColor="data.myTeam === 1 ? '#5fadff' : '#ff6060'"
/>
<text :style="{ backgroundColor: '#ff6060' }">自己</text>
<text
v-if="player.id === user.id"
:style="{ backgroundColor: '#ff6060' }"
>自己</text
>
</view>
<text>某某某</text>
</view>
<view>
<Avatar
:src="user.avatar"
:size="40"
:borderColor="data.myTeam === 1 ? '#5fadff' : '#ff6060'"
/>
<text>某某某</text>
</view>
<view>
<Avatar
:src="user.avatar"
:size="40"
:borderColor="data.myTeam === 1 ? '#5fadff' : '#ff6060'"
/>
<text>某某某</text>
<text>{{ player.name }}</text>
</view>
</view>
</view>
@@ -513,7 +507,7 @@ const checkBowData = () => {
.header-mvp > view > view:first-child > text {
color: #fff;
font-size: 14px;
transform: translateY(-4px) skewY(-6deg);
transform: translateY(-4px) skewY(-6deg);
}
.header-mvp > view > view:last-child {
display: flex;
@@ -522,6 +516,7 @@ const checkBowData = () => {
font-size: 8px;
text-align: center;
transform: translateY(-16px) skewY(-6deg);
min-width: 40%;
}
.header-mvp > view > view:last-child > view {
margin-right: 4vw;

View File

@@ -13,6 +13,8 @@ const { getLvlName } = store;
const defaultSeasonData = {
"1v1": { totalGames: 0, winCount: 0, winRate: 0 },
"2v2": { totalGames: 0, winCount: 0, winRate: 0 },
"3v3": { totalGames: 0, winCount: 0, winRate: 0 },
"5m": { totalGames: 0, winCount: 0, winRate: 0 },
"10m": { totalGames: 0, winCount: 0, winRate: 0 },
};
@@ -98,6 +100,8 @@ const updateData = () => {
}
let keyName = "";
if (item.gameType === 1 && item.teamSize === 2) keyName = "1v1";
if (item.gameType === 1 && item.teamSize === 3) keyName = "2v2";
if (item.gameType === 1 && item.teamSize === 5) keyName = "3v3";
if (item.gameType === 2 && item.teamSize === 5) keyName = "5m";
if (item.gameType === 2 && item.teamSize === 10) keyName = "10m";
if (keyName) {
@@ -234,13 +238,13 @@ onShow(async () => {
<view class="data-progress">
<text>
{{
`【2 V 2】${currentSeasonData["1v1"].totalGames}场 胜率 ${currentSeasonData["1v1"].winRate}%`
`【2 V 2】${currentSeasonData["2v2"].totalGames}场 胜率 ${currentSeasonData["2v2"].winRate}%`
}}
</text>
<view>
<view
:style="{
width: `${currentSeasonData['1v1'].winRate}%`,
width: `${currentSeasonData['2v2'].winRate}%`,
backgroundColor: '#69B5FF',
}"
/>
@@ -249,7 +253,7 @@ onShow(async () => {
<view class="data-progress">
<text>
{{
`【3 V 3】${currentSeasonData["1v1"].totalGames}场 胜率 ${currentSeasonData["1v1"].winRate}%`
`【3 V 3】${currentSeasonData["3v3"].totalGames}场 胜率 ${currentSeasonData["3v3"].winRate}%`
}}
</text>
<view>

View File

@@ -130,17 +130,10 @@ function recoverData(battleInfo) {
// if (battleInfo.status !== 11) return;
if (battleInfo.firePlayerIndex) {
currentShooterId.value = battleInfo.firePlayerIndex;
// const teamPrefix =
// redTeam.value[0].id === currentShooterId.value
// ? "请红队射箭 - "
// : "请蓝队射箭 - ";
// const roundSuffix = isFinalShoot.value
// ? "决金箭"
// : `第${roundsName[currentRound.value]}轮`;
tips.value =
redTeam.value[0].id === currentShooterId.value
? "请红队射箭"
: "请蓝队射箭";
const redPlayer = redTeam.value.find(
(item) => item.id === currentShooterId.value
);
tips.value = redPlayer ? "请红队射箭" : "请蓝队射箭";
uni.$emit("update-tips", tips.value);
}
if (battleInfo.fireTime > 0) {
@@ -171,17 +164,16 @@ async function onReceiveMessage(messages = []) {
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (currentShooterId.value !== msg.userId) {
currentShooterId.value = msg.userId;
// const teamPrefix =
// redTeam.value[0].id === currentShooterId.value
// ? "请红队射箭 - "
// : "请蓝队射箭 - ";
// const roundSuffix = isFinalShoot.value
// ? "决金箭"
// : `第${roundsName[currentRound.value]}轮`;
tips.value =
redTeam.value[0].id === currentShooterId.value
? "请红队射箭"
: "请蓝队射箭";
const redPlayer = redTeam.value.find(
(item) => item.id === currentShooterId.value
);
tips.value = redPlayer ? "请红队射箭" : "请蓝队射箭";
uni.$emit("update-tips", tips.value);
// if (redPlayer) tips.value = "红队" + redPlayer.id;
// const bluePlayer = blueTeam.value.find(
// (item) => item.id === currentShooterId.value
// );
// if (bluePlayer) tips.value = "蓝队" + bluePlayer.id;
uni.$emit("update-tips", tips.value);
}
}
@@ -331,6 +323,7 @@ onHide(() => {
:roundResults="roundResults"
:redPoints="redPoints"
:bluePoints="bluePoints"
:power="power"
/>
<Timer v-if="!start" />
<ScreenHint