浏览代码

日常开发

林旭祥 14 小时之前
父节点
当前提交
22c98745d0
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      src/views/game/index.vue

+ 9 - 3
src/views/game/index.vue

@@ -7,7 +7,7 @@
         fill: projectList.length <= 12 ? 'row' : 'column',
         rows: 2,
       }" :space-between="20" :slides-per-group="12">
-        <swiper-slide v-for="(item, index) in projectList" :key="index" @click="getJump(item)">
+        <swiper-slide v-for="(item, index) in projectList" :key="item.project_uid" @click="getJump(item)">
           <div class="li">
             <div>
               <div class="pic"><img :src="'static/images/game/' + item.exam_name + '.png'" /></div>
@@ -212,7 +212,7 @@ const getInit = async () => {
       let ok = result.every((item) => {
         return item >= 0.1
       })
-      if(!ok){
+      if (!ok) {
         return false;
       }
       //传给预备窗口
@@ -336,7 +336,9 @@ const getExitGame = (data: any) => {
     let myIndex = areaStateList.value.findIndex((item: any) => {
       return item.area == data.area;
     })
-    areaStateList.value[myIndex].gameover = true;
+    if (myIndex != undefined) {
+      areaStateList.value[myIndex].gameover = true;
+    }
   } else {
     //游戏中退出
     proxy?.$modal.confirm("确定退出吗?").then(() => {
@@ -369,6 +371,10 @@ const getStartGame = (data: any) => {
  * 继续游戏
  */
 const getResumeGame = () => {
+  if (timer.value) {
+    clearInterval(timer.value);
+    timer.value = null;
+  }
   resumeGame.value = false;
   timerNum.value = 5;
   speckText(timerNum.value);