修改回合得分显示

This commit is contained in:
kron
2025-07-02 15:57:58 +08:00
parent d2aa87e91c
commit 997e2ee756
7 changed files with 179 additions and 54 deletions

View File

@@ -0,0 +1,156 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
const props = defineProps({
type: {
type: Number,
default: 0,
},
round: {
type: Number,
default: 0,
},
bluePoint: {
type: Number,
default: 0,
},
redPoint: {
type: Number,
default: 0,
},
roundData: {
type: Object,
default: () => ({}),
},
});
const count = ref(10);
const tiemr = ref(null);
onMounted(() => {
if (tiemr.value) clearInterval(tiemr.value);
tiemr.value = setInterval(() => {
if (count.value === 0) clearInterval(tiemr.value);
else count.value -= 1;
}, 1000);
});
onUnmounted(() => {
if (tiemr.value) clearInterval(tiemr.value);
});
</script>
<template>
<view class="round-end-tip">
<text>{{ round }}轮射击结束</text>
<block v-if="type === 0">
<view class="point-view1">
<text>本轮红队</text>
<text>{{
(roundData.redArrows || []).reduce(
(last, next) => last + next.ring,
0
)
}}</text>
<text>蓝队</text>
<text>{{
(roundData.blueArrows || []).reduce(
(last, next) => last + next.ring,
0
)
}}</text>
<text></text>
</view>
<text v-if="bluePoint === redPoint">
红队蓝队各得<text :style="{ color: '#fed847', margin: '0 5px' }">{{
redPoint
}}</text
>
</text>
<text v-if="bluePoint > redPoint">
蓝队获胜<text :style="{ color: '#fed847', margin: '0 5px' }">{{
bluePoint
}}</text
>
</text>
<text v-if="bluePoint < redPoint">
红队获胜<text :style="{ color: '#fed847', margin: '0 5px' }">{{
redPoint
}}</text
>
</text>
</block>
<block v-if="type === 1">
<view class="point-view2">
<text>蓝队</text>
<text>{{ bluePoint }}</text>
<text>红队</text>
<text>{{ redPoint }}</text>
<text></text>
</view>
<text>同分僵局最后一箭定江山</text>
<view class="final-shoot">
<text>{{ count }}</text>
<text>秒后蓝红双方</text>
<text>决金箭</text>
<text>一箭决胜负</text>
</view>
</block>
</view>
</template>
<style scoped>
.round-end-tip {
width: 100%;
color: #fff9;
display: flex;
flex-direction: column;
align-items: center;
font-size: 16px;
}
.round-end-tip > text:first-child {
font-size: 18px;
color: #fff;
}
.point-view1 {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
margin-bottom: 3px;
}
.point-view1 > text:nth-child(2),
.point-view1 > text:nth-child(4) {
color: #fed847;
margin: 0 5px;
}
.point-view2 {
margin: 12px 0;
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.point-view2 > text:nth-child(2),
.point-view2 > text:nth-child(4) {
color: #fed847;
width: 30px;
text-align: center;
font-size: 30px;
}
.final-shoot {
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
font-size: 14px;
}
.final-shoot > text:nth-child(1) {
width: 20px;
text-align: right;
}
.final-shoot > text:nth-child(1),
.final-shoot > text:nth-child(3) {
font-size: 18px;
color: #fed847;
margin-left: 10px;
margin-right: 5px;
}
</style>