natasha il y a 1 mois
Parent
commit
3dd738f98f
1 fichiers modifiés avec 29 ajouts et 20 suppressions
  1. 29 20
      src/views/courseView.vue

+ 29 - 20
src/views/courseView.vue

@@ -29,9 +29,8 @@
         id="content-tree"
         :class="[
           fullTree ? 'content-tree-full' : 'content-tree',
-          isPhone ? 'content-tree-phone' : '',
+          isPhone || isPad ? 'content-tree-phone' : '',
           showMenu ? '' : 'content-tree-unfold',
-          isPad ? 'content-tree-pad' : '',
         ]"
         :style="{ background: isPhone && showMenu ? themeColorPhone : '' }"
       >
@@ -445,24 +444,32 @@ export default {
         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;
+        if (
+          sessionStorage.getItem("gclsBookId") &&
+          sessionStorage.getItem("gclsBookId") === this.bookId &&
+          sessionStorage.getItem("gclsChapterId")
+        ) {
+          this.changeId(sessionStorage.getItem("gclsChapterId"), "");
+        } else {
+          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;
+                        }
                       }
                     }
                   }
@@ -478,6 +485,8 @@ export default {
       _this.chapterId = id;
       _this.chapterName = name;
       _this.isAnswerShow = false;
+      sessionStorage.setItem("gclsChapterId", id);
+      sessionStorage.setItem("gclsBookId", this.bookId);
       _this.onGetData();
       if (!_this.treeFlag) {
         _this.fullTree = false;