lsc 2 years ago
parent
commit
011856ed3e
1 changed files with 8 additions and 8 deletions
  1. 8 8
      src/components/pages/addCourse.vue

+ 8 - 8
src/components/pages/addCourse.vue

@@ -4487,22 +4487,22 @@ export default {
 
 
           for (let i = 0; i < unitJson.length; i++) {
           for (let i = 0; i < unitJson.length; i++) {
             if (
             if (
-              _unitJson[i].chapterInfo[0].chapterid ==
-              unitJson[i].chapterInfo[0].chapterid
+              i < _unitJson.length - 1 &&
+              _unitJson[i].chapterInfo[0].chapterid !=
+                unitJson[i].chapterInfo[0].chapterid
             ) {
             ) {
-              _unitJson[i] = unitJson[i];
+              _unitJson.splice(i, 0, unitJson[i]);
+            } else if (i > _unitJson.length - 1) {
+              _unitJson.push(unitJson[i]);
             } else if (
             } else if (
-              _unitJson[i].chapterInfo[0].chapterid !=
+              _unitJson[i].chapterInfo[0].chapterid ==
               unitJson[i].chapterInfo[0].chapterid
               unitJson[i].chapterInfo[0].chapterid
             ) {
             ) {
-              _unitJson.splice(i, 0, unitJson[i]);
+              _unitJson[i] = unitJson[i];
             }
             }
             // if (i == _unitIndex) {
             // if (i == _unitIndex) {
             //   continue;
             //   continue;
             // } else
             // } else
-            // else if (i > this.unitJson.length - 1) {
-            //   _unitJson.push(unitJson[i]);
-            // }
           }
           }
           if (
           if (
             _unitJson2[this.unitIndex].chapterInfo[0].chapterid !=
             _unitJson2[this.unitIndex].chapterInfo[0].chapterid !=