细节调整

This commit is contained in:
kron
2025-08-15 15:25:41 +08:00
parent 13c4ce7690
commit 7242475735
4 changed files with 71 additions and 35 deletions

View File

@@ -58,10 +58,11 @@ const toRankListPage = () => {
};
onShow(async () => {
const rankList = await getRankListAPI();
updateRank(rankList);
const token = uni.getStorageSync("token");
if (token) {
const result = await getHomeData();
updateRank(result);
console.log("首页数据:", result);
if (result.user) {
updateUser(result.user);
@@ -79,9 +80,6 @@ onShow(async () => {
);
}
}
} else {
const result = await getRankListAPI();
updateRank(result);
}
});
@@ -187,7 +185,9 @@ const comingSoon = () => {
<view>
<view>
<text>段位</text>
<text>{{ user.scores ? getLvlName(user.scores) : "暂无" }}</text>
<text>{{
user.scores ? getLvlName(user.scores) : "暂无"
}}</text>
</view>
<view>
<text>赛季平均环数</text>
@@ -367,7 +367,7 @@ const comingSoon = () => {
height: 82rpx;
border-radius: 50%;
margin-right: -10px;
border: 1px solid #312F35;
border: 1px solid #312f35;
position: relative;
box-sizing: border-box;
}

View File

@@ -20,23 +20,27 @@ const data = ref({
onLoad(async (options) => {
if (options.id) {
battleId.value = options.id || "BATTLE-1751732742024840058-732";
battleId.value = options.id || "BATTLE-1755239389665389000-812";
const result = await getGameAPI(battleId.value);
data.value = result;
if (result.mode === 1) {
blueTeam.value = Object.values(result.bluePlayers || {});
redTeam.value = Object.values(result.redPlayers || {});
Object.values(result.roundsData).forEach((item) => {
let blueId = Object.keys(item)[0];
let redId = Object.keys(item)[1];
if (!result.bluePlayers[blueId]) {
blueId = Object.keys(item)[1];
redId = Object.keys(item)[0];
}
let bluePoint = 1;
let redPoint = 1;
const blueTotalRings = item[blueId].reduce((a, b) => a + b.ring, 0);
const redTotalRings = item[redId].reduce((a, b) => a + b.ring, 0);
let blueTotalRings = 0;
let redTotalRings = 0;
let blueArrows = [];
let redArrows = [];
blueTeam.value.forEach((p) => {
blueTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0);
blueArrows = [...blueArrows, ...item[p.playerId]];
});
redTeam.value.forEach((p) => {
redTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0);
redArrows = [...redArrows, ...item[p.playerId]];
});
if (blueTotalRings > redTotalRings) {
bluePoint = 2;
redPoint = 0;
@@ -46,16 +50,16 @@ onLoad(async (options) => {
}
roundsData.value.push({
blue: {
name: result.bluePlayers[blueId].name,
avatar: result.bluePlayers[blueId].avatar,
arrows: item[blueId],
names: blueTeam.value.map((p) => p.name),
avatars: blueTeam.value.map((p) => p.avatar),
arrows: blueArrows,
totalRing: blueTotalRings,
totalScore: bluePoint,
},
red: {
name: result.redPlayers[redId].name,
avatar: result.redPlayers[redId].avatar,
arrows: item[redId],
names: redTeam.value.map((p) => p.name),
avatars: redTeam.value.map((p) => p.avatar),
arrows: redArrows,
totalRing: redTotalRings,
totalScore: redPoint,
},
@@ -174,7 +178,18 @@ const checkBowData = () => {
</view>
<view class="score-row">
<view>
<Avatar :src="round.blue.avatar" :size="25" borderColor="#64BAFF" />
<view>
<image
v-for="(src, index) in round.blue.avatars"
:style="{
borderColor: '#64BAFF',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
mode="widthFix"
/>
</view>
<text v-for="(arrow, index2) in round.blue.arrows" :key="index2">
{{ arrow.ring }}环
</text>
@@ -188,7 +203,18 @@ const checkBowData = () => {
</view>
<view class="score-row">
<view>
<Avatar :src="round.red.avatar" :size="25" borderColor="#FF6767" />
<view>
<image
v-for="(src, index) in round.blue.avatars"
:style="{
borderColor: '#FF6767',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
mode="widthFix"
/>
</view>
<text v-for="(arrow, index2) in round.red.arrows" :key="index2">
{{ arrow.ring }}环
</text>
@@ -250,12 +276,22 @@ const checkBowData = () => {
.score-row > view {
display: flex;
align-items: center;
font-size: 12px;
}
.score-row > view:first-child > view:first-child {
display: flex;
align-items: center;
}
.score-row > view:first-child > view:first-child > image {
width: 25px;
height: 25px;
border: 1px solid;
border-radius: 50%;
}
.score-row > view:first-child > text {
margin-left: 20px;
color: #fff;
display: block;
width: 30px;
width: 35px;
}
.score-row > image:last-child {
width: 40px;

View File

@@ -167,14 +167,13 @@ async function onReceiveMessage(messages = []) {
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);
const nextTips = redPlayer ? "请红队射箭" : "请蓝队射箭";
if (nextTips !== tips.value) {
tips.value = nextTips;
uni.$emit("update-tips", tips.value);
} else {
uni.$emit("update-ramain", 15);
}
}
}
if (msg.constructor === MESSAGETYPES.ShootResult) {

View File

@@ -14,7 +14,7 @@ const players = ref([]);
const allRoundsScore = ref({});
const data = ref({});
onLoad(async (options) => {
if (!options.battleId) {
if (options.battleId) {
const result = await getGameAPI(
options.battleId || "BATTLE-1754988051086075885-926"
);
@@ -198,13 +198,14 @@ const onClickTab = (index) => {
.score-row {
display: flex;
align-items: flex-start;
margin-left: 15px;
margin-left: 5px;
}
.score-row > view:last-child {
margin-left: 10px;
display: grid;
grid-template-columns: repeat(3, auto);
gap: 5px;
margin-right: 5px;
}
.score-item {
background-image: url("../static/score-bg.png");