fix bug
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
import { ref, watch, onMounted, onUnmounted } from "vue";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import { isGamingAPI, getCurrentGameAPI } from "@/apis";
|
||||
import { debounce } from "@/util";
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
@@ -19,13 +20,29 @@ onShow(async () => {
|
||||
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();
|
||||
show.value = isGaming;
|
||||
if (isGaming) {
|
||||
const result = await getCurrentGameAPI();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "比赛已结束",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
const gameOver = () => {
|
||||
show.value = false;
|
||||
};
|
||||
|
||||
@@ -8,7 +8,6 @@ import UserHeader from "@/components/UserHeader.vue";
|
||||
import SModal from "@/components/SModal.vue";
|
||||
import Signin from "@/components/Signin.vue";
|
||||
import BubbleTip from "@/components/BubbleTip.vue";
|
||||
import BackToGame from "@/components/BackToGame.vue";
|
||||
import {
|
||||
getAppConfig,
|
||||
getRankListAPI,
|
||||
@@ -106,7 +105,6 @@ const comingSoon = () => {
|
||||
<Container :isHome="true" :showBackToGame="true">
|
||||
<view class="container" :style="{ paddingTop: isIos ? '100rpx' : '70rpx' }">
|
||||
<UserHeader showRank :onSignin="() => (showModal = true)" />
|
||||
<BackToGame />
|
||||
<view :style="{ padding: '12px 10px' }">
|
||||
<view class="feature-grid">
|
||||
<view class="bow-card">
|
||||
|
||||
Reference in New Issue
Block a user