Files
shoot-miniprograms/src/components/PlayerScore2.vue

159 lines
3.1 KiB
Vue
Raw Normal View History

2025-06-25 01:46:04 +08:00
<script setup>
2025-06-26 23:41:23 +08:00
import { topThreeColors } from "@/constants";
2025-06-25 01:46:04 +08:00
defineProps({
avatar: {
type: String,
default: "",
},
name: {
type: String,
default: "",
},
scores: {
type: Array,
default: () => [],
},
rank: {
type: Number,
default: 0,
},
totalScore: {
type: Number,
default: 0,
},
totalRing: {
type: Number,
default: 0,
},
});
const rowCount = new Array(6).fill(0);
</script>
<template>
<view class="container">
<view>
<image
v-if="rank === 1"
src="../static/champ1.png"
mode="widthFix"
class="avatar-rank"
/>
<image
v-if="rank === 2"
src="../static/champ2.png"
mode="widthFix"
class="avatar-rank"
/>
<image
v-if="rank === 3"
src="../static/champ3.png"
mode="widthFix"
class="avatar-rank"
/>
<view v-if="rank > 3" class="rank-view">{{ rank }}</view>
<image
:src="avatar"
mode="widthFix"
:style="{ borderColor: topThreeColors[rank - 1] || '#fff' }"
/>
</view>
<view>
<view>
<view v-for="(_, index) in rowCount" :key="index">
<text>{{ scores[index] ? `${scores[index].ring}` : "-" }}</text>
</view>
</view>
<view>
<view v-for="(_, index) in rowCount" :key="index">
<text>{{
scores[index + 6] ? `${scores[index + 6].ring}` : "-"
}}</text>
</view>
</view>
</view>
<view>
<text>{{ totalRing }}</text>
<text>积分{{ totalScore }}</text>
</view>
</view>
</template>
<style scoped>
.container {
width: calc(100% - 65px);
display: flex;
align-items: center;
border: 1px solid #fff3;
margin: 10px 0;
margin-left: 30px;
border-radius: 15px;
padding: 10px;
color: #fff9;
font-size: 28rpx;
position: relative;
}
.container > view:first-child {
position: absolute;
width: 30px;
height: 30px;
top: 30%;
left: -17px;
}
.container > view:first-child > image:last-child {
width: 30px;
max-height: 30px;
min-height: 30px;
border-radius: 50%;
border: 1px solid #fff;
}
.avatar-rank,
.rank-view {
position: absolute;
width: 16px;
height: 17px;
top: -9px;
right: 5px;
}
.rank-view {
background-color: #6d6d6d;
text-align: center;
line-height: 15px;
font-size: 10px;
border-radius: 50%;
color: #fff;
}
.container > view:nth-child(2) {
display: flex;
flex-direction: column;
margin-left: 15px;
border-right: 1px solid #fff3;
padding-right: 10px;
}
.container > view:nth-child(2) > view {
display: flex;
}
.container > view:nth-child(2) > view text {
2025-07-11 00:47:34 +08:00
width: 36px;
2025-06-25 01:46:04 +08:00
text-align: center;
display: block;
}
.container > view:nth-child(2) > view:first-child {
border-bottom: 1px solid #fff3;
padding-bottom: 10px;
}
.container > view:nth-child(2) > view:last-child {
padding-top: 10px;
}
.container > view:nth-child(3) {
display: flex;
2025-07-11 00:47:34 +08:00
flex-direction: column;
2025-06-25 01:46:04 +08:00
align-items: center;
padding-left: 10px;
2025-07-11 00:47:34 +08:00
width: 100%;
2025-06-25 01:46:04 +08:00
}
2025-07-11 00:47:34 +08:00
.container > view:nth-child(3) > text {
text-align: center;
margin: 5px 0;
2025-06-25 01:46:04 +08:00
}
</style>