From 88f1ef5d958c5374517f4adf8260276c39772c90 Mon Sep 17 00:00:00 2001 From: kron Date: Tue, 10 Feb 2026 14:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BowData.vue | 8 ++++---- src/components/HeaderProgress.vue | 15 +++++++++------ src/components/ScoreResult.vue | 8 ++++---- src/components/ShootProgress.vue | 6 ++++++ src/constants.js | 1 + src/pages/first-try.vue | 4 ++-- src/pages/mine-bow-data.vue | 9 ++++----- src/pages/practise-one.vue | 2 +- 8 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/components/BowData.vue b/src/components/BowData.vue index a791499..7854645 100644 --- a/src/components/BowData.vue +++ b/src/components/BowData.vue @@ -49,16 +49,16 @@ const props = defineProps({ {{ arrows.length }} 支箭,共 - {{ arrows.reduce((a, b) => a + b.ring, 0) }} + {{ arrows.reduce((a, b) => a + (b.ring || 0), 0) }} diff --git a/src/components/HeaderProgress.vue b/src/components/HeaderProgress.vue index 415678d..0a5730b 100644 --- a/src/components/HeaderProgress.vue +++ b/src/components/HeaderProgress.vue @@ -55,11 +55,9 @@ async function onReceiveMessage(message) { totalShot.value = mode === 1 ? 3 : 2; currentRoundEnded.value = true; audioManager.play("比赛开始"); - } - if (type === MESSAGETYPESV2.BattleEnd) { + } else if (type === MESSAGETYPESV2.BattleEnd) { audioManager.play("比赛结束"); - } - if (type === MESSAGETYPESV2.ShootResult) { + } else if (type === MESSAGETYPESV2.ShootResult) { if (melee.value && current.playerId !== user.value.id) return; if (current.playerId === user.value.id) currentShot.value++; if (message.shootData) { @@ -73,11 +71,16 @@ async function onReceiveMessage(message) { key.push(`向${getDirectionText(shootData.angle)}调整`); audioManager.play(key, false); } - } - if (type === MESSAGETYPESV2.NewRound) { + } else if (type === MESSAGETYPESV2.NewRound) { currentShot.value = 0; currentRound.value = current.round; currentRoundEnded.value = true; + } else if (type === MESSAGETYPESV2.InvalidShot) { + uni.showToast({ + title: "距离不足,无效", + icon: "none", + }); + audioManager.pLay("射击无效"); } } diff --git a/src/components/ScoreResult.vue b/src/components/ScoreResult.vue index f96584d..8447ac1 100644 --- a/src/components/ScoreResult.vue +++ b/src/components/ScoreResult.vue @@ -62,7 +62,7 @@ const getRing = (arrow) => { }; const arrows = computed(() => { - const data = new Array(props.total).fill({}); + const data = new Array(props.total).fill({ ring: 0 }); (props.result.details || []).forEach((arrow, index) => { data[index] = arrow; }); @@ -78,8 +78,8 @@ const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length); 完成{{ validArrows.length }}箭,获得{{ validArrows.length }}完成{{ validArrows }}箭,获得{{ validArrows }}点经验 @@ -165,7 +165,7 @@ const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length); diff --git a/src/components/ShootProgress.vue b/src/components/ShootProgress.vue index d837cb4..24ca5c4 100644 --- a/src/components/ShootProgress.vue +++ b/src/components/ShootProgress.vue @@ -143,6 +143,12 @@ async function onReceiveMessage(msg) { } else if (msg.type === MESSAGETYPESV2.HalfRest) { halfTime.value = true; audioManager.play("中场休息"); + } else if (type === MESSAGETYPESV2.InvalidShot) { + uni.showToast({ + title: "距离不足,无效", + icon: "none", + }); + audioManager.pLay("射击无效"); } } diff --git a/src/constants.js b/src/constants.js index 9fa55e4..f37d889 100644 --- a/src/constants.js +++ b/src/constants.js @@ -40,6 +40,7 @@ export const MESSAGETYPESV2 = { HalfRest: 7, TestDistance: 8, MatchSuccess: 9, + InvalidShot: 10, }; export const topThreeColors = ["#FFD947", "#D2D2D2", "#FFA515"]; diff --git a/src/pages/first-try.vue b/src/pages/first-try.vue index e6d4d7b..e33dc79 100644 --- a/src/pages/first-try.vue +++ b/src/pages/first-try.vue @@ -129,7 +129,7 @@ const nextStep = async () => { btnDisabled.value = true; step.value = 2; title.value = "-感知距离"; - const result = await createPractiseAPI(total, 360); + const result = await createPractiseAPI(total, 120); if (result) practiseId.value = result.id; } else if (step.value === 2) { showGuide.value = false; @@ -166,7 +166,7 @@ const onClose = async () => { start.value = false; scores.value = []; step.value = 3; - const result = await createPractiseAPI(total, 360); + const result = await createPractiseAPI(total, 120); if (result) practiseId.value = result.id; } }; diff --git a/src/pages/mine-bow-data.vue b/src/pages/mine-bow-data.vue index bcb7a45..1b5311e 100644 --- a/src/pages/mine-bow-data.vue +++ b/src/pages/mine-bow-data.vue @@ -14,11 +14,10 @@ const arrows = ref([]); const total = ref(0); onLoad(async (options) => { - if (options.id) { - const result = await getPractiseAPI(options.id); - arrows.value = result.details; - total.value = result.details.length; - } + if (!options.id) return; + const result = await getPractiseAPI(options.id || 176); + arrows.value = result.details; + total.value = result.details.length; }); diff --git a/src/pages/practise-one.vue b/src/pages/practise-one.vue index bff1c3a..8bb3d5b 100644 --- a/src/pages/practise-one.vue +++ b/src/pages/practise-one.vue @@ -70,7 +70,7 @@ async function onComplete() { start.value = false; scores.value = []; currentRound.value = 0; - const result = await createPractiseAPI(total, 360); + const result = await createPractiseAPI(total, 120); if (result) practiseId.value = result.id; } }