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(() => {