|
@@ -5,12 +5,14 @@
|
|
|
<component :is="Component" :key="route.path" />
|
|
|
</Transition>
|
|
|
</router-view>
|
|
|
+ <RankingWindow ref="rankingWindowRef" @getClose="openRanking"></RankingWindow>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="AppMain" lang="ts">
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
const router = useRouter();
|
|
|
+const rankingWindowRef = ref();
|
|
|
|
|
|
const data = reactive<any>({
|
|
|
timer: null
|
|
@@ -18,8 +20,9 @@ const data = reactive<any>({
|
|
|
const { timer } = toRefs(data);
|
|
|
|
|
|
const handClick = () => {
|
|
|
- getClearTimer();
|
|
|
- getCountDown();
|
|
|
+ //getClearTimer();
|
|
|
+ //getCountDown();
|
|
|
+ openRanking();
|
|
|
};
|
|
|
|
|
|
const getCountDown = () => {
|
|
@@ -32,12 +35,35 @@ const getCountDown = () => {
|
|
|
}, 1000 * 60 * 10);
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 定时打开排行榜
|
|
|
+ */
|
|
|
+const openRanking = () => {
|
|
|
+ clearTimeout(timer.value);
|
|
|
+ if (rankingWindowRef.value.rankingState) {
|
|
|
+ rankingWindowRef.value.close();
|
|
|
+ }
|
|
|
+ console.log("timer.value", timer.value)
|
|
|
+ // 设置新的定时器,6秒后执行
|
|
|
+ timer.value = setTimeout(() => {
|
|
|
+ if (!rankingWindowRef.value.rankingState) {
|
|
|
+ if (
|
|
|
+ !['/ranking', '/login', '/login/qrcode', '/login/mobile', '/login/sunshineRun', '/sunshineRun'].includes(router.currentRoute.value.fullPath)
|
|
|
+ ) {
|
|
|
+ rankingWindowRef.value.open();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 1000 * 60 * 10);
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
const getClearTimer = () => {
|
|
|
clearTimeout(timer.value);
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- getCountDown();
|
|
|
+ //getCountDown();
|
|
|
+ openRanking();
|
|
|
});
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
@@ -64,5 +90,4 @@ onBeforeUnmount(() => {
|
|
|
// ::-webkit-scrollbar-thumb {
|
|
|
// background-color: #c0c0c0;
|
|
|
// border-radius: 3px;
|
|
|
-// }
|
|
|
-</style>
|
|
|
+// }</style>
|