细节调整
This commit is contained in:
@@ -58,10 +58,11 @@ const toRankListPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onShow(async () => {
|
onShow(async () => {
|
||||||
|
const rankList = await getRankListAPI();
|
||||||
|
updateRank(rankList);
|
||||||
const token = uni.getStorageSync("token");
|
const token = uni.getStorageSync("token");
|
||||||
if (token) {
|
if (token) {
|
||||||
const result = await getHomeData();
|
const result = await getHomeData();
|
||||||
updateRank(result);
|
|
||||||
console.log("首页数据:", result);
|
console.log("首页数据:", result);
|
||||||
if (result.user) {
|
if (result.user) {
|
||||||
updateUser(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>
|
||||||
<view>
|
<view>
|
||||||
<text>段位</text>
|
<text>段位</text>
|
||||||
<text>{{ user.scores ? getLvlName(user.scores) : "暂无" }}</text>
|
<text>{{
|
||||||
|
user.scores ? getLvlName(user.scores) : "暂无"
|
||||||
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<text>赛季平均环数</text>
|
<text>赛季平均环数</text>
|
||||||
@@ -367,7 +367,7 @@ const comingSoon = () => {
|
|||||||
height: 82rpx;
|
height: 82rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-right: -10px;
|
margin-right: -10px;
|
||||||
border: 1px solid #312F35;
|
border: 1px solid #312f35;
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,23 +20,27 @@ const data = ref({
|
|||||||
|
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
battleId.value = options.id || "BATTLE-1751732742024840058-732";
|
battleId.value = options.id || "BATTLE-1755239389665389000-812";
|
||||||
const result = await getGameAPI(battleId.value);
|
const result = await getGameAPI(battleId.value);
|
||||||
data.value = result;
|
data.value = result;
|
||||||
if (result.mode === 1) {
|
if (result.mode === 1) {
|
||||||
blueTeam.value = Object.values(result.bluePlayers || {});
|
blueTeam.value = Object.values(result.bluePlayers || {});
|
||||||
redTeam.value = Object.values(result.redPlayers || {});
|
redTeam.value = Object.values(result.redPlayers || {});
|
||||||
Object.values(result.roundsData).forEach((item) => {
|
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 bluePoint = 1;
|
||||||
let redPoint = 1;
|
let redPoint = 1;
|
||||||
const blueTotalRings = item[blueId].reduce((a, b) => a + b.ring, 0);
|
let blueTotalRings = 0;
|
||||||
const redTotalRings = item[redId].reduce((a, b) => a + b.ring, 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) {
|
if (blueTotalRings > redTotalRings) {
|
||||||
bluePoint = 2;
|
bluePoint = 2;
|
||||||
redPoint = 0;
|
redPoint = 0;
|
||||||
@@ -46,16 +50,16 @@ onLoad(async (options) => {
|
|||||||
}
|
}
|
||||||
roundsData.value.push({
|
roundsData.value.push({
|
||||||
blue: {
|
blue: {
|
||||||
name: result.bluePlayers[blueId].name,
|
names: blueTeam.value.map((p) => p.name),
|
||||||
avatar: result.bluePlayers[blueId].avatar,
|
avatars: blueTeam.value.map((p) => p.avatar),
|
||||||
arrows: item[blueId],
|
arrows: blueArrows,
|
||||||
totalRing: blueTotalRings,
|
totalRing: blueTotalRings,
|
||||||
totalScore: bluePoint,
|
totalScore: bluePoint,
|
||||||
},
|
},
|
||||||
red: {
|
red: {
|
||||||
name: result.redPlayers[redId].name,
|
names: redTeam.value.map((p) => p.name),
|
||||||
avatar: result.redPlayers[redId].avatar,
|
avatars: redTeam.value.map((p) => p.avatar),
|
||||||
arrows: item[redId],
|
arrows: redArrows,
|
||||||
totalRing: redTotalRings,
|
totalRing: redTotalRings,
|
||||||
totalScore: redPoint,
|
totalScore: redPoint,
|
||||||
},
|
},
|
||||||
@@ -174,7 +178,18 @@ const checkBowData = () => {
|
|||||||
</view>
|
</view>
|
||||||
<view class="score-row">
|
<view class="score-row">
|
||||||
<view>
|
<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">
|
<text v-for="(arrow, index2) in round.blue.arrows" :key="index2">
|
||||||
{{ arrow.ring }}环
|
{{ arrow.ring }}环
|
||||||
</text>
|
</text>
|
||||||
@@ -188,7 +203,18 @@ const checkBowData = () => {
|
|||||||
</view>
|
</view>
|
||||||
<view class="score-row">
|
<view class="score-row">
|
||||||
<view>
|
<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">
|
<text v-for="(arrow, index2) in round.red.arrows" :key="index2">
|
||||||
{{ arrow.ring }}环
|
{{ arrow.ring }}环
|
||||||
</text>
|
</text>
|
||||||
@@ -250,12 +276,22 @@ const checkBowData = () => {
|
|||||||
.score-row > view {
|
.score-row > view {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
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 {
|
.score-row > view:first-child > text {
|
||||||
margin-left: 20px;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
display: block;
|
display: block;
|
||||||
width: 30px;
|
width: 35px;
|
||||||
}
|
}
|
||||||
.score-row > image:last-child {
|
.score-row > image:last-child {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
|
|||||||
@@ -167,14 +167,13 @@ async function onReceiveMessage(messages = []) {
|
|||||||
const redPlayer = redTeam.value.find(
|
const redPlayer = redTeam.value.find(
|
||||||
(item) => item.id === currentShooterId.value
|
(item) => item.id === currentShooterId.value
|
||||||
);
|
);
|
||||||
tips.value = redPlayer ? "请红队射箭" : "请蓝队射箭";
|
const nextTips = redPlayer ? "请红队射箭" : "请蓝队射箭";
|
||||||
uni.$emit("update-tips", tips.value);
|
if (nextTips !== tips.value) {
|
||||||
// if (redPlayer) tips.value = "红队" + redPlayer.id;
|
tips.value = nextTips;
|
||||||
// const bluePlayer = blueTeam.value.find(
|
uni.$emit("update-tips", tips.value);
|
||||||
// (item) => item.id === currentShooterId.value
|
} else {
|
||||||
// );
|
uni.$emit("update-ramain", 15);
|
||||||
// if (bluePlayer) tips.value = "蓝队" + bluePlayer.id;
|
}
|
||||||
uni.$emit("update-tips", tips.value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const players = ref([]);
|
|||||||
const allRoundsScore = ref({});
|
const allRoundsScore = ref({});
|
||||||
const data = ref({});
|
const data = ref({});
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (!options.battleId) {
|
if (options.battleId) {
|
||||||
const result = await getGameAPI(
|
const result = await getGameAPI(
|
||||||
options.battleId || "BATTLE-1754988051086075885-926"
|
options.battleId || "BATTLE-1754988051086075885-926"
|
||||||
);
|
);
|
||||||
@@ -198,13 +198,14 @@ const onClickTab = (index) => {
|
|||||||
.score-row {
|
.score-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
margin-left: 15px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.score-row > view:last-child {
|
.score-row > view:last-child {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, auto);
|
grid-template-columns: repeat(3, auto);
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
.score-item {
|
.score-item {
|
||||||
background-image: url("../static/score-bg.png");
|
background-image: url("../static/score-bg.png");
|
||||||
|
|||||||
Reference in New Issue
Block a user