Browse Source

日常开发

林旭祥 1 month ago
parent
commit
ebbbb8b2f6
3 changed files with 11 additions and 20 deletions
  1. 0 9
      src/App.vue
  2. 7 11
      src/layout/index.vue
  3. 4 0
      src/views/sunshineRun/index.vue

+ 0 - 9
src/App.vue

@@ -3,15 +3,6 @@
 </template>
 
 <script setup lang="ts">
-//定时排行榜默认开启
-let state1 = localStorage.getItem('rankingSwitch1');
-let state2 = localStorage.getItem('rankingSwitch2');
-if (state1 == undefined) {
-    localStorage.setItem('rankingSwitch1', "1");
-}
-if (state2 == undefined) {
-    localStorage.setItem('rankingSwitch2', "1");
-}
 // import { useWebSocket } from '@/utils/handWs';
 // const { handWs, startDevice, startHand, stateHand } = useWebSocket();
 

+ 7 - 11
src/layout/index.vue

@@ -22,21 +22,11 @@ const { timer } = toRefs(data);
 
 const handClick = () => {
   //getClearTimer();
-  //getCountDown();
   if (!rankingWindowRef.value.rankingState) {
     openRanking();
   }
 };
 
-const getCountDown = () => {
-  timer.value = setTimeout(() => {
-    if (
-      !['/ranking', '/login', '/login/qrcode', '/login/mobile', '/login/sunshineRun', '/sunshineRun'].includes(router.currentRoute.value.fullPath)
-    ) {
-      router.push({ path: '/ranking' });
-    }
-  }, 1000 * 60 * 10);
-};
 
 /**
  * 定时打开排行榜
@@ -68,8 +58,14 @@ const getClearTimer = () => {
   clearTimeout(timer.value);
 };
 
+onBeforeMount(() => {
+  let state1 = localStorage.getItem('rankingSwitch1');
+  if (state1 == undefined) {
+    localStorage.setItem('rankingSwitch1', "1");
+  }
+});
+
 onMounted(() => {
-  //getCountDown();
   openRanking();
   const vConsole = new VConsole({ theme: 'dark' });
   const vConsoleIcon: any = document.querySelector('.vc-switch');

+ 4 - 0
src/views/sunshineRun/index.vue

@@ -323,6 +323,10 @@ const getRankingBtn = () => {
 
 onBeforeMount(() => {
   localStorage.setItem('loginType', "3");
+  let state2 = localStorage.getItem('rankingSwitch2');
+  if (state2 == undefined) {
+    localStorage.setItem('rankingSwitch2', "1");
+  }
   //获取当前时间
   setDate();
   //用户信息