Files
shoot-miniprograms/src/components/BattleFooter.vue
2025-08-18 16:09:11 +08:00

207 lines
4.9 KiB
Vue

=
<script setup>
import BowPower from "@/components/BowPower.vue";
import { RoundImages } from "@/constants";
defineProps({
roundResults: {
type: Array,
default: () => [],
},
bluePoints: {
type: Number,
default: 0,
},
redPoints: {
type: Number,
default: 0,
},
power: {
type: Number,
default: 0,
},
goldenRound: {
type: Number,
default: 0,
},
});
</script>
<template>
<view class="container">
<view class="guide-row">
<image src="../static/shooter.png" mode="widthFix" />
<view
:style="{
marginBottom: '10px',
transform: 'scale(0.8) translateX(10px)',
}"
>
<BowPower :power="power" />
</view>
</view>
<view>
<image src="../static/battle-header-melee.png" mode="widthFix" />
<text>蓝队({{ bluePoints }})</text>
<text>红队({{ redPoints }})</text>
</view>
<view class="players">
<view>
<view v-for="(result, index) in roundResults" :key="index">
<block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view>
<text>{{
result.blueArrows.length
? result.blueArrows
.map((item) => item.ring)
.reduce((last, next) => last + next, 0)
: ""
}}</text>
<text></text>
</view>
</view>
<block v-if="roundResults.length < 3">
<view v-for="i in 3 - roundResults.length" :key="i">
<image
:src="RoundImages[`round${i + roundResults.length}`]"
mode="widthFix"
/>
<view>
<text></text>
<text></text>
</view>
</view>
</block>
</view>
<view>
<view v-for="(result, index) in roundResults" :key="index">
<block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view>
<text>{{
result.redArrows.length
? result.redArrows
.map((item) => item.ring)
.reduce((last, next) => last + next, 0)
: ""
}}</text>
<text></text>
</view>
</view>
<block v-if="roundResults.length < 3">
<view v-for="i in 3 - roundResults.length" :key="i">
<image
:src="RoundImages[`round${i + roundResults.length}`]"
mode="widthFix"
/>
<view>
<text></text>
<text></text>
</view>
</view>
</block>
</view>
</view>
</view>
</template>
<style scoped>
.container {
width: 100%;
overflow: hidden;
margin-top: -40px;
}
.container > view:nth-child(2) {
position: relative;
display: flex;
justify-content: space-around;
align-items: center;
font-size: 13px;
}
.container > view:nth-child(2) > image:first-child {
position: absolute;
width: 100%;
top: -6px;
}
.container > view:nth-child(2) > text {
z-index: 1;
margin-top: 2px;
}
.players {
display: flex;
}
.players > view {
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #fff;
padding-top: 5px;
}
.players > view:first-child > view {
background: linear-gradient(270deg, #172a86 0%, #0006 100%);
}
.players > view:last-child > view {
background: linear-gradient(270deg, #0006 0%, #6a1212 100%);
}
.players > view > view {
min-height: 25px;
width: calc(100% - 40px);
padding: 2px 20px;
margin-bottom: 5px;
display: flex;
justify-content: space-between;
align-items: center;
}
.players > view > view > image:first-child {
width: 72px;
}
.players > view > view > view:last-child {
font-size: 10px;
}
.players > view > view > view:last-child > text:first-child {
font-size: 16px;
color: #fed847;
margin-right: 5px;
}
.guide-row {
display: flex;
justify-content: space-between;
align-items: flex-end;
padding: 0 5vw;
margin-bottom: -4px;
z-index: 2;
position: relative;
}
.guide-row > image {
width: 18%;
}
</style>