From 7f73f3ebb30e109c913b9e83b31976c37f8dbb89 Mon Sep 17 00:00:00 2001 From: kron Date: Wed, 4 Feb 2026 17:45:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E6=88=BF=E9=97=B41v1?= =?UTF-8?q?=E5=AF=B9=E6=88=98=E6=95=B0=E6=8D=AE=E8=B0=83=E8=AF=95=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis.js | 15 +- src/components/BackToGame.vue | 21 +- src/components/BattleFooter.vue | 15 +- src/components/BowTarget.vue | 38 ++-- src/components/CreateRoom.vue | 25 ++- src/components/HeaderProgress.vue | 181 ++++++++------- src/components/RoundEndTip.vue | 4 +- src/components/ShootProgress.vue | 4 +- src/components/ShootProgress2.vue | 35 ++- src/components/TestDistance.vue | 7 +- src/constants.js | 12 + src/pages/battle-result.vue | 166 +++++--------- src/pages/battle-room.vue | 83 ++++--- src/pages/friend-battle.vue | 40 ++-- src/pages/match-detail.vue | 208 +++-------------- src/pages/melee-match.vue | 6 +- src/pages/team-battle.vue | 357 ++++++++++-------------------- src/pages/team-bow-data.vue | 150 +++---------- 18 files changed, 524 insertions(+), 843 deletions(-) diff --git a/src/apis.js b/src/apis.js index 144adc2..b017577 100644 --- a/src/apis.js +++ b/src/apis.js @@ -6,7 +6,7 @@ try { switch (envVersion) { case "develop": // 开发版 - // BASE_URL = "http://192.168.1.242:8000/api/shoot"; + // BASE_URL = "http://192.168.1.30:8000/api/shoot"; BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot"; break; case "trial": // 体验版 @@ -418,9 +418,9 @@ export const getUserGameState = () => { }; export const getCurrentGameAPI = async () => { - uni.$emit("update-header-loading", true); - const result = await request("GET", "/user/join/battle"); - return result.currentGame || {}; + // uni.$emit("update-header-loading", true); + // const result = await request("GET", "/user/join/battle"); + // return result.currentGame || {}; }; export const getPointBookConfigAPI = async () => { @@ -552,3 +552,10 @@ export const getReadyAPI = (roomId) => { roomId, }); }; + +export const getBattleAPI = async (battleId) => { + const result = await request("POST", "/user/match/info", { + id: battleId, + }); + return result; +}; diff --git a/src/components/BackToGame.vue b/src/components/BackToGame.vue index 31167fb..703612e 100644 --- a/src/components/BackToGame.vue +++ b/src/components/BackToGame.vue @@ -2,7 +2,7 @@ import { ref, watch, onMounted, onBeforeUnmount } from "vue"; import { onShow } from "@dcloudio/uni-app"; -import { getCurrentGameAPI, getUserGameState } from "@/apis"; +import { getBattleAPI, getUserGameState } from "@/apis"; import { debounce } from "@/util"; import useStore from "@/store"; @@ -44,10 +44,21 @@ const onClick = debounce(async () => { if (loading.value) return; try { loading.value = true; - if (game.value.inBattle) { - await uni.$checkAudio(); - const result = await getCurrentGameAPI(); - } else if (game.value.roomID) { + const result = await getBattleAPI(); + if (result && result.matchId) { + // await uni.$checkAudio(); + if (result.way === 1) { + uni.navigateTo({ + url: `/pages/team-battle?battleId=${result.matchId}`, + }); + } else if (result.way === 2) { + uni.navigateTo({ + url: `/pages/melee-match?battleId=${result.matchId}`, + }); + } + return; + } + if (game.value.roomID) { uni.navigateTo({ url: "/pages/battle-room?roomNumber=" + game.value.roomID, }); diff --git a/src/components/BattleFooter.vue b/src/components/BattleFooter.vue index 3186b2f..cfed39f 100644 --- a/src/components/BattleFooter.vue +++ b/src/components/BattleFooter.vue @@ -22,9 +22,10 @@ const props = defineProps({ }, }); -const normalRounds = computed( - () => props.roundResults.length - props.goldenRound -); +const normalRounds = computed(() => { + const count = props.roundResults.findIndex((item) => !!item.ifGold); + return count > 0 ? count : props.roundResults.length; +});