diff --git a/src/pages/index.vue b/src/pages/index.vue index 1fdc2b1..deddee4 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -130,7 +130,7 @@ const comingSoon = () => { - + {{ i }} - + diff --git a/src/pages/rank-list.vue b/src/pages/rank-list.vue index 208da75..953e917 100644 --- a/src/pages/rank-list.vue +++ b/src/pages/rank-list.vue @@ -121,7 +121,7 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"]; > - + {{ user.ranking }} diff --git a/src/pages/ranking.vue b/src/pages/ranking.vue index e361b99..10267c8 100644 --- a/src/pages/ranking.vue +++ b/src/pages/ranking.vue @@ -4,6 +4,7 @@ import Container from "@/components/Container.vue"; import Avatar from "@/components/Avatar.vue"; import { getRankListAPI } from "@/apis"; import { topThreeColors } from "@/constants"; +import { getHomeData } from "@/apis"; import useStore from "@/store"; import { storeToRefs } from "pinia"; const store = useStore(); @@ -12,6 +13,13 @@ const { getLvlName } = store; const selectedIndex = ref(0); 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) => { selectedIndex.value = index; @@ -26,6 +34,36 @@ const handleSelect = (index) => { onMounted(async () => { 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) => { @@ -72,9 +110,13 @@ const toRankListPage = () => { {{ user.nickName }} - - 第14赛季 - + + {{ seasonName }} + @@ -84,7 +126,7 @@ const toRankListPage = () => { 赛季平均环数 - 9.7环 + {{ user.avg_ring }}环 赛季胜率 @@ -109,21 +151,48 @@ const toRankListPage = () => { /> - 【1 V 1】 163 场 胜率 51% + + {{ + `【1 V 1】${currentSeasonData["1v1"].totalGames}场 胜率 ${currentSeasonData["1v1"].winRate}%` + }} + - + - 【5人大乱斗】 12 场 得分率 56% + + {{ + `【5人大乱斗】${currentSeasonData["5m"].totalGames}场 胜率 ${currentSeasonData["5m"].winRate}%` + }} + - + - 【10 人大乱斗】 12 场 得分率 5 + + {{ + `【10人大乱斗】${currentSeasonData["5m"].totalGames}场 胜率 ${currentSeasonData["10m"].winRate}%` + }} + - + 查看我的比赛记录