Browse Source

日程开发

linxuxiang 1 week ago
parent
commit
cea63f2810
2 changed files with 30 additions and 11 deletions
  1. 30 5
      src/layout/index.vue
  2. 0 6
      src/types/components.d.ts

+ 30 - 5
src/layout/index.vue

@@ -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>

+ 0 - 6
src/types/components.d.ts

@@ -8,17 +8,11 @@ export {}
 declare module 'vue' {
   export interface GlobalComponents {
     ChooseStudent: typeof import('./../components/ChooseStudent/index.vue')['default']
-    copy: typeof import('./../components/SquareGame/index copy.vue')['default']
-    ElAvatar: typeof import('element-plus/es')['ElAvatar']
-    ElButton: typeof import('element-plus/es')['ElButton']
     ElIcon: typeof import('element-plus/es')['ElIcon']
     ElInput: typeof import('element-plus/es')['ElInput']
     ElOption: typeof import('element-plus/es')['ElOption']
-    ElPagination: typeof import('element-plus/es')['ElPagination']
     ElSelect: typeof import('element-plus/es')['ElSelect']
     ElSwitch: typeof import('element-plus/es')['ElSwitch']
-    ElTable: typeof import('element-plus/es')['ElTable']
-    ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     FaceWindow: typeof import('./../components/FaceWindow/index.vue')['default']
     Header: typeof import('./../components/Header/index.vue')['default']
     JumpRopeGame: typeof import('./../components/JumpRopeGame/index.vue')['default']