diff --git a/src/apis.js b/src/apis.js index 7b3d6cd..ad213ee 100644 --- a/src/apis.js +++ b/src/apis.js @@ -268,10 +268,8 @@ export const getGameAPI = async (battleId) => { data.redPlayers = {}; data.bluePlayers = {}; data.mvps = []; - data.goldenRound = - goldenRoundRecords && goldenRoundRecords.length - ? goldenRoundRecords[0] - : null; + data.goldenRounds = + goldenRoundRecords && goldenRoundRecords.length ? goldenRoundRecords : []; playerStats.forEach((item) => { const { playerBattleStats = {}, roundRecords = [] } = item; if (playerBattleStats.team === 0) { @@ -290,6 +288,20 @@ export const getGameAPI = async (battleId) => { }; }); }); + (goldenRoundRecords || []).forEach((item, index) => { + item.arrowHistory.forEach((arrow) => { + if (!data.roundsData[playerStats.length + index + 1]) { + data.roundsData[playerStats.length + index + 1] = {}; + } + if (!data.roundsData[playerStats.length + index + 1][arrow.playerId]) { + data.roundsData[playerStats.length + index + 1][arrow.playerId] = []; + } + data.roundsData[playerStats.length + index + 1][arrow.playerId].push( + arrow + ); + }); + }); + data.mvps.sort((a, b) => b.totalRings - a.totalRings); } if (battleStats && battleStats.mode === 2) { diff --git a/src/components/BattleFooter.vue b/src/components/BattleFooter.vue index 2185c3f..2f1eaf5 100644 --- a/src/components/BattleFooter.vue +++ b/src/components/BattleFooter.vue @@ -19,6 +19,10 @@ defineProps({ type: Number, default: 0, }, + goldenRound: { + type: Number, + default: 0, + }, }); @@ -43,7 +47,21 @@ defineProps({ - + + + + + + {{ result.blueArrows.length @@ -70,7 +88,21 @@ defineProps({ - + + + + + + {{ result.redArrows.length diff --git a/src/components/BattleHeader.vue b/src/components/BattleHeader.vue index 71e17f7..fc5b2ba 100644 --- a/src/components/BattleHeader.vue +++ b/src/components/BattleHeader.vue @@ -137,9 +137,10 @@ defineProps({ } .players > view > image:last-child { position: absolute; - width: 40px; - top: 0; - left: 0; + width: 50px; + top: -10%; + left: -5%; + transform: rotate(-12deg); } .players > view > view { display: flex; diff --git a/src/components/HeaderProgress.vue b/src/components/HeaderProgress.vue index 609cae5..e4c8caa 100644 --- a/src/components/HeaderProgress.vue +++ b/src/components/HeaderProgress.vue @@ -9,7 +9,6 @@ const { user } = storeToRefs(store); const tips = ref(""); const melee = ref(false); -const battleId = ref(""); const timer = ref(null); const sound = ref(true); const currentSound = ref(""); @@ -51,16 +50,15 @@ const updateSound = () => { async function onReceiveMessage(messages = []) { if (!sound.value || ended.value) return; messages.forEach((msg) => { - if (battleId.value && msg.constructor === MESSAGETYPES.ShootResult) { + if (msg.constructor === MESSAGETYPES.ShootResult) { if (melee.value && msg.userId !== user.value.id) return; if (!halfTime.value && msg.target) { currentSound.value = msg.target.ring ? `${msg.target.ring}环` : "未上靶"; + console.log(currentSound.value); audioManager.play(currentSound.value); } - } else if (msg.constructor === MESSAGETYPES.WaitForAllReady) { - battleId.value = msg.id; } else if (msg.constructor === MESSAGETYPES.AllReady) { currentRoundEnded.value = true; audioManager.play("比赛开始"); @@ -84,6 +82,10 @@ async function onReceiveMessage(messages = []) { ended.value = true; } else if (msg.constructor === MESSAGETYPES.MatchOver) { ended.value = true; + } else if (msg.constructor === MESSAGETYPES.BackToGame) { + if (msg.battleInfo) { + melee.value = msg.battleInfo.config.battleMode === 2; + } } }); } diff --git a/src/components/RoundEndTip.vue b/src/components/RoundEndTip.vue index 3c7d91b..b4ebb57 100644 --- a/src/components/RoundEndTip.vue +++ b/src/components/RoundEndTip.vue @@ -101,9 +101,9 @@ onUnmounted(() => { 蓝队 - 5 + {{ bluePoint }} 分,红队 - 5 + {{ redPoint }} 同分僵局!最后一箭定江山 diff --git a/src/constants.js b/src/constants.js index fd10836..16fc062 100644 --- a/src/constants.js +++ b/src/constants.js @@ -177,23 +177,39 @@ export const getBattleResultTips = ( }; export const RoundImages = { - "round1":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggifbnw9snvs.png", - "round2":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgf0swue5xzpd.png", - "round3":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slglkylhmq8beb.png", - "round4":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggc88nasmxf5.png", - "round5":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeloitb8mixf.png", - "round6":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgsjbyyuu1des.png", - "round7":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgdysd1wqulj5.png", - "round8":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgm82ny3qjd8m.png", -} + round1: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggifbnw9snvs.png", + round2: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgf0swue5xzpd.png", + round3: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slglkylhmq8beb.png", + round4: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggc88nasmxf5.png", + round5: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeloitb8mixf.png", + gold1: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgsjbyyuu1des.png", + gold2: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgdysd1wqulj5.png", + gold3: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgm82ny3qjd8m.png", +}; export const RoundGoldImages = { - "round1":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slg7kfzzwwiwcb.png", - "round2":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgs5htghfh3a9.png", - "round3":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgc9ge3paqkba.png", - "round4":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgehduk96yurp.png", - "round5":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgefz3hdmwbnz.png", - "round6":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeyb4cqwezgc.png", - "round7":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggu3tlh97v5p.png", - "round8":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgszmdtmaotch.png", -} \ No newline at end of file + round1: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slg7kfzzwwiwcb.png", + round2: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgs5htghfh3a9.png", + round3: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgc9ge3paqkba.png", + round4: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgehduk96yurp.png", + round5: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgefz3hdmwbnz.png", + gold1: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeyb4cqwezgc.png", + gold2: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggu3tlh97v5p.png", + gold3: + "https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgszmdtmaotch.png", +}; diff --git a/src/pages/battle-result.vue b/src/pages/battle-result.vue index de05b16..c066fa9 100644 --- a/src/pages/battle-result.vue +++ b/src/pages/battle-result.vue @@ -120,7 +120,11 @@ const checkBowData = () => { :src="`../static/${data.winner === 1 ? 'blue' : 'red'}-team-win.png`" mode="widthFix" /> - + { - + { .header-mvp > view { display: flex; justify-content: center; - transform: translateY(55px); } .header-mvp > view > view:first-child { display: flex; flex-direction: column; align-items: center; - margin-right: 5vw; } .header-mvp > view > view:first-child > image { width: 24vw; @@ -509,24 +511,24 @@ const checkBowData = () => { .header-mvp > view > view:first-child > text { color: #fff; font-size: 14px; - transform: translateY(-4px) rotate(-5deg); + transform: skewX(-10deg); } .header-mvp > view > view:last-child { display: flex; align-items: center; color: #fff; - font-size: 8px; + font-size: 9px; text-align: center; - transform: translateY(-16px) rotate(-5deg); - min-width: 40%; + transform: translateY(-4px); } .header-mvp > view > view:last-child > view { - margin-right: 4vw; + margin-left: 4vw; display: flex; flex-direction: column; } .header-mvp > view > view:last-child > view > text { margin-top: 4px; width: 40px; + transform: skewX(-10deg) translateX(-3px); } diff --git a/src/pages/match-detail.vue b/src/pages/match-detail.vue index c39566a..436717b 100644 --- a/src/pages/match-detail.vue +++ b/src/pages/match-detail.vue @@ -12,6 +12,7 @@ import { getGameAPI } from "@/apis"; const blueTeam = ref([]); const redTeam = ref([]); const roundsData = ref([]); +const goldenRoundsData = ref([]); const battleId = ref(""); const data = ref({ players: [], @@ -20,7 +21,7 @@ const data = ref({ onLoad(async (options) => { if (options.id) { - battleId.value = options.id || "BATTLE-1755239389665389000-812"; + battleId.value = options.id || "BATTLE-1755484626207409508-955"; const result = await getGameAPI(battleId.value); data.value = result; if (result.mode === 1) { @@ -34,10 +35,12 @@ onLoad(async (options) => { let blueArrows = []; let redArrows = []; blueTeam.value.forEach((p) => { + if (!item[p.playerId]) return; blueTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0); blueArrows = [...blueArrows, ...item[p.playerId]]; }); redTeam.value.forEach((p) => { + if (!item[p.playerId]) return; redTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0); redArrows = [...redArrows, ...item[p.playerId]]; }); @@ -50,14 +53,12 @@ onLoad(async (options) => { } roundsData.value.push({ blue: { - names: blueTeam.value.map((p) => p.name), avatars: blueTeam.value.map((p) => p.avatar), arrows: blueArrows, totalRing: blueTotalRings, totalScore: bluePoint, }, red: { - names: redTeam.value.map((p) => p.name), avatars: redTeam.value.map((p) => p.avatar), arrows: redArrows, totalRing: redTotalRings, @@ -65,6 +66,19 @@ onLoad(async (options) => { }, }); }); + result.goldenRounds.forEach((round) => { + goldenRoundsData.value.push({ + blue: { + avatars: blueTeam.value.map((p) => p.avatar), + arrows: round.arrowHistory.filter((a) => a.team === 1), + }, + red: { + avatars: redTeam.value.map((p) => p.avatar), + arrows: round.arrowHistory.filter((a) => a.team === 0), + }, + winner: round.winner, + }); + }); } } }); @@ -113,7 +127,7 @@ const checkBowData = () => { :totalRing="player.totalRings" :rank="index + 1" /> - + 决金箭轮(环数) @@ -121,61 +135,6 @@ const checkBowData = () => { - - - - - {{ arrow.ring }}环 - - - - - - - - - {{ arrow.ring }}环 - - - - - - - - 第{{ index + 1 }}轮 - - 查看靶纸 - - - @@ -190,18 +149,17 @@ const checkBowData = () => { mode="widthFix" /> - + {{ arrow.ring }}环 - - - {{ round.blue.totalRing }}环 - - 得分 {{ round.blue.totalScore }} - + - + { mode="widthFix" /> - + {{ arrow.ring }}环 - - - {{ round.red.totalRing }}环 - - 得分 {{ round.red.totalScore }} - + + + + + + 第{{ index + 1 }}轮 + + 查看靶纸 + + + + + + + + + + {{ arrow.ring }}环 + + + + + {{ round.blue.totalRing }}环 + + 得分 {{ round.blue.totalScore }} + + + + + + + + + {{ arrow.ring }}环 + + + + + {{ round.red.totalRing }}环 + + 得分 {{ round.red.totalScore }} + + + @@ -299,10 +325,10 @@ const checkBowData = () => { .score-row > image:last-child { width: 40px; } -.score-row > view:last-child { +.score-row > view:nth-child(2) { padding-right: 5px; } -.score-row > view:last-child > text:last-child { +.score-row > view:nth-child(2) > text:last-child { margin-left: 20px; } diff --git a/src/pages/rank-list.vue b/src/pages/rank-list.vue index b3fca80..ca4c8c9 100644 --- a/src/pages/rank-list.vue +++ b/src/pages/rank-list.vue @@ -16,25 +16,28 @@ const addBg = ref(""); onMounted(async () => { const menuBtnInfo = uni.getMenuButtonBoundingClientRect(); capsuleHeight.value = menuBtnInfo.top - 9; - currentList.value = rankData.value.rank; - if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos; + handleSelect(0); }); const handleSelect = (index) => { selectedIndex.value = index; + myData.value = {}; + currentList.value = []; if (index === 0) { currentList.value = rankData.value.rank; - if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos; } else if (index === 1) { currentList.value = rankData.value.mvpRank; - if (rankData.value.myMvpRankPos) myData.value = rankData.value.myMvpRankPos; } else if (index === 2) { currentList.value = rankData.value.ringRank; - if (rankData.value.myRingRankPos) - myData.value = rankData.value.myRingRankPos; - } else { - myData.value = {}; - currentList.value = []; + } + if (user.value.id) { + currentList.value.some((item) => { + if (item.userId === user.value.id) { + myData.value = item; + return true; + } + return false; + }); } }; @@ -172,18 +175,24 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"]; {{ user.nickName }} {{ user.lvlName }},{{ myData.TotalGames }}场 + + {{ myData.totalScore }} + + {{ myData.TotalGames }} {{ rankData.myRankPos.TenRings }}{{ myData.TenRings }} - - {{ rankData.myRingRankPos.totalScore }} diff --git a/src/pages/team-battle.vue b/src/pages/team-battle.vue index 75bd624..f3e298b 100644 --- a/src/pages/team-battle.vue +++ b/src/pages/team-battle.vue @@ -25,6 +25,7 @@ const start = ref(false); const tips = ref(""); const battleId = ref(""); const currentRound = ref(1); +const goldenRound = ref(0); const currentRedPoint = ref(0); const currentBluePoint = ref(0); const totalRounds = ref(0); @@ -105,6 +106,7 @@ function recoverData(battleInfo) { const { ShotCount, RedRecords, BlueRecords } = battleInfo.goldenRound; const roundCount = Math.max(RedRecords.length, BlueRecords.length); currentRound.value += roundCount; + goldenRound.value += roundCount; isFinalShoot.value = true; for (let i = 0; i < roundCount; i++) { const roundData = { @@ -112,6 +114,7 @@ function recoverData(battleInfo) { RedRecords && RedRecords[i] ? RedRecords[i].Arrows || [] : [], blueArrows: BlueRecords && BlueRecords[i] ? BlueRecords[i].Arrows || [] : [], + gold: true, }; if (roundResults.value[5 + i]) { roundResults.value[5 + i] = roundData; @@ -185,6 +188,7 @@ async function onReceiveMessage(messages = []) { roundResults.value.push({ redArrows: [], blueArrows: [], + gold: goldenRound.value > 0, }); } roundResults.value[currentRound.value - 1][ @@ -211,11 +215,13 @@ async function onReceiveMessage(messages = []) { } if (msg.constructor === MESSAGETYPES.FinalShoot) { currentShooterId.value = 0; - currentRound.value += 1; + goldenRound.value += 1; roundResults.value.push({ redArrows: [], blueArrows: [], }); + currentBluePoint.value = bluePoints.value; + currentRedPoint.value = redPoints.value; if (!isFinalShoot.value) { isFinalShoot.value = true; showRoundTip.value = true; @@ -307,7 +313,12 @@ onHide(() => { :isRed="false" :currentShooterId="currentShooterId" /> - + { :roundResults="roundResults" :redPoints="redPoints" :bluePoints="bluePoints" + :goldenRound="goldenRound" :power="power" /> diff --git a/src/pages/team-bow-data.vue b/src/pages/team-bow-data.vue index c164f5c..12ea76c 100644 --- a/src/pages/team-bow-data.vue +++ b/src/pages/team-bow-data.vue @@ -12,11 +12,13 @@ const blueScores = ref([]); const tabs = ref(["所有轮次"]); const players = ref([]); const allRoundsScore = ref({}); -const data = ref({}); +const data = ref({ + goldenRounds: [], +}); onLoad(async (options) => { if (options.battleId) { const result = await getGameAPI( - options.battleId || "BATTLE-1754988051086075885-926" + options.battleId || "BATTLE-1755484626207409508-955" ); data.value = result; Object.values(result.bluePlayers).forEach((p, index) => { @@ -28,9 +30,18 @@ onLoad(async (options) => { players.value.push(Object.values(result.redPlayers)[index]); } }); - if (result.goldenRound) tabs.value.push("决金箭"); - Object.keys(result.roundsData).forEach((key) => { - tabs.value.push(`第${roundsName[key]}轮`); + if (result.goldenRounds) { + result.goldenRounds.forEach(() => { + tabs.value.push("决金箭"); + }); + } + Object.keys(result.roundsData).forEach((key, index) => { + if ( + index < + Object.keys(result.roundsData).length - result.goldenRounds.length + ) { + tabs.value.push(`第${roundsName[key]}轮`); + } }); onClickTab(0); } @@ -39,11 +50,13 @@ const onClickTab = (index) => { selected.value = index; redScores.value = []; blueScores.value = []; - const { bluePlayers, redPlayers, roundsData, goldenRound } = data.value; + const { bluePlayers, redPlayers, roundsData, goldenRounds } = data.value; + let maxArrowLength = 0; if (index === 0) { Object.keys(bluePlayers).forEach((p) => { allRoundsScore.value[p] = []; Object.values(roundsData).forEach((round) => { + if (!round[p]) return; allRoundsScore.value[p].push( round[p].reduce((last, next) => last + next.ring, 0) ); @@ -55,6 +68,7 @@ const onClickTab = (index) => { Object.keys(redPlayers).forEach((p) => { allRoundsScore.value[p] = []; Object.values(roundsData).forEach((round) => { + if (!round[p]) return; allRoundsScore.value[p].push( round[p].reduce((last, next) => last + next.ring, 0) ); @@ -63,20 +77,29 @@ const onClickTab = (index) => { }); }); }); - } else if (index === 1 && goldenRound) { - if (goldenRound.winner === 1) { - blueScores.value = goldenRound.arrowHistory; - } else { - redScores.value = goldenRound.arrowHistory; - } - } else { + } else if (index <= goldenRounds.length) { + const dataIndex = + Object.keys(roundsData).length - goldenRounds.length + index; Object.keys(bluePlayers).forEach((p) => { - roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => { + if (!roundsData[dataIndex][p]) return; + roundsData[dataIndex][p].forEach((arrow) => { blueScores.value.push(arrow); }); }); Object.keys(redPlayers).forEach((p) => { - roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => { + if (!roundsData[dataIndex][p]) return; + roundsData[dataIndex][p].forEach((arrow) => { + redScores.value.push(arrow); + }); + }); + } else { + Object.keys(bluePlayers).forEach((p) => { + roundsData[index - goldenRounds.length][p].forEach((arrow) => { + blueScores.value.push(arrow); + }); + }); + Object.keys(redPlayers).forEach((p) => { + roundsData[index - goldenRounds.length][p].forEach((arrow) => { redScores.value.push(arrow); }); }); @@ -127,25 +150,23 @@ const onClickTab = (index) => { {{ score.ring }} { .score-row { display: flex; align-items: flex-start; - margin-left: 5px; + margin-bottom: 5px; + width: calc(50% - 5px); + padding-left: 5px; } .score-row > view:last-child { margin-left: 10px; @@ -204,6 +227,7 @@ const onClickTab = (index) => { grid-template-columns: repeat(3, auto); gap: 5px; margin-right: 5px; + min-width: 26%; } .score-item { background-image: url("../static/score-bg.png"); @@ -219,8 +243,8 @@ const onClickTab = (index) => { height: 10vw; } .score-container { - display: grid; - grid-template-columns: repeat(2, 1fr); - row-gap: 15px; + display: flex; + flex-wrap: wrap; + width: 100%; } diff --git a/src/static/title-mvp.png b/src/static/title-mvp.png index 73e9871..fdeccce 100644 Binary files a/src/static/title-mvp.png and b/src/static/title-mvp.png differ diff --git a/src/static/winner-badge.png b/src/static/winner-badge.png index 6af6b58..dbbf5ee 100644 Binary files a/src/static/winner-badge.png and b/src/static/winner-badge.png differ