细节调整

This commit is contained in:
kron
2025-11-06 17:10:24 +08:00
parent e942c63885
commit 2ab601fef5
2 changed files with 22 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, watch, onMounted } from "vue"; import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import StartCountdown from "@/components/StartCountdown.vue"; import StartCountdown from "@/components/StartCountdown.vue";
import { simulShootAPI } from "@/apis"; import { simulShootAPI } from "@/apis";
import useStore from "@/store"; import useStore from "@/store";
@@ -103,6 +103,13 @@ onMounted(() => {
const envVersion = accountInfo.miniProgram.envVersion; const envVersion = accountInfo.miniProgram.envVersion;
if (envVersion !== "release") showsimul.value = true; if (envVersion !== "release") showsimul.value = true;
}); });
onBeforeUnmount(() => {
if (timer.value) {
clearTimeout(timer.value);
timer.value = null;
}
});
</script> </script>
<template> <template>

View File

@@ -194,20 +194,20 @@ async function onReceiveMessage(messages = []) {
} }
if (msg.constructor === MESSAGETYPES.ShootResult) { if (msg.constructor === MESSAGETYPES.ShootResult) {
if (currentShooterId.value !== msg.userId) return; if (currentShooterId.value !== msg.userId) return;
const isRed = redTeam.value.find((item) => item.id === msg.userId); // const isRed = redTeam.value.find((item) => item.id === msg.userId);
if (isRed) scores.value.push({ ...msg.target }); // if (isRed) scores.value.push({ ...msg.target });
else blueScores.value.push({ ...msg.target }); // else blueScores.value.push({ ...msg.target });
// 下标从0开始的要减1 // // 下标从0开始的要减1
if (!roundResults.value[currentRound.value - 1]) { // if (!roundResults.value[currentRound.value - 1]) {
roundResults.value.push({ // roundResults.value.push({
redArrows: [], // redArrows: [],
blueArrows: [], // blueArrows: [],
gold: goldenRound.value > 0, // gold: goldenRound.value > 0,
}); // });
} // }
roundResults.value[currentRound.value - 1][ // roundResults.value[currentRound.value - 1][
isRed ? "redArrows" : "blueArrows" // isRed ? "redArrows" : "blueArrows"
].push({ ...msg.target }); // ].push({ ...msg.target });
if (msg.battleInfo) recoverData(msg.battleInfo); if (msg.battleInfo) recoverData(msg.battleInfo);
} }
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) { if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {