lsc 2 yıl önce
ebeveyn
işleme
8b21c379f8
1 değiştirilmiş dosya ile 23 ekleme ve 2 silme
  1. 23 2
      src/components/pages/addCourse.vue

+ 23 - 2
src/components/pages/addCourse.vue

@@ -4488,13 +4488,34 @@ export default {
           for (let i = 0; i < unitJson.length; i++) {
             if (i == _unitIndex) {
               continue;
-            } else if (i > this.unitJson.length - 1) {
-              _unitJson.push(unitJson[i]);
             } else if (
               _unitJson[i].chapterInfo[0].chapterid ==
               unitJson[i].chapterInfo[0].chapterid
             ) {
               _unitJson[i] = unitJson[i];
+            } else if (
+              _unitJson[i].chapterInfo[0].chapterid !=
+              unitJson[i].chapterInfo[0].chapterid
+            ) {
+              _unitJson.splice(i, 0, unitJson[i]);
+            }
+            // else if (i > this.unitJson.length - 1) {
+            //   _unitJson.push(unitJson[i]);
+            // }
+          }
+          if (
+            _unitJson2[this.unitIndex].chapterInfo[0].chapterid !=
+            _unitJson[this.unitIndex].chapterInfo[0].chapterid
+          ) {
+            this.isDelete = 2;
+            for (let n = 0; n < _unitJson.length; n++) {
+              if (
+                _unitJson2[this.unitIndex].chapterInfo[0].chapterid ==
+                _unitJson[n].chapterInfo[0].chapterid
+              ) {
+                this.unitIndex = n;
+                break;
+              }
             }
           }
           if (index == 1) {