139 lines
2.8 KiB
Vue
139 lines
2.8 KiB
Vue
<script setup>
|
|
import Avatar from "@/components/Avatar.vue";
|
|
defineProps({
|
|
players: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
blueTeam: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
redTeam: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
showRank: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
winner: {
|
|
type: Number,
|
|
default: 1,
|
|
},
|
|
});
|
|
const bgColors = ["#364469", "#692735", "#934B4B", "#A98B69", "#8268A2 "];
|
|
</script>
|
|
|
|
<template>
|
|
<view class="container">
|
|
<image
|
|
:src="`../static/battle-header${blueTeam.length ? '' : '-melee'}.png`"
|
|
mode="widthFix"
|
|
/>
|
|
<view v-if="players.length" class="players-melee">
|
|
<view
|
|
v-for="(player, index) in players"
|
|
:key="index"
|
|
:style="{ backgroundColor: bgColors[index] }"
|
|
>
|
|
<Avatar
|
|
:src="player.avatar"
|
|
:size="40"
|
|
:rank="showRank ? index + 1 : 0"
|
|
/>
|
|
<text class="player-name">{{ player.name }}</text>
|
|
</view>
|
|
</view>
|
|
<view v-if="blueTeam.length && redTeam.length" class="players">
|
|
<view>
|
|
<Avatar :src="blueTeam[0].avatar" frame />
|
|
<text class="player-name">{{ blueTeam[0].name }}</text>
|
|
<image
|
|
v-if="winner === 1"
|
|
src="../static/winner-badge.png"
|
|
mode="widthFix"
|
|
/>
|
|
</view>
|
|
<view>
|
|
<Avatar v-if="redTeam[0]" :src="redTeam[0].avatar" frame />
|
|
<text class="player-name">{{ redTeam[0].name }}</text>
|
|
<image
|
|
v-if="winner === 0"
|
|
src="../static/winner-badge.png"
|
|
mode="widthFix"
|
|
/>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.container {
|
|
width: 100%;
|
|
position: relative;
|
|
margin-bottom: 10px;
|
|
padding-top: 5px;
|
|
}
|
|
.container > image:first-child {
|
|
position: absolute;
|
|
width: 100%;
|
|
top: -5px;
|
|
z-index: 1;
|
|
}
|
|
.players {
|
|
display: flex;
|
|
}
|
|
.players > view {
|
|
width: 50%;
|
|
height: 85px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #fff9;
|
|
font-size: 12px;
|
|
margin-top: 15px;
|
|
overflow: hidden;
|
|
position: relative;
|
|
padding-top: 5px;
|
|
}
|
|
.players > view:first-child {
|
|
background-color: #364469;
|
|
}
|
|
.players > view:last-child {
|
|
background-color: #692735;
|
|
}
|
|
.players > view > image:last-child {
|
|
position: absolute;
|
|
width: 60px;
|
|
right: 0;
|
|
bottom: 0;
|
|
}
|
|
.players-melee {
|
|
display: flex;
|
|
height: 85px;
|
|
width: 100%;
|
|
background-color: #364469;
|
|
margin-top: 15px;
|
|
}
|
|
.players-melee > view {
|
|
width: 20%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #fff9;
|
|
font-size: 12px;
|
|
padding-top: 5px;
|
|
}
|
|
.player-name {
|
|
margin-top: 5px;
|
|
width: 80%;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
text-align: center;
|
|
}
|
|
</style>
|