排行榜数据显示

This commit is contained in:
kron
2025-06-27 10:50:09 +08:00
parent a229b18b31
commit 9f29a92d3d
3 changed files with 25 additions and 14 deletions

View File

@@ -15,12 +15,11 @@ import { topThreeColors } from "@/constants";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { updateConfig, updateUser, updateDevice } = store;
const { updateConfig, updateUser, updateDevice, updateRank } = store;
// 使用storeToRefs用于UI里显示保持响应性
const { user, device, remoteConnect } = storeToRefs(store);
const { user, device, remoteConnect, rankData } = storeToRefs(store);
const showModal = ref(false);
const isIos = ref(true);
const rankData = ref({});
const toPage = (path) => {
if (!user.value.id) {
@@ -53,11 +52,11 @@ onMounted(async () => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
const config = await getAppConfig();
updateConfig(config);
console.log("全局配置:", config);
const rankList = await getRankListAPI();
if (rankList) rankData.value = rankList;
console.log("排位赛数据:", rankList);
updateConfig(config);
updateRank(rankList);
const token = uni.getStorageSync("token");
if (token) {
const result = await getHomeData();
@@ -148,7 +147,7 @@ const comingSoon = () => {
</block>
</block>
<view class="more-players" @click="toRankListPage">
<text>456{{ remoteConnect ? 1 : 0 }}</text>
<text>{{ rankData.rank.length }}</text>
</view>
</view>
</view>