UI更新
This commit is contained in:
@@ -14,8 +14,10 @@ const players = ref([]);
|
||||
const allRoundsScore = ref({});
|
||||
const data = ref({});
|
||||
onLoad(async (options) => {
|
||||
if (options.battleId) {
|
||||
const result = await getGameAPI(options.battleId);
|
||||
if (!options.battleId) {
|
||||
const result = await getGameAPI(
|
||||
options.battleId || "BATTLE-1754988051086075885-926"
|
||||
);
|
||||
data.value = result;
|
||||
if (result.winner === 0) {
|
||||
players.value = [
|
||||
@@ -100,50 +102,59 @@ const onClickTab = (index) => {
|
||||
<view :style="{ margin: '20px 0' }">
|
||||
<BowTarget :scores="redScores" :blueScores="blueScores" />
|
||||
</view>
|
||||
<view class="score-row" v-for="(player, index) in players" :key="index">
|
||||
<Avatar
|
||||
:src="player.avatar"
|
||||
:borderColor="
|
||||
data.bluePlayers[player.playerId] ? '#64BAFF' : '#FF6767'
|
||||
"
|
||||
/>
|
||||
<view class="score-container">
|
||||
<view
|
||||
v-if="selected === 0"
|
||||
v-for="(ring, index) in allRoundsScore[player.playerId]"
|
||||
class="score-row"
|
||||
v-for="(player, index) in players"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
:style="{ width: '13vw', height: '13vw' }"
|
||||
:style="{
|
||||
justifyContent: index % 2 === 0 ? 'flex-end' : 'flex-start',
|
||||
}"
|
||||
>
|
||||
{{ ring }}
|
||||
</view>
|
||||
<view
|
||||
v-if="
|
||||
selected === 1 &&
|
||||
data.goldenRound &&
|
||||
data.goldenRound.arrowHistory.find(
|
||||
(a) => a.playerId === player.playerId
|
||||
)
|
||||
"
|
||||
v-for="(score, index) in data.goldenRound.arrowHistory"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
:style="{ width: '13vw', height: '13vw' }"
|
||||
>
|
||||
{{ score.ring }}
|
||||
</view>
|
||||
<view
|
||||
v-if="
|
||||
(!data.goldenRound && selected > 0) ||
|
||||
(data.goldenRound && selected > 1)
|
||||
"
|
||||
v-for="(score, index) in data.roundsData[
|
||||
data.goldenRound ? selected - 1 : selected
|
||||
][player.playerId]"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
:style="{ width: '13vw', height: '13vw' }"
|
||||
>
|
||||
{{ score.ring }}
|
||||
<Avatar
|
||||
:src="player.avatar"
|
||||
:borderColor="
|
||||
data.bluePlayers[player.playerId] ? '#64BAFF' : '#FF6767'
|
||||
"
|
||||
:size="36"
|
||||
/>
|
||||
<view>
|
||||
<view
|
||||
v-if="selected === 0"
|
||||
v-for="(ring, index) in allRoundsScore[player.playerId]"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
>
|
||||
{{ ring }}
|
||||
</view>
|
||||
<view
|
||||
v-if="
|
||||
selected === 1 &&
|
||||
data.goldenRound &&
|
||||
data.goldenRound.arrowHistory.find(
|
||||
(a) => a.playerId === player.playerId
|
||||
)
|
||||
"
|
||||
v-for="(score, index) in data.goldenRound.arrowHistory"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
>
|
||||
{{ score.ring }}
|
||||
</view>
|
||||
<view
|
||||
v-if="
|
||||
(!data.goldenRound && selected > 0) ||
|
||||
(data.goldenRound && selected > 1)
|
||||
"
|
||||
v-for="(score, index) in data.roundsData[
|
||||
data.goldenRound ? selected - 1 : selected
|
||||
][player.playerId]"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
>
|
||||
{{ score.ring }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -185,10 +196,15 @@ const onClickTab = (index) => {
|
||||
color: #000;
|
||||
}
|
||||
.score-row {
|
||||
margin: 10px 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.score-row > view:last-child {
|
||||
margin-left: 10px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, auto);
|
||||
gap: 5px;
|
||||
}
|
||||
.score-item {
|
||||
background-image: url("../static/score-bg.png");
|
||||
@@ -199,7 +215,13 @@ const onClickTab = (index) => {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 24px;
|
||||
margin-left: 10px;
|
||||
font-size: 20px;
|
||||
width: 10vw;
|
||||
height: 10vw;
|
||||
}
|
||||
.score-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
row-gap: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user