比赛逻辑代码统一

This commit is contained in:
kron
2025-07-28 13:54:37 +08:00
parent 0d7a421546
commit e116c8d22f
8 changed files with 290 additions and 764 deletions

View File

@@ -23,10 +23,6 @@ const props = defineProps({
type: Number,
default: 120,
},
seq: {
type: Number,
default: 0,
},
currentRound: {
type: Number,
default: 0,
@@ -47,7 +43,7 @@ const timer = ref(null);
const sound = ref(true);
const currentSound = ref("");
const currentRound = ref(props.currentRound);
const currentRoundEnded = ref(!props.battleId);
const currentRoundEnded = ref(false);
const ended = ref(false);
const halfTime = ref(false);
@@ -79,26 +75,21 @@ watch(
watch(
() => props.tips,
(newVal) => {
let key = "";
if (newVal.includes("红队")) barColor.value = "#FF6060";
if (newVal.includes("蓝队")) barColor.value = "#5FADFF";
if (newVal.includes("红队") || newVal.includes("蓝队")) {
if (timer.value) clearInterval(timer.value);
remain.value = props.total;
timer.value = setInterval(() => {
if (remain.value > 0) remain.value--;
}, 1000);
}
},
{
immediate: true,
}
);
watch(
() => [props.seq],
() => {
if (timer.value) clearInterval(timer.value);
remain.value = props.total;
timer.value = setInterval(() => {
if (remain.value > 0) remain.value--;
}, 1000);
}
);
watch(
() => props.start,
(newVal) => {