lsc 1 år sedan
förälder
incheckning
40a6c921ab

+ 14 - 13
src/components/easy2/studyStudent.vue

@@ -160,13 +160,13 @@
                       stageIndex == courseType,
                   }"
                 >
-                  <div v-for="(t, toolIndex) in nav.tool" :key="toolIndex">
+                  <div v-for="(t, toolIndex2) in nav.tool" :key="toolIndex2">
                     <div
                       class="gjCss"
-                      :class="{ isGjCss: t.isTool }"
-                      @click="jumpGj(stageIndex, navIndex, toolIndex)"
+                      :class="{ isGjCss: toolIndex == toolIndex2 }"
+                      @click="checkBz(toolIndex2)"
                     >
-                      <div>工具{{ toolIndex + 1 }}:</div>
+                      <div>工具{{ toolIndex2 + 1 }}:</div>
                       <div v-if="t.tool == 58">模拟驾驶</div>
                       <div v-if="t.tool == 59">路径搜索</div>
                       <div v-if="t.tool == 60">深度学习</div>
@@ -14781,15 +14781,16 @@ export default {
       this.$forceUpdate();
     },
     jumpGj(i, j, k) {
-      for (var z = 0; z < this.navList.length; z++) {
-        for (var q = 0; q < this.navList[z].task.length; q++) {
-          for (var w = 0; w < this.navList[z].task[q].tool.length; w++) {
-            this.navList[z].task[q].tool[w].isTool = false;
-          }
-        }
-      }
-      this.navList[i].task[j].tool[k].isTool =
-        !this.navList[i].task[j].tool[k].isTool;
+      // for (var z = 0; z < this.navList.length; z++) {
+      //   for (var q = 0; q < this.navList[z].task.length; q++) {
+      //     for (var w = 0; w < this.navList[z].task[q].tool.length; w++) {
+      //       this.navList[z].task[q].tool[w].isTool = false;
+      //     }
+      //   }
+      // }
+      // this.navList[i].task[j].tool[k].isTool =
+      //   !this.navList[i].task[j].tool[k].isTool;
+
       // var a = document.getElementsByClassName("study_top")[0];
       // var b = this.$refs["bz" + k][0];
       // a.scrollTop = b.offsetTop;

+ 4 - 4
src/components/easy3/studyStudent.vue

@@ -160,13 +160,13 @@
                       stageIndex == courseType,
                   }"
                 >
-                  <div v-for="(t, toolIndex) in nav.tool" :key="toolIndex">
+                  <div v-for="(t, toolIndex2) in nav.tool" :key="toolIndex2">
                     <div
                       class="gjCss"
-                      :class="{ isGjCss: t.isTool }"
-                      @click="jumpGj(stageIndex, navIndex, toolIndex)"
+                      :class="{ isGjCss: toolIndex == toolIndex2 }"
+                      @click="checkBz(toolIndex2)"
                     >
-                      <div>工具{{ toolIndex + 1 }}:</div>
+                      <div>工具{{ toolIndex2 + 1 }}:</div>
                       <div v-if="t.tool == 58">模拟驾驶</div>
                       <div v-if="t.tool == 59">路径搜索</div>
                       <div v-if="t.tool == 60">深度学习</div>

+ 12 - 4
src/components/studyStudent.vue

@@ -820,7 +820,7 @@
                 >
                   <div class="bzBox">
                     <div class="yCss"></div>
-                    <div :ref="'bz' + toolIndex">步骤{{ toolIndex + 1 }}</div>
+                    <div :ref="'bz' + toolIndex" :id="'gj'+toolIndex">步骤{{ toolIndex + 1 }}</div>
                     <div
                       v-if="timeWorkList[toolIndex].length > 0"
                       style="margin: 0 0 0 10px"
@@ -10879,9 +10879,17 @@ export default {
       }
       this.navList[i].task[j].tool[k].isTool =
         !this.navList[i].task[j].tool[k].isTool;
-      var a = document.getElementsByClassName("study_top")[0];
-      var b = this.$refs["bz" + k][0];
-      a.scrollTop = b.offsetTop;
+      var a = document.scrollingElement;
+
+      let target = document.querySelector(`#gj${k}`)
+      if (target) {
+        target.scrollIntoView(true)
+        setTimeout(() => {
+          a.scrollTop = a.scrollTop - 150
+        }, 0);
+      }
+      // var b = this.$refs["bz" + k][0];
+      // a.scrollTop = b.offsetTop;
     },
     addTools2(i) {
       if (i == 4) {