林旭祥 1 mesiac pred
rodič
commit
c6c90ff416

+ 4 - 0
src/layout/index.vue

@@ -47,6 +47,10 @@ const openRanking = () => {
     rankingWindowRef.value.close();
   }
   //console.log("timer.value", timer.value)
+  let state = localStorage.getItem('rankingSwitch1');
+  if (state != "1") {
+    return false;
+  }
   // 设置新的定时器
   timer.value = setTimeout(() => {
     if (!rankingWindowRef.value.rankingState) {

+ 37 - 6
src/views/set/index.vue

@@ -18,6 +18,14 @@
           </div>
         </div>
       </div>
+      <div class="li" @click="getRanking">
+        <div class="liBox">
+          <div class="pic"><img src="@/assets/images/common/set1.png"></div>
+          <div class="name">
+            {{ rankingSwitch1 ? '关' : '开' }}排行榜
+          </div>
+        </div>
+      </div>
       <div class="li" @click="getLogout">
         <div class="liBox">
           <div class="pic"><img src="@/assets/images/common/set2.png"></div>
@@ -43,9 +51,10 @@ const { proxy } = getCurrentInstance() as any;
 const router = useRouter();
 const data = reactive<any>({
   vConsoleState: true,
+  rankingSwitch1: true,
 });
 
-const { vConsoleState } = toRefs(data);
+const { vConsoleState, rankingSwitch1 } = toRefs(data);
 
 //设置
 const getConfig = () => {
@@ -72,12 +81,12 @@ const getLogout = async () => {
 };
 
 /**
- * 调试
+ * 调试开关
 */
 const getConsole = () => {
   const vConsoleIcon: any = document.querySelector('.vc-switch');
-  let vConsole = localStorage.getItem('vConsole');
-  if (vConsole == "1") {
+  let state = localStorage.getItem('vConsole');
+  if (state == "1") {
     localStorage.setItem('vConsole', "0");
     vConsoleIcon.style.display = 'none';
     vConsoleState.value = false;
@@ -88,6 +97,22 @@ const getConsole = () => {
   }
 };
 
+/**
+ * 排行榜开关(不包括阳光跑)
+*/
+const getRanking = () => {
+  let state = localStorage.getItem('rankingSwitch1');
+  if (state == "1") {
+    localStorage.setItem('rankingSwitch1', "0");
+    rankingSwitch1.value = false;
+  } else {
+    localStorage.setItem('rankingSwitch1', "1");
+    rankingSwitch1.value = true;
+  }
+  window.location.reload()
+};
+
+
 /**
  * 返回
 */
@@ -103,12 +128,18 @@ const confirmExit = () => {
 };
 
 onMounted(() => {
-  let vConsole = localStorage.getItem('vConsole');
-  if (vConsole == "1") {
+  let state1 = localStorage.getItem('vConsole');
+  if (state1 == "1") {
     vConsoleState.value = true;
   } else {
     vConsoleState.value = false;
   }
+  let state2 = localStorage.getItem('rankingSwitch1');
+  if (state2 == "1") {
+    rankingSwitch1.value = true;
+  } else {
+    rankingSwitch1.value = false;
+  }
 })
 </script>
 

+ 43 - 14
src/views/sunshineRun/index.vue

@@ -9,7 +9,8 @@
         <div class="sunshineRun-title"><img src="@/assets/images/sunshineRun/title.png" /></div>
         <div class="toolList">
           <div class="li">{{ date }}</div>
-          <div class="li btn screen" :class="{ 'on': screen, 'off': !screen }" @click="getFullScreen"></div>
+          <div class="li btn screen" :class="{ 'on': screen, 'off': !screen }" @click="getFullScreen" title="屏幕"></div>
+          <div class="li btn rankingSwitch" :class="{ 'on': rankingSwitch2, 'off': !rankingSwitch2 }" @click="getRankingBtn" title="排行榜"></div>
           <div class="li btn closeBtn" @click="confirmExit"></div>
         </div>
       </div>
@@ -100,10 +101,11 @@ const data = reactive<any>({
     size: 8,
     pages: 1
   }, //学生分页
-  timer: null //排行榜定时弹窗状态
+  timer: null, //排行榜定时弹窗状态
+  rankingSwitch2: true, //排行榜开关
 });
 
-const { timerManager, userInfo, testList, reportList, date, unit, screen, studentPage, timer } = toRefs(data);
+const { timerManager, userInfo, testList, reportList, date, unit, screen, studentPage, timer, rankingSwitch2 } = toRefs(data);
 
 /**
  * 更新时间
@@ -287,17 +289,36 @@ const initSunshineRun = () => {
  * 定时打开排行榜
  */
 const openRanking = () => {
-  // clearTimeout(timer.value);
-  // if (rankingWindowRef.value.rankingState) {
-  //   rankingWindowRef.value.close();
-  // }
-  // //console.log("timer.value", timer.value)
-  // // 设置新的定时器
-  // timer.value = setTimeout(() => {
-  //   if (!rankingWindowRef.value.rankingState) {
-  //     rankingWindowRef.value.open();
-  //   }
-  // }, 1000 * 60 * 5);
+  clearTimeout(timer.value);
+  if (rankingWindowRef.value.rankingState) {
+    rankingWindowRef.value.close();
+  }
+  //console.log("timer.value", timer.value)
+  let state = localStorage.getItem('rankingSwitch2');
+  if (state != "1") {
+    return false;
+  }
+  // 设置新的定时器
+  timer.value = setTimeout(() => {
+    if (!rankingWindowRef.value.rankingState) {
+      rankingWindowRef.value.open();
+    }
+  }, 1000 * 60 * 5);
+};
+
+/**
+ * 排行榜开关
+*/
+const getRankingBtn = () => {
+  let state = localStorage.getItem('rankingSwitch2');
+  if (state == "1") {
+    localStorage.setItem('rankingSwitch2', "0");
+    rankingSwitch2.value = false;
+  } else {
+    localStorage.setItem('rankingSwitch2', "1");
+    rankingSwitch2.value = true;
+  }
+  openRanking();
 };
 
 onBeforeMount(() => {
@@ -417,6 +438,14 @@ onBeforeUnmount(() => {
         .screen.off {
           background-image: url('@/assets/images/sunshineRun/screen2.png');
         }
+
+        .rankingSwitch.on {
+          background-image: url('@/assets/images/sunshineRun/screen1.png');
+        }
+
+        .rankingSwitch.off {
+          background-image: url('@/assets/images/sunshineRun/screen2.png');
+        }
       }
     }
   }