完善排位赛数据显示
This commit is contained in:
@@ -130,7 +130,7 @@ const comingSoon = () => {
|
|||||||
<view class="divide-line"></view>
|
<view class="divide-line"></view>
|
||||||
<view class="player-avatars">
|
<view class="player-avatars">
|
||||||
<block v-for="i in 6" :key="i">
|
<block v-for="i in 6" :key="i">
|
||||||
<block v-if="rankData.rank && rankData.rank[i]">
|
<block v-if="rankData.rank && rankData.rank[i - 1]">
|
||||||
<view
|
<view
|
||||||
class="player-avatar"
|
class="player-avatar"
|
||||||
:style="{
|
:style="{
|
||||||
@@ -142,7 +142,7 @@ const comingSoon = () => {
|
|||||||
<image v-if="i === 2" src="../static/champ2.png" />
|
<image v-if="i === 2" src="../static/champ2.png" />
|
||||||
<image v-if="i === 3" src="../static/champ3.png" />
|
<image v-if="i === 3" src="../static/champ3.png" />
|
||||||
<view v-if="i > 3">{{ i }}</view>
|
<view v-if="i > 3">{{ i }}</view>
|
||||||
<image :src="rankData.rank[i].avatar" mode="aspectFill" />
|
<image :src="rankData.rank[i - 1].avatar" mode="aspectFill" />
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</block>
|
</block>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
|
|||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="my-rank-data">
|
<view class="my-rank-data" v-if="user.id">
|
||||||
<image src="../static/modal-content-bg.png" mode="widthFix" />
|
<image src="../static/modal-content-bg.png" mode="widthFix" />
|
||||||
<text>{{ user.ranking }}</text>
|
<text>{{ user.ranking }}</text>
|
||||||
<Avatar :src="user.avatar" />
|
<Avatar :src="user.avatar" />
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Container from "@/components/Container.vue";
|
|||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
import { getRankListAPI } from "@/apis";
|
import { getRankListAPI } from "@/apis";
|
||||||
import { topThreeColors } from "@/constants";
|
import { topThreeColors } from "@/constants";
|
||||||
|
import { getHomeData } from "@/apis";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
@@ -12,6 +13,13 @@ const { getLvlName } = store;
|
|||||||
|
|
||||||
const selectedIndex = ref(0);
|
const selectedIndex = ref(0);
|
||||||
const currentList = ref([]);
|
const currentList = ref([]);
|
||||||
|
const seasonName = ref("");
|
||||||
|
const seasonData = ref([]);
|
||||||
|
const currentSeasonData = ref({
|
||||||
|
"1v1": { totalGames: 0, winCount: 0, winRate: 0 },
|
||||||
|
"5m": { totalGames: 0, winCount: 0, winRate: 0 },
|
||||||
|
"10m": { totalGames: 0, winCount: 0, winRate: 0 },
|
||||||
|
});
|
||||||
|
|
||||||
const handleSelect = (index) => {
|
const handleSelect = (index) => {
|
||||||
selectedIndex.value = index;
|
selectedIndex.value = index;
|
||||||
@@ -26,6 +34,36 @@ const handleSelect = (index) => {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
currentList.value = rankData.value.rank;
|
currentList.value = rankData.value.rank;
|
||||||
|
const { userGameStats, seasonList } = await getHomeData();
|
||||||
|
seasonData.value = seasonList;
|
||||||
|
if (
|
||||||
|
userGameStats &&
|
||||||
|
userGameStats.stats_list &&
|
||||||
|
userGameStats.stats_list.length
|
||||||
|
) {
|
||||||
|
userGameStats.stats_list.forEach((item) => {
|
||||||
|
if (seasonList.length) {
|
||||||
|
seasonList.some((s) => {
|
||||||
|
if (s.seasonId === item.seasonId) {
|
||||||
|
seasonName.value = s.seasonName;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let keyName = "";
|
||||||
|
if (item.gameType === 1 && item.teamSize === 2) keyName = "1v1";
|
||||||
|
if (item.gameType === 2 && item.teamSize === 5) keyName = "5m";
|
||||||
|
if (item.gameType === 2 && item.teamSize === 10) keyName = "10m";
|
||||||
|
if (keyName) {
|
||||||
|
currentSeasonData.value["1v1"] = {
|
||||||
|
totalGames: item.totalGames,
|
||||||
|
winCount: item.winCount,
|
||||||
|
winRate: (item.winCount / item.totalGames) * 100,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const toTeamMatchPage = (gameType, teamSize) => {
|
const toTeamMatchPage = (gameType, teamSize) => {
|
||||||
@@ -72,9 +110,13 @@ const toRankListPage = () => {
|
|||||||
<Avatar :src="user.avatar" frame :size="30" />
|
<Avatar :src="user.avatar" frame :size="30" />
|
||||||
<text>{{ user.nickName }}</text>
|
<text>{{ user.nickName }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="ranking-season">
|
<view class="ranking-season" v-if="seasonData.length">
|
||||||
<text>第14赛季</text>
|
<text>{{ seasonName }}</text>
|
||||||
<image src="../static/triangle.png" mode="widthFix" />
|
<image
|
||||||
|
v-if="seasonData.length > 1"
|
||||||
|
src="../static/triangle.png"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="my-data">
|
<view class="my-data">
|
||||||
@@ -84,7 +126,7 @@ const toRankListPage = () => {
|
|||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<text>赛季平均环数</text>
|
<text>赛季平均环数</text>
|
||||||
<text :style="{ color: '#FFD947' }">9.7环</text>
|
<text :style="{ color: '#FFD947' }">{{ user.avg_ring }}环</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<text>赛季胜率</text>
|
<text>赛季胜率</text>
|
||||||
@@ -109,21 +151,48 @@ const toRankListPage = () => {
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="data-progress">
|
<view class="data-progress">
|
||||||
<text>【1 V 1】 163 场 胜率 51%</text>
|
<text>
|
||||||
|
{{
|
||||||
|
`【1 V 1】${currentSeasonData["1v1"].totalGames}场 胜率 ${currentSeasonData["1v1"].winRate}%`
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
<view>
|
<view>
|
||||||
<view :style="{ width: '50%', backgroundColor: '#FF507E' }" />
|
<view
|
||||||
|
:style="{
|
||||||
|
width: `${currentSeasonData['1v1'].winRate}%`,
|
||||||
|
backgroundColor: '#FF507E',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="data-progress">
|
<view class="data-progress">
|
||||||
<text>【5人大乱斗】 12 场 得分率 56%</text>
|
<text>
|
||||||
|
{{
|
||||||
|
`【5人大乱斗】${currentSeasonData["5m"].totalGames}场 胜率 ${currentSeasonData["5m"].winRate}%`
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
<view>
|
<view>
|
||||||
<view :style="{ width: '60%', backgroundColor: '#FFD947' }" />
|
<view
|
||||||
|
:style="{
|
||||||
|
width: `${currentSeasonData['5m'].winRate}%`,
|
||||||
|
backgroundColor: '#FFD947',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="data-progress">
|
<view class="data-progress">
|
||||||
<text>【10 人大乱斗】 12 场 得分率 5</text>
|
<text>
|
||||||
|
{{
|
||||||
|
`【10人大乱斗】${currentSeasonData["5m"].totalGames}场 胜率 ${currentSeasonData["10m"].winRate}%`
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
<view>
|
<view>
|
||||||
<view :style="{ width: '45%', backgroundColor: '#FFD947' }" />
|
<view
|
||||||
|
:style="{
|
||||||
|
width: `${currentSeasonData['10m'].winRate}%`,
|
||||||
|
backgroundColor: '#FFD947',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view @click="toMyGrowthPage">查看我的比赛记录</view>
|
<view @click="toMyGrowthPage">查看我的比赛记录</view>
|
||||||
|
|||||||
Reference in New Issue
Block a user