This commit is contained in:
kron
2025-07-22 14:42:13 +08:00
parent d3029865cf
commit e5a28fd4ac
2 changed files with 20 additions and 5 deletions

View File

@@ -1,7 +1,8 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onUnmounted } from "vue";
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import { isGamingAPI, getCurrentGameAPI } from "@/apis"; import { isGamingAPI, getCurrentGameAPI } from "@/apis";
import { debounce } from "@/util";
import useStore from "@/store"; import useStore from "@/store";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
const store = useStore(); const store = useStore();
@@ -19,13 +20,29 @@ onShow(async () => {
show.value = isGaming; show.value = isGaming;
} }
}); });
const onClick = async () => { watch(
() => user.value,
async (value) => {
if (!value.id) {
show.value = false;
} else {
const isGaming = await isGamingAPI();
show.value = isGaming;
}
}
);
const onClick = debounce(async () => {
const isGaming = await isGamingAPI(); const isGaming = await isGamingAPI();
show.value = isGaming; show.value = isGaming;
if (isGaming) { if (isGaming) {
const result = await getCurrentGameAPI(); const result = await getCurrentGameAPI();
} else {
uni.showToast({
title: "比赛已结束",
icon: "none",
});
} }
}; });
const gameOver = () => { const gameOver = () => {
show.value = false; show.value = false;
}; };

View File

@@ -8,7 +8,6 @@ import UserHeader from "@/components/UserHeader.vue";
import SModal from "@/components/SModal.vue"; import SModal from "@/components/SModal.vue";
import Signin from "@/components/Signin.vue"; import Signin from "@/components/Signin.vue";
import BubbleTip from "@/components/BubbleTip.vue"; import BubbleTip from "@/components/BubbleTip.vue";
import BackToGame from "@/components/BackToGame.vue";
import { import {
getAppConfig, getAppConfig,
getRankListAPI, getRankListAPI,
@@ -106,7 +105,6 @@ const comingSoon = () => {
<Container :isHome="true" :showBackToGame="true"> <Container :isHome="true" :showBackToGame="true">
<view class="container" :style="{ paddingTop: isIos ? '100rpx' : '70rpx' }"> <view class="container" :style="{ paddingTop: isIos ? '100rpx' : '70rpx' }">
<UserHeader showRank :onSignin="() => (showModal = true)" /> <UserHeader showRank :onSignin="() => (showModal = true)" />
<BackToGame />
<view :style="{ padding: '12px 10px' }"> <view :style="{ padding: '12px 10px' }">
<view class="feature-grid"> <view class="feature-grid">
<view class="bow-card"> <view class="bow-card">