From d5bc1a6a899af47d4360fcf02f71e7bfd38631a2 Mon Sep 17 00:00:00 2001 From: kron Date: Wed, 16 Jul 2025 09:33:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=B6=E5=AD=90=E7=BB=84=E4=BB=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BowData.vue | 2 +- src/components/BowTarget.vue | 109 +++++++++------------------------ src/components/MeleeResult.vue | 1 - src/components/TeamResult.vue | 6 +- src/pages/battle-room.vue | 7 +-- src/pages/first-try.vue | 1 - src/pages/melee-bow-data.vue | 2 +- src/pages/melee-match.vue | 1 - src/pages/mine-bow-data.vue | 2 +- src/pages/practise-one.vue | 1 - src/pages/practise-two.vue | 1 - src/pages/team-bow-data.vue | 6 +- src/pages/team-match.vue | 7 +-- 13 files changed, 38 insertions(+), 108 deletions(-) diff --git a/src/components/BowData.vue b/src/components/BowData.vue index 2124a84..f5a78bb 100644 --- a/src/components/BowData.vue +++ b/src/components/BowData.vue @@ -40,7 +40,7 @@ const props = defineProps({ - + {{ arrows.length }} diff --git a/src/components/BowTarget.vue b/src/components/BowTarget.vue index 3f6abd5..db2cd48 100644 --- a/src/components/BowTarget.vue +++ b/src/components/BowTarget.vue @@ -6,14 +6,14 @@ import { simulShootAPI } from "@/apis"; import useStore from "@/store"; import { storeToRefs } from "pinia"; const store = useStore(); -const { device } = storeToRefs(store); +const { user, device } = storeToRefs(store); const props = defineProps({ - totalRound: { + currentRound: { type: Number, default: 0, }, - currentRound: { + totalRound: { type: Number, default: 0, }, @@ -33,31 +33,22 @@ const props = defineProps({ type: Array, default: () => [], }, - showLatestArrow: { - type: Boolean, - default: true, - }, - start: { - type: Boolean, - default: false, - }, - showE: { - type: Boolean, - default: true, - }, mode: { type: String, default: "solo", // solo 单排,team 双排 }, + // start: { + // type: Boolean, + // default: false, + // }, stop: { type: Boolean, default: false, }, }); -const showRoundTips = ref(false); +const latestOne = ref(null); // const startCount = ref(false); -const prevLength = ref(0); const timer = ref(null); // watch( @@ -72,15 +63,12 @@ const timer = ref(null); watch( () => props.scores, - (newVal) => { - if (newVal.length - prevLength.value === 1) { - if (timer.value) clearTimeout(timer.value); - showRoundTips.value = true; - timer.value = setTimeout(() => { - showRoundTips.value = false; - }, 1000); - } - prevLength.value = newVal.length; + (newVal, oldVal) => { + latestOne.value = newVal[newVal.length - 1]; + if (timer.value) clearTimeout(timer.value); + timer.value = setTimeout(() => { + latestOne.value = null; + }, 1000); }, { deep: true, @@ -90,14 +78,11 @@ watch( watch( () => props.blueScores, (newVal) => { - if (newVal.length - prevLength.value === 1) { - if (timer.value) clearTimeout(timer.value); - showRoundTips.value = true; - timer.value = setTimeout(() => { - showRoundTips.value = false; - }, 1000); - } - prevLength.value = newVal.length; + latestOne.value = newVal[newVal.length - 1]; + if (timer.value) clearTimeout(timer.value); + timer.value = setTimeout(() => { + latestOne.value = null; + }, 1000); }, { deep: true, @@ -133,64 +118,30 @@ const simulShoot2 = async () => { 中场休息 经验 +1 {{ scores[scores.length - 1].ring || "未上靶" - }} - {{ blueScores[blueScores.length - 1].ring || "未上靶" - }}{{ latestOne.ring || "未上靶" + }} 0" :class="`hit ${ - index === scores.length - 1 && !blueScores.length && showLatestArrow - ? 'pump-in' - : '' + index === blueScores.length - 1 && showLatestArrow ? 'pump-in' : '' }`" :style="{ left: calcRealX(bow.x), diff --git a/src/components/MeleeResult.vue b/src/components/MeleeResult.vue index 83b133d..83fcf5f 100644 --- a/src/components/MeleeResult.vue +++ b/src/components/MeleeResult.vue @@ -76,7 +76,6 @@ const onSelect = (userId) => { diff --git a/src/components/TeamResult.vue b/src/components/TeamResult.vue index 9df7f0e..987685b 100644 --- a/src/components/TeamResult.vue +++ b/src/components/TeamResult.vue @@ -106,11 +106,7 @@ watch( - + item.id === msg.userId); - if (isRed) scores.value = [msg.target]; - else blueScores.value = [msg.target]; + if (isRed) scores.value.push(msg.target); + else blueScores.value.push(msg.target); if (roundResults.value[currentRound.value - 1]) { if (isRed && roundResults.value[currentRound.value - 1].redArrows) { roundResults.value[currentRound.value - 1].redArrows.push( @@ -551,7 +549,6 @@ onUnmounted(() => { /> { { - + {{ scores.length }} { { --> - + {{ arrows.length }} diff --git a/src/pages/practise-one.vue b/src/pages/practise-one.vue index ddab05e..a018fee 100644 --- a/src/pages/practise-one.vue +++ b/src/pages/practise-one.vue @@ -123,7 +123,6 @@ onUnmounted(() => { { { - + item.id === msg.userId); - if (isRed) scores.value = [msg.target]; - else blueScores.value = [msg.target]; + if (isRed) scores.value.push(msg.target); + else blueScores.value.push(msg.target); if (roundResults.value[currentRound.value - 1]) { if (isRed && roundResults.value[currentRound.value - 1].redArrows) { roundResults.value[currentRound.value - 1].redArrows.push(msg.target); @@ -266,7 +264,6 @@ onUnmounted(() => {