6 Commits

Author SHA1 Message Date
kron
1ce2ea9eb7 BUG修复 2025-08-18 16:09:11 +08:00
kron
b31689b19f bug 修复 2025-08-17 10:33:41 +08:00
kron
8110a0f5c1 细节完善 2025-08-15 16:37:10 +08:00
kron
b2abcc71b1 添加mvp榜数据 2025-08-15 16:15:36 +08:00
kron
7242475735 细节调整 2025-08-15 15:25:41 +08:00
kron
13c4ce7690 图片资源优化 2025-08-15 14:07:59 +08:00
30 changed files with 398 additions and 199 deletions

View File

@@ -6,7 +6,8 @@ try {
switch (envVersion) {
case "develop": // 开发版
BASE_URL = "http://192.168.1.242:8000/api/shoot";
// BASE_URL = "http://192.168.1.242:8000/api/shoot";
BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot";
break;
case "trial": // 体验版
BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot";
@@ -256,7 +257,7 @@ export const getGameAPI = async (battleId) => {
goldenRoundRecords = [],
} = result;
const data = {
battleId,
id: battleId,
mode: battleStats.mode, // 1.几V几 2.大乱斗
gameMode: battleStats.gameMode, // 1.约战 2.排位
teamSize: battleStats.teamSize,
@@ -267,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) {
@@ -289,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) {

View File

@@ -19,6 +19,10 @@ defineProps({
type: Number,
default: 0,
},
goldenRound: {
type: Number,
default: 0,
},
});
</script>
@@ -43,7 +47,21 @@ defineProps({
<view class="players">
<view>
<view v-for="(result, index) in roundResults" :key="index">
<block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view>
<text>{{
result.blueArrows.length
@@ -70,7 +88,21 @@ defineProps({
</view>
<view>
<view v-for="(result, index) in roundResults" :key="index">
<block
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
>
<image
:src="
RoundImages[
`gold${index + 1 - (roundResults.length - goldenRound)}`
]
"
mode="widthFix"
/>
</block>
<block v-else>
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
</block>
<view>
<text>{{
result.redArrows.length

View File

@@ -45,7 +45,10 @@ defineProps({
<view
v-for="(player, index) in blueTeam"
:key="index"
:style="{ margin: blueTeam.length === 2 ? '0 12px' : '0 6px' }"
:style="{
margin: blueTeam.length === 2 ? '0 12px' : '0 6px',
width: `${100 / blueTeam.length - blueTeam.length * 3}%`,
}"
>
<Avatar :src="player.avatar" :rankLvl="player.rankLvl" />
<text class="player-name">{{ player.name }}</text>
@@ -60,7 +63,10 @@ defineProps({
<view
v-for="(player, index) in redTeam"
:key="index"
:style="{ margin: redTeam.length === 2 ? '0 12px' : '0 6px' }"
:style="{
margin: redTeam.length === 2 ? '0 12px' : '0 6px',
width: `${100 / redTeam.length - redTeam.length * 3}%`,
}"
>
<Avatar :src="player.avatar" :rankLvl="player.rankLvl" />
<text class="player-name">{{ player.name }}</text>
@@ -131,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;
@@ -164,7 +171,7 @@ defineProps({
}
.player-name {
margin-top: 5px;
width: 80%;
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

View File

@@ -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;
}
}
});
}

View File

@@ -101,9 +101,9 @@ onUnmounted(() => {
<block v-if="isFinal">
<view class="point-view2">
<text>蓝队</text>
<text>5</text>
<text>{{ bluePoint }}</text>
<text>红队</text>
<text>5</text>
<text>{{ redPoint }}</text>
<text></text>
</view>
<text>同分僵局最后一箭定江山</text>

View File

@@ -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",
}
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",
};

View File

@@ -120,7 +120,11 @@ const checkBowData = () => {
:src="`../static/${data.winner === 1 ? 'blue' : 'red'}-team-win.png`"
mode="widthFix"
/>
<view>
<view
:style="{
transform: `translateY(50px) rotate(-${5 + data.mvps.length}deg)`,
}"
>
<view v-if="data.mvps && data.mvps[0].totalRings">
<image src="../static/title-mvp.png" mode="widthFix" />
<text
@@ -132,7 +136,7 @@ const checkBowData = () => {
</view>
<view v-if="data.mvps && data.mvps.length">
<view v-for="(player, index) in data.mvps" :key="index">
<view class="team-avatar">
<view class="team-avatar" :style="{ transform: 'rotate(10deg)' }">
<Avatar
:src="player.avatar"
:size="40"
@@ -146,7 +150,7 @@ const checkBowData = () => {
>自己</text
>
</view>
<text>{{ player.name }}</text>
<text class="truncate">{{ player.name }}</text>
</view>
</view>
</view>
@@ -495,13 +499,11 @@ const checkBowData = () => {
.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,23 +511,24 @@ const checkBowData = () => {
.header-mvp > view > view:first-child > text {
color: #fff;
font-size: 14px;
transform: translateY(-4px) skewY(-6deg);
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) skewY(-6deg);
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);
}
</style>

View File

@@ -80,7 +80,7 @@ onShow(async () => {
<view class="my-data">
<view>
<Avatar :rankLvl="user.rankLvl" :src="user.avatar" :size="30" />
<text>{{ user.nickName }}</text>
<text class="truncate">{{ user.nickName }}</text>
</view>
<view>
<view>
@@ -278,6 +278,7 @@ onShow(async () => {
color: #fff;
font-size: 17px;
margin-left: 10px;
width: 120px;
}
.my-data > view:last-child {
margin-bottom: 15px;

View File

@@ -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 = () => {
<view>
<view>
<text>段位</text>
<text>{{ user.scores ? getLvlName(user.scores) : "暂无" }}</text>
<text>{{
user.scores ? getLvlName(user.scores) : "暂无"
}}</text>
</view>
<view>
<text>赛季平均环数</text>
@@ -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;
}

View File

@@ -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,23 +21,29 @@ const data = ref({
onLoad(async (options) => {
if (options.id) {
battleId.value = options.id || "BATTLE-1751732742024840058-732";
battleId.value = options.id || "BATTLE-1755484626207409508-955";
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) => {
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]];
});
if (blueTotalRings > redTotalRings) {
bluePoint = 2;
redPoint = 0;
@@ -46,21 +53,32 @@ onLoad(async (options) => {
}
roundsData.value.push({
blue: {
name: result.bluePlayers[blueId].name,
avatar: result.bluePlayers[blueId].avatar,
arrows: item[blueId],
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],
avatars: redTeam.value.map((p) => p.avatar),
arrows: redArrows,
totalRing: redTotalRings,
totalScore: redPoint,
},
});
});
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,
});
});
}
}
});
@@ -109,7 +127,7 @@ const checkBowData = () => {
:totalRing="player.totalRings"
:rank="index + 1"
/>
<block v-if="data.goldenRound">
<block v-for="(round, index) in goldenRoundsData" :key="index">
<view class="score-header">
<text>决金箭轮环数</text>
<view @click="checkBowData">
@@ -119,42 +137,48 @@ const checkBowData = () => {
</view>
<view class="score-row">
<view>
<Avatar
:src="blueTeam[0].avatar"
:size="25"
borderColor="#64BAFF"
/>
<text
v-if="data.goldenRound.blueTotal"
v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
(a) => a.playerId === blueTeam[0].playerId
)"
<view>
<image
v-for="(src, index) in round.blue.avatars"
:style="{
borderColor: '#64BAFF',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
>
mode="widthFix"
/>
</view>
<text v-for="(arrow, index) in round.blue.arrows" :key="index">
{{ arrow.ring }}
</text>
</view>
<image
v-if="data.goldenRound.winner === 1"
v-if="round.winner === 1"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view>
<view class="score-row" :style="{ marginBottom: '5px' }">
<view>
<Avatar :src="redTeam[0].avatar" :size="25" borderColor="#FF6767" />
<text
v-if="data.goldenRound.redTotal"
v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
(a) => a.playerId === redTeam[0].playerId
)"
<view>
<image
v-for="(src, index) in round.red.avatars"
:style="{
borderColor: '#FF6767',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
>
mode="widthFix"
/>
</view>
<text v-for="(arrow, index) in round.red.arrows" :key="index">
{{ arrow.ring }}
</text>
</view>
<image
v-if="data.goldenRound.winner === 0"
v-if="round.winner === 0"
src="../static/winner-badge.png"
mode="widthFix"
/>
@@ -164,6 +188,11 @@ const checkBowData = () => {
v-for="(round, index) in roundsData"
:key="index"
:style="{ marginBottom: '5px' }"
>
<block
v-if="
index < Object.keys(roundsData).length - goldenRoundsData.length
"
>
<view class="score-header">
<text>第{{ index + 1 }}轮</text>
@@ -174,7 +203,18 @@ const checkBowData = () => {
</view>
<view class="score-row">
<view>
<Avatar :src="round.blue.avatar" :size="25" borderColor="#64BAFF" />
<view>
<image
v-for="(src, index) in round.blue.avatars"
:style="{
borderColor: '#64BAFF',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
mode="widthFix"
/>
</view>
<text v-for="(arrow, index2) in round.blue.arrows" :key="index2">
{{ arrow.ring }}环
</text>
@@ -188,7 +228,18 @@ const checkBowData = () => {
</view>
<view class="score-row">
<view>
<Avatar :src="round.red.avatar" :size="25" borderColor="#FF6767" />
<view>
<image
v-for="(src, index) in round.red.avatars"
:style="{
borderColor: '#FF6767',
transform: `translateX(-${index * 15}px)`,
}"
:src="src"
:key="index"
mode="widthFix"
/>
</view>
<text v-for="(arrow, index2) in round.red.arrows" :key="index2">
{{ arrow.ring }}环
</text>
@@ -200,6 +251,7 @@ const checkBowData = () => {
<text>得分 {{ round.red.totalScore }}</text>
</view>
</view>
</block>
</view>
<view :style="{ height: '20px' }"></view>
</view>
@@ -250,20 +302,33 @@ 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;
width: 70px;
}
.score-row > view:first-child > view:first-child > image {
width: 25px;
height: 25px;
min-width: 25px;
min-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;
}
.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;
}
</style>

View File

@@ -45,7 +45,7 @@ onShow(async () => {
<view>
<view>
<Avatar :rankLvl="user.rankLvl" :src="user.avatar" :size="30" />
<text>{{ user.nickName }}</text>
<text class="truncate">{{ user.nickName }}</text>
</view>
<view>
<text>已练习打卡</text>
@@ -127,6 +127,7 @@ onShow(async () => {
color: #fff;
margin-left: 10px;
font-size: 16px;
width: 120px;
}
.practise-data > view:first-child > view:last-child > text:nth-child(2) {
color: #f7d247;

View File

@@ -16,22 +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;
if (index === 0) {
currentList.value = rankData.value.rank;
if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos;
} else if (index === 2) {
currentList.value = rankData.value.ringRank;
if (rankData.value.myRingRankPos)
myData.value = rankData.value.myRingRankPos;
} else {
myData.value = {};
currentList.value = [];
if (index === 0) {
currentList.value = rankData.value.rank;
} else if (index === 1) {
currentList.value = rankData.value.mvpRank;
} else if (index === 2) {
currentList.value = rankData.value.ringRank;
}
if (user.value.id) {
currentList.value.some((item) => {
if (item.userId === user.value.id) {
myData.value = item;
return true;
}
return false;
});
}
};
@@ -143,6 +149,11 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
>{{ item.totalScore }} </text
>
</text>
<text class="rank-item-integral" v-if="selectedIndex === 1">
<text :style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ item.mvpCount }} </text
>
</text>
<text class="rank-item-integral" v-if="selectedIndex === 2">
<text :style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ item.TenRings }} </text
@@ -164,18 +175,24 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
<text class="truncate">{{ user.nickName }}</text>
<text>{{ user.lvlName }}{{ myData.TotalGames }}</text>
</view>
<text class="rank-item-integral" v-if="selectedIndex === 0">
<text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ myData.totalScore }}</text
></text
>
<text class="rank-item-integral" v-if="selectedIndex === 1">
<text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ myData.TotalGames }}</text
></text
>
<text class="rank-item-integral" v-if="selectedIndex === 2">
<text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ rankData.myRankPos.TenRings }}</text
>{{ myData.TenRings }}</text
></text
>
<text class="rank-item-integral" v-else>
<text
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
>{{ rankData.myRingRankPos.totalScore }}</text
></text
>
</view>
</scroll-view>
</template>

View File

@@ -31,6 +31,8 @@ const handleSelect = (index) => {
selectedIndex.value = index;
if (index === 0 && rankData.value.rank) {
currentList.value = rankData.value.rank.slice(0, 10);
} else if (index === 1 && rankData.value.mvpRank) {
currentList.value = rankData.value.mvpRank.slice(0, 10);
} else if (index === 2 && rankData.value.ringRank) {
currentList.value = rankData.value.ringRank.slice(0, 10);
} else {
@@ -139,12 +141,12 @@ onShow(async () => {
</view>
<view
class="ranking-season"
v-if="seasonData.length"
v-show="seasonData.length"
@click.stop="() => (showSeasonList = true)"
>
<text>{{ seasonName }}</text>
<image
v-if="seasonData.length > 1"
v-show="seasonData.length > 1"
src="../static/triangle.png"
mode="widthFix"
/>
@@ -355,6 +357,9 @@ onShow(async () => {
<text v-if="selectedIndex === 0">
{{ item.totalScore }}<text>分</text>
</text>
<text v-if="selectedIndex === 1">
{{ item.mvpCount }}<text>次</text>
</text>
<text v-if="selectedIndex === 2">
{{ item.TenRings }}<text>次</text>
</text>
@@ -417,6 +422,7 @@ onShow(async () => {
}
.ranking-season > image {
width: 12px;
height: 12px;
}
.ranking-season > text {
color: #ffd947;
@@ -463,6 +469,7 @@ onShow(async () => {
}
.battle-types > image {
width: 100%;
height: 14vw;
}
.data-progress {
width: 100%;

View File

@@ -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;
@@ -167,14 +170,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;
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) {
@@ -186,6 +188,7 @@ async function onReceiveMessage(messages = []) {
roundResults.value.push({
redArrows: [],
blueArrows: [],
gold: goldenRound.value > 0,
});
}
roundResults.value[currentRound.value - 1][
@@ -212,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;
@@ -308,7 +313,12 @@ onHide(() => {
:isRed="false"
:currentShooterId="currentShooterId"
/>
<ShootProgress2 :tips="tips" :currentRound="'round' + currentRound" />
<ShootProgress2
:tips="tips"
:currentRound="
goldenRound > 0 ? 'gold' + goldenRound : 'round' + currentRound
"
/>
<TeamAvatars :team="redTeam" :currentShooterId="currentShooterId" />
</view>
<BowTarget
@@ -323,6 +333,7 @@ onHide(() => {
:roundResults="roundResults"
:redPoints="redPoints"
:bluePoints="bluePoints"
:goldenRound="goldenRound"
:power="power"
/>
<Timer v-if="!start" />

View File

@@ -12,27 +12,36 @@ 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) {
if (options.battleId) {
const result = await getGameAPI(
options.battleId || "BATTLE-1754988051086075885-926"
options.battleId || "BATTLE-1755484626207409508-955"
);
data.value = result;
if (result.winner === 0) {
players.value = [
...Object.values(result.redPlayers),
...Object.values(result.bluePlayers),
];
} else if (result.winner === 1) {
players.value = [
...Object.values(result.bluePlayers),
...Object.values(result.redPlayers),
];
Object.values(result.bluePlayers).forEach((p, index) => {
players.value.push(p);
if (
Object.values(result.redPlayers) &&
Object.values(result.redPlayers)[index]
) {
players.value.push(Object.values(result.redPlayers)[index]);
}
if (result.goldenRound) tabs.value.push("决金箭");
Object.keys(result.roundsData).forEach((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);
}
@@ -41,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)
);
@@ -57,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)
);
@@ -65,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);
});
});
@@ -129,25 +150,23 @@ const onClickTab = (index) => {
</view>
<view
v-if="
selected === 1 &&
data.goldenRound &&
data.goldenRound.arrowHistory.find(
(a) => a.playerId === player.playerId
)
selected >= data.goldenRounds.length &&
selected <= data.goldenRounds.length
"
v-for="(score, index) in data.goldenRound.arrowHistory"
v-for="(score, index) in data.roundsData[
Object.keys(data.roundsData).length -
data.goldenRounds.length +
selected
][player.playerId]"
:key="index"
class="score-item"
>
{{ score.ring }}
</view>
<view
v-if="
(!data.goldenRound && selected > 0) ||
(data.goldenRound && selected > 1)
"
v-if="selected > data.goldenRounds.length"
v-for="(score, index) in data.roundsData[
data.goldenRound ? selected - 1 : selected
selected - data.goldenRounds.length
][player.playerId]"
:key="index"
class="score-item"
@@ -198,13 +217,17 @@ const onClickTab = (index) => {
.score-row {
display: flex;
align-items: flex-start;
margin-left: 15px;
margin-bottom: 5px;
width: calc(50% - 5px);
padding-left: 5px;
}
.score-row > view:last-child {
margin-left: 10px;
display: grid;
grid-template-columns: repeat(3, auto);
gap: 5px;
margin-right: 5px;
min-width: 26%;
}
.score-item {
background-image: url("../static/score-bg.png");
@@ -220,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%;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -14,7 +14,8 @@ function createWebSocket(token, onMessage) {
switch (envVersion) {
case "develop": // 开发版
url = "ws://192.168.1.242:8000/socket";
// url = "ws://192.168.1.242:8000/socket";
url = "wss://apitest.shelingxingqiu.com/socket";
break;
case "trial": // 体验版
url = "wss://apitest.shelingxingqiu.com/socket";