Selaa lähdekoodia

展示第一个课件内容

natasha 1 vuosi sitten
vanhempi
commit
142ad30d32
1 muutettua tiedostoa jossa 33 lisäystä ja 11 poistoa
  1. 33 11
      src/views/courseView.vue

+ 33 - 11
src/views/courseView.vue

@@ -299,16 +299,7 @@ export default {
         });
     } else if (_this.$route.query.showCourse) {
       _this.bookId = this.$route.query.bookId;
-      _this.type = this.$route.query.type;
-      const MethodName = "book-book_manager-GetBook";
-      const data = {
-        id: _this.bookId,
-      };
-      getContent(MethodName, data).then((res) => {
-        this.showContent = true;
-        _this.name = res.name;
-        _this.pictureUrl = res.picture_url;
-      });
+      this.showContent = true;
     } else {
       _this.$message({
         message: "链接已失效",
@@ -331,7 +322,36 @@ export default {
       this.$router.go(-1);
     },
     changeTreeData(val) {
+      const _this = this;
       this.FatherTreeData = JSON.parse(JSON.stringify(val));
+
+      let nodes = this.FatherTreeData;
+      for (let i = 0; i < nodes.length; i++) {
+        if (nodes[i].is_courseware == "true") {
+          _this.changeId(nodes[i].id, "");
+          return false;
+        } else {
+          if (nodes[i].children) {
+            let nodesC = nodes[i].children;
+            for (let j = 0; j < nodesC.length; j++) {
+              if (nodesC[j].is_courseware == "true") {
+                _this.changeId(nodesC[j].id, "");
+                return false;
+              } else {
+                if (nodesC[j].children) {
+                  let nodesCs = nodesC[j].children;
+                  for (let l = 0; j < nodesCs.length; l++) {
+                    if (nodesCs[l].is_courseware == "true") {
+                      _this.changeId(nodesCs[l].id, "");
+                      return false;
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
     },
     changeId(id, name) {
       const _this = this;
@@ -343,7 +363,9 @@ export default {
         _this.fullTree = false;
         document.getElementById("content-tree").style.display = "none";
       }
-      document.getElementById("content-scroll").scrollTop = 0;
+      if (document.getElementById("content-scroll")) {
+        document.getElementById("content-scroll").scrollTop = 0;
+      }
     },
     // 点击全屏展示 隐藏tree
     fullScreen() {