update:排位赛界面、排行榜界面改版,新增agents描述文档
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
getDeviceBatteryAPI,
|
||||
getHomeData,
|
||||
getMyDevicesAPI,
|
||||
getRankListAPI,
|
||||
getScoreRankList,
|
||||
silentLoginAPI,
|
||||
} from "@/apis";
|
||||
import {topThreeColors} from "@/constants";
|
||||
@@ -26,15 +26,23 @@ const {
|
||||
updateConfig,
|
||||
updateUser,
|
||||
updateDevice,
|
||||
updateRank,
|
||||
getLvlName,
|
||||
getLvlNameByScore,
|
||||
updateOnline,
|
||||
} = store;
|
||||
const {user, device, rankData, online, game} = storeToRefs(store);
|
||||
const {user, device, online, game} = storeToRefs(store);
|
||||
|
||||
const showModal = ref(false);
|
||||
const showGuide = ref(false);
|
||||
const scoreRankList = ref([]);
|
||||
|
||||
// 提取积分榜接口返回的榜单数组,兼容数组和对象两种返回格式。
|
||||
const getScoreRankData = (result) => {
|
||||
if (Array.isArray(result)) return result;
|
||||
if (Array.isArray(result?.list)) return result.list;
|
||||
if (Array.isArray(result?.items)) return result.items;
|
||||
return [];
|
||||
};
|
||||
|
||||
const toPage = async (path) => {
|
||||
if (!user.value.id) {
|
||||
@@ -84,15 +92,15 @@ onShow(async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const promises = [getRankListAPI()];
|
||||
const promises = [getScoreRankList(undefined, 1, 10)];
|
||||
if (token || user.value.id) {
|
||||
promises.push(getHomeData());
|
||||
}
|
||||
|
||||
const [rankList, homeData] = await Promise.all(promises);
|
||||
|
||||
console.log("排行数据", rankList);
|
||||
updateRank(rankList);
|
||||
console.log("积分榜数据", rankList);
|
||||
scoreRankList.value = getScoreRankData(rankList).slice(0, 10);
|
||||
|
||||
if (homeData) {
|
||||
console.log("首页数据:", homeData);
|
||||
@@ -216,7 +224,7 @@ onShareTimeline(() => {
|
||||
class="player-avatar"
|
||||
:style="{
|
||||
zIndex: 8 - i,
|
||||
borderColor: rankData.rank[i - 1]
|
||||
borderColor: scoreRankList[i - 1]
|
||||
? topThreeColors[i - 1] || '#000'
|
||||
: '#000',
|
||||
}"
|
||||
@@ -227,15 +235,15 @@ onShareTimeline(() => {
|
||||
<view v-if="i > 3">{{ i }}</view>
|
||||
<image
|
||||
:src="
|
||||
rankData.rank[i - 1]
|
||||
? rankData.rank[i - 1].avatar
|
||||
scoreRankList[i - 1]
|
||||
? (scoreRankList[i - 1].avatar || '../static/user-icon.png')
|
||||
: '../static/user-icon-dark.png'
|
||||
"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="more-players">
|
||||
<text>{{ rankData.rank.length }}</text>
|
||||
<text>{{ scoreRankList.length }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user