Browse Source

上一步下一步跨阶段

zengyicheng 2 years ago
parent
commit
be65f6737d
1 changed files with 81 additions and 34 deletions
  1. 81 34
      src/components/study.vue

+ 81 - 34
src/components/study.vue

@@ -56,7 +56,7 @@
           <div class="before"></div>
           <div class="courseIndex">
             <div>第{{ courseType - 0 + 1 }}阶段</div>
-            <div>{{ chapInfo.dyName }}</div>
+            <div>{{ chapInfoList[courseType].dyName }}</div>
           </div>
           <div class="btnAll">
             <div class="returnBtn" @click="nextOrpreSteps(0)">上一步</div>
@@ -87,17 +87,17 @@
             class="vedioBox"
             v-if="
               vedio[taskCount].length > 0 ||
-              chapInfo.chapterInfo[0].taskJson[taskCount].taskDetail != ''
+              chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].taskDetail != ''
             "
           >
             <div class="checkbox">
               <div
                 class="check"
                 style="font-size: 25px"
-                :id="chapInfo.chapterInfo[0].taskJson[taskCount].id"
+                :id="chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].id"
               >
                 <!-- {{ taskCount + 1 }}
-                {{ chapInfo.chapterInfo[0].taskJson[taskCount].task }} -->
+                {{ chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].task }} -->
                 学一学
               </div>
             </div>
@@ -121,14 +121,14 @@
                         overflow: auto;
                       "
                       v-if="
-                        chapInfo.chapterInfo[0].taskJson[taskCount]
+                        chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                           .taskDetail != ''
                       "
                     >
                       <!-- <span style="color: #cbcbcb">任务描述</span> -->
                       {{
-                        chapInfo.chapterInfo[0].taskJson[taskCount].taskDetail
-                          ? chapInfo.chapterInfo[0].taskJson[taskCount]
+                        chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].taskDetail
+                          ? chapInfoList[courseType].chapterInfo[0].taskJson[taskCount]
                               .taskDetail
                           : "暂无描述"
                       }}
@@ -225,7 +225,7 @@
                     v-for="(text, textIndex) in textList[taskCount]"
                     :key="textIndex + '2'"
                   >
-                    <div class="vedioNav" style="width: 70px">富文本</div>
+                    <div class="vedioNav" style="width: 70px">文档</div>
                     <div>
                       <div
                         class="navText"
@@ -320,14 +320,14 @@
                       overflow: auto;
                     "
                     v-if="
-                      chapInfo.chapterInfo[0].taskJson[taskCount].taskDetail !=
+                      chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].taskDetail !=
                       ''
                     "
                   >
                     <!-- <span style="color: #cbcbcb">任务描述</span> -->
                     {{
-                      chapInfo.chapterInfo[0].taskJson[taskCount].taskDetail
-                        ? chapInfo.chapterInfo[0].taskJson[taskCount].taskDetail
+                      chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].taskDetail
+                        ? chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].taskDetail
                         : "暂无描述"
                     }}
                   </div>
@@ -394,7 +394,7 @@
                     v-for="(text, textIndex) in textList[taskCount]"
                     :key="textIndex + '2'"
                   >
-                    <div class="vedioNav" style="width: 70px">富文本</div>
+                    <div class="vedioNav" style="width: 70px">文档</div>
                     <div>
                       <div
                         class="noNavText"
@@ -503,11 +503,11 @@
             <div
               class="vedioBox"
               v-if="
-                chapInfo.chapterInfo[0].taskJson[taskCount].toolChoose[0]
+                chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].toolChoose[0]
                   .tool &&
-                chapInfo.chapterInfo[0].taskJson[taskCount].toolChoose[0].tool
+                chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].toolChoose[0].tool
                   .length &&
-                chapInfo.chapterInfo[0].taskJson[taskCount].toolChoose[0].tool
+                chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].toolChoose[0].tool
                   .length > 0
               "
             >
@@ -531,7 +531,7 @@
                 <div
                   class="filebox"
                   style="flex-wrap: nowrap; margin: 0 20px"
-                  v-for="(tool, toolIndex) in chapInfo.chapterInfo[0].taskJson[
+                  v-for="(tool, toolIndex) in chapInfoList[courseType].chapterInfo[0].taskJson[
                     taskCount
                   ].toolChoose"
                   :key="toolIndex"
@@ -1207,7 +1207,7 @@
           </div>
           <!-- <div class="first">
             <div>作业名称:</div>
-            <div>{{ chapInfo.dyName }}</div>
+            <div>{{ chapInfoList[courseType].dyName }}</div>
           </div>
           <div style="font-size: 20px; margin-bottom: 10px">上传作业</div>
           <el-input
@@ -1785,7 +1785,7 @@ export default {
         .get(this.$store.state.api + "selectSWorks", params)
         .then((res) => {
           var a =
-            this.chapInfo.chapterInfo[0].taskJson[this.taskCount].toolChoose;
+            this.chapInfoList[this.courseType].chapterInfo[0].taskJson[this.taskCount].toolChoose;
           var b = res.data[0];
           for (var i = 0; i < a.length; i++) {
             this.worksStudent[i] = [];
@@ -1945,21 +1945,68 @@ export default {
       window.parent.postMessage({ allScreen: "1" }, "*");
     },
     nextOrpreSteps(t) {
+      var b = this.chapInfoList.length - 1;
       if (t == 0) {
-        if (this.taskCount == 0) {
-          this.taskCount = 0;
+        if (this.courseType == 0) {
+          if (this.taskCount == 0) {
+            this.navList[this.courseType].isOpen = false;
+            this.courseType = b;
+            this.taskCount =
+              this.chapInfoList[this.courseType].chapterInfo[0].taskJson
+                .length - 1;
+            this.navList[this.courseType].isOpen = true;
+          } else {
+            this.taskCount--;
+          }
         } else {
-          this.taskCount--;
+          if (this.taskCount == 0) {
+            this.navList[this.courseType].isOpen = false;
+            this.courseType--;
+            this.taskCount =
+              this.chapInfoList[this.courseType].chapterInfo[0].taskJson
+                .length - 1;
+            this.navList[this.courseType].isOpen = true;
+          } else {
+            this.taskCount--;
+          }
         }
       } else {
-        if (
-          this.taskCount ==
-          this.chapInfo.chapterInfo[0].taskJson.length - 1
-        ) {
-          this.taskCount = this.chapInfo.chapterInfo[0].taskJson.length - 1;
+        var b = this.chapInfoList.length - 1;
+        if (this.courseType == b) {
+          if (
+            this.taskCount ==
+            this.chapInfoList[this.courseType].chapterInfo[0].taskJson.length -
+              1
+          ) {
+            this.navList[this.courseType].isOpen = false;
+            this.courseType = 0;
+            this.taskCount = 0;
+            this.navList[this.courseType].isOpen = true;
+          } else {
+            this.taskCount++;
+          }
         } else {
-          this.taskCount++;
+          if (
+            this.taskCount ==
+            this.chapInfoList[this.courseType].chapterInfo[0].taskJson.length -
+              1
+          ) {
+            this.navList[this.courseType].isOpen = false;
+            this.courseType++;
+            this.taskCount = 0;
+            this.navList[this.courseType].isOpen = true;
+          } else {
+            this.taskCount++;
+          }
         }
+        // if (
+        //   this.taskCount ==
+        //   this.chapInfo.chapterInfo[0].taskJson.length - 1
+        // ) {
+        //   this.taskCount = this.chapInfo.chapterInfo[0].taskJson.length - 1;
+        // } else {
+        //   this.taskCount++;
+        // }
       }
       this.navId = this.navList[this.courseType].task[this.taskCount].id;
       if (this.vedio[this.taskCount].length > 0) {
@@ -2491,11 +2538,11 @@ export default {
         }
         if (!this.dialogVisible2) {
           this.askJson.askJson =
-            this.chapInfo.chapterInfo[0].taskJson[index].toolChoose[i].askJson;
+            this.chapInfoList[this.courseType].chapterInfo[0].taskJson[index].toolChoose[i].askJson;
           this.askJson.askTitle =
-            this.chapInfo.chapterInfo[0].taskJson[index].toolChoose[i].askTitle;
+            this.chapInfoList[this.courseType].chapterInfo[0].taskJson[index].toolChoose[i].askTitle;
           this.askJson.askCount =
-            this.chapInfo.chapterInfo[0].taskJson[index].toolChoose[i].askCount;
+            this.chapInfoList[this.courseType].chapterInfo[0].taskJson[index].toolChoose[i].askCount;
         } else {
           this.askJson.askJson = this.chapTools.askJson.askJson;
           this.askJson.askTitle = this.chapTools.askJson.askTitle;
@@ -2605,10 +2652,10 @@ export default {
           a = this.answerCount;
           this.toolsCount(a, t);
         }
-        this.answerQ = this.chapInfo.chapterInfo[0].taskJson[index].toolChoose[
+        this.answerQ = this.chapInfoList[this.courseType].chapterInfo[0].taskJson[index].toolChoose[
           i
         ].answerQ
-          ? this.chapInfo.chapterInfo[0].taskJson[index].toolChoose[i].answerQ
+          ? this.chapInfoList[this.courseType].chapterInfo[0].taskJson[index].toolChoose[i].answerQ
           : "";
         this.answerDialogVisible = true;
       }
@@ -3194,7 +3241,6 @@ export default {
 }
 .courseIndex > div:nth-child(2) {
   font-size: 23px;
-  color: #c0c0c0;
 }
 .course_text {
   padding: 20px 0 0 15px;
@@ -3684,7 +3730,8 @@ export default {
   align-items: flex-start;
   justify-content: flex-start;
   align-content: center;
-  width: 20%;
+  width: 15%;
+  margin-right: 10px;
 }
 .workImg {
   width: 200px;