2025-07-02 15:57:58 +08:00
|
|
|
|
<script setup>
|
2025-07-06 00:42:10 +08:00
|
|
|
|
import { ref, watch, onMounted, onUnmounted } from "vue";
|
2025-07-02 15:57:58 +08:00
|
|
|
|
const props = defineProps({
|
2025-07-06 00:42:10 +08:00
|
|
|
|
isFinal: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: false,
|
2025-07-02 15:57:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
round: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
bluePoint: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
redPoint: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
roundData: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => ({}),
|
|
|
|
|
|
},
|
2025-07-06 00:42:10 +08:00
|
|
|
|
onAutoClose: {
|
|
|
|
|
|
type: Function,
|
|
|
|
|
|
default: () => {},
|
|
|
|
|
|
},
|
2025-07-02 15:57:58 +08:00
|
|
|
|
});
|
2025-07-06 00:42:10 +08:00
|
|
|
|
const count = ref(3);
|
2025-07-02 15:57:58 +08:00
|
|
|
|
const tiemr = ref(null);
|
2025-07-06 00:42:10 +08:00
|
|
|
|
function startCount() {
|
2025-07-02 15:57:58 +08:00
|
|
|
|
if (tiemr.value) clearInterval(tiemr.value);
|
|
|
|
|
|
tiemr.value = setInterval(() => {
|
2025-07-06 00:42:10 +08:00
|
|
|
|
if (count.value === 0) {
|
|
|
|
|
|
clearInterval(tiemr.value);
|
|
|
|
|
|
props.onAutoClose();
|
|
|
|
|
|
} else count.value -= 1;
|
2025-07-02 15:57:58 +08:00
|
|
|
|
}, 1000);
|
2025-07-06 00:42:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => [props.isFinal, props.roundData],
|
|
|
|
|
|
([n_isFinal, n_roundData]) => {
|
|
|
|
|
|
count.value = n_isFinal ? 10 : 3;
|
|
|
|
|
|
startCount();
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
startCount();
|
2025-07-02 15:57:58 +08:00
|
|
|
|
});
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
if (tiemr.value) clearInterval(tiemr.value);
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<view class="round-end-tip">
|
|
|
|
|
|
<text>第{{ round }}轮射击结束</text>
|
2025-07-06 00:42:10 +08:00
|
|
|
|
<block v-if="!isFinal">
|
2025-07-02 15:57:58 +08:00
|
|
|
|
<view class="point-view1">
|
2025-07-11 12:03:55 +08:00
|
|
|
|
<text>本轮蓝队</text>
|
2025-07-02 15:57:58 +08:00
|
|
|
|
<text>{{
|
2025-07-11 12:03:55 +08:00
|
|
|
|
(roundData.blueArrows || []).reduce(
|
2025-07-02 15:57:58 +08:00
|
|
|
|
(last, next) => last + next.ring,
|
|
|
|
|
|
0
|
|
|
|
|
|
)
|
|
|
|
|
|
}}</text>
|
2025-07-11 12:03:55 +08:00
|
|
|
|
<text>环,红队</text>
|
2025-07-02 15:57:58 +08:00
|
|
|
|
<text>{{
|
2025-07-11 12:03:55 +08:00
|
|
|
|
(roundData.redArrows || []).reduce(
|
2025-07-02 15:57:58 +08:00
|
|
|
|
(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>
|
2025-07-06 00:42:10 +08:00
|
|
|
|
<block v-if="isFinal">
|
2025-07-02 15:57:58 +08:00
|
|
|
|
<view class="point-view2">
|
|
|
|
|
|
<text>蓝队</text>
|
2025-07-08 13:23:29 +08:00
|
|
|
|
<text>5</text>
|
2025-07-02 15:57:58 +08:00
|
|
|
|
<text>分,红队</text>
|
2025-07-08 13:23:29 +08:00
|
|
|
|
<text>5</text>
|
2025-07-02 15:57:58 +08:00
|
|
|
|
<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>
|