diff --git a/src/pages/index.vue b/src/pages/index.vue index 655ac41..041e15f 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -58,10 +58,11 @@ const toRankListPage = () => { }; onShow(async () => { + const rankList = await getRankListAPI(); + updateRank(rankList); const token = uni.getStorageSync("token"); if (token) { const result = await getHomeData(); - updateRank(result); console.log("首页数据:", result); if (result.user) { updateUser(result.user); @@ -79,9 +80,6 @@ onShow(async () => { ); } } - } else { - const result = await getRankListAPI(); - updateRank(result); } }); @@ -187,7 +185,9 @@ const comingSoon = () => { 段位 - {{ user.scores ? getLvlName(user.scores) : "暂无" }} + {{ + user.scores ? getLvlName(user.scores) : "暂无" + }} 赛季平均环数 @@ -367,7 +367,7 @@ const comingSoon = () => { height: 82rpx; border-radius: 50%; margin-right: -10px; - border: 1px solid #312F35; + border: 1px solid #312f35; position: relative; box-sizing: border-box; } diff --git a/src/pages/match-detail.vue b/src/pages/match-detail.vue index 966f07a..a5a7ab7 100644 --- a/src/pages/match-detail.vue +++ b/src/pages/match-detail.vue @@ -20,23 +20,27 @@ const data = ref({ onLoad(async (options) => { if (options.id) { - battleId.value = options.id || "BATTLE-1751732742024840058-732"; + battleId.value = options.id || "BATTLE-1755239389665389000-812"; const result = await getGameAPI(battleId.value); data.value = result; if (result.mode === 1) { blueTeam.value = Object.values(result.bluePlayers || {}); redTeam.value = Object.values(result.redPlayers || {}); Object.values(result.roundsData).forEach((item) => { - let blueId = Object.keys(item)[0]; - let redId = Object.keys(item)[1]; - if (!result.bluePlayers[blueId]) { - blueId = Object.keys(item)[1]; - redId = Object.keys(item)[0]; - } let bluePoint = 1; let redPoint = 1; - const blueTotalRings = item[blueId].reduce((a, b) => a + b.ring, 0); - const redTotalRings = item[redId].reduce((a, b) => a + b.ring, 0); + let blueTotalRings = 0; + let redTotalRings = 0; + let blueArrows = []; + let redArrows = []; + blueTeam.value.forEach((p) => { + blueTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0); + blueArrows = [...blueArrows, ...item[p.playerId]]; + }); + redTeam.value.forEach((p) => { + redTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0); + redArrows = [...redArrows, ...item[p.playerId]]; + }); if (blueTotalRings > redTotalRings) { bluePoint = 2; redPoint = 0; @@ -46,16 +50,16 @@ onLoad(async (options) => { } roundsData.value.push({ blue: { - name: result.bluePlayers[blueId].name, - avatar: result.bluePlayers[blueId].avatar, - arrows: item[blueId], + names: blueTeam.value.map((p) => p.name), + avatars: blueTeam.value.map((p) => p.avatar), + arrows: blueArrows, totalRing: blueTotalRings, totalScore: bluePoint, }, red: { - name: result.redPlayers[redId].name, - avatar: result.redPlayers[redId].avatar, - arrows: item[redId], + names: redTeam.value.map((p) => p.name), + avatars: redTeam.value.map((p) => p.avatar), + arrows: redArrows, totalRing: redTotalRings, totalScore: redPoint, }, @@ -174,7 +178,18 @@ const checkBowData = () => { - + + + {{ arrow.ring }}环 @@ -188,7 +203,18 @@ const checkBowData = () => { - + + + {{ arrow.ring }}环 @@ -250,12 +276,22 @@ const checkBowData = () => { .score-row > view { display: flex; align-items: center; + font-size: 12px; +} +.score-row > view:first-child > view:first-child { + display: flex; + align-items: center; +} +.score-row > view:first-child > view:first-child > image { + width: 25px; + height: 25px; + border: 1px solid; + border-radius: 50%; } .score-row > view:first-child > text { - margin-left: 20px; color: #fff; display: block; - width: 30px; + width: 35px; } .score-row > image:last-child { width: 40px; diff --git a/src/pages/team-battle.vue b/src/pages/team-battle.vue index d1fbdcf..75bd624 100644 --- a/src/pages/team-battle.vue +++ b/src/pages/team-battle.vue @@ -167,14 +167,13 @@ async function onReceiveMessage(messages = []) { const redPlayer = redTeam.value.find( (item) => item.id === currentShooterId.value ); - tips.value = redPlayer ? "请红队射箭" : "请蓝队射箭"; - uni.$emit("update-tips", tips.value); - // if (redPlayer) tips.value = "红队" + redPlayer.id; - // const bluePlayer = blueTeam.value.find( - // (item) => item.id === currentShooterId.value - // ); - // if (bluePlayer) tips.value = "蓝队" + bluePlayer.id; - uni.$emit("update-tips", tips.value); + const nextTips = redPlayer ? "请红队射箭" : "请蓝队射箭"; + if (nextTips !== tips.value) { + tips.value = nextTips; + uni.$emit("update-tips", tips.value); + } else { + uni.$emit("update-ramain", 15); + } } } if (msg.constructor === MESSAGETYPES.ShootResult) { diff --git a/src/pages/team-bow-data.vue b/src/pages/team-bow-data.vue index 384f3ec..1ed84fe 100644 --- a/src/pages/team-bow-data.vue +++ b/src/pages/team-bow-data.vue @@ -14,7 +14,7 @@ const players = ref([]); const allRoundsScore = ref({}); const data = ref({}); onLoad(async (options) => { - if (!options.battleId) { + if (options.battleId) { const result = await getGameAPI( options.battleId || "BATTLE-1754988051086075885-926" ); @@ -198,13 +198,14 @@ const onClickTab = (index) => { .score-row { display: flex; align-items: flex-start; - margin-left: 15px; + margin-left: 5px; } .score-row > view:last-child { margin-left: 10px; display: grid; grid-template-columns: repeat(3, auto); gap: 5px; + margin-right: 5px; } .score-item { background-image: url("../static/score-bg.png");