lsc 3 months ago
parent
commit
8c06306a9a

+ 44 - 4
src/components/pages/aiEasy2/addCourse.vue

@@ -5192,7 +5192,11 @@ export default {
     steps(newValue) {
       if (newValue == 4) {
         if(this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840'){
-           window.topU.U.UF.F.closeWindow( window.topU.$("#openCourseUpdate"))
+          try {
+            window.topU.U.UF.F.closeWindow(window.topU.$("#openCourseUpdate"));
+          } catch (error) {
+            
+          }
         }
         this.goTo(
           "/course?userid=" +
@@ -6884,6 +6888,8 @@ export default {
               JSON.parse(JSON.stringify(this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli]));
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate()
+            this.moveWork(3, i, j, tooli - 1, i, j, tooli);
+            this.updateWork(2);
           })
           .catch(() => {
             return;
@@ -6923,6 +6929,8 @@ export default {
               JSON.parse(JSON.stringify(this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli]));
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate()
+            this.moveWork(3, i, j, tooli + 1, i, j, tooli);
+            this.updateWork(2);
           })
           .catch(() => {
             return;
@@ -7083,7 +7091,7 @@ export default {
           console.error(err);
         });
     },
-    updateWork() {
+    updateWork(type = 1) {
       let cPan = 1;
       for (var i = 0; i < this.unitJson.length; i++) {
         for (
@@ -7176,7 +7184,9 @@ export default {
           // }
           this.number = this.nbOrder;
           this.courseId = this.cid;
-          this.steps = 4;
+          if(type == 1){
+            this.steps = 4;
+          }
         })
         .catch((err) => {
           this.$message.error("网络不佳");
@@ -10191,6 +10201,7 @@ export default {
               newItems[0].chapterData = chapterData
             }
             this.unitJson[this.unitIndex].chapterInfo[0].taskJson = [...newItems];
+            this.moveWork(2, 0, this.newIndex, 0, this.unitIndex, this.oldIndex, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.isdrag = "";
@@ -10224,6 +10235,7 @@ export default {
             this.newIndex = "";
             this.$forceUpdate()
         }
+        this.updateWork(2);
     },
     getWorksCount(type, stage, task, tool){
       return new Promise((resolve, reject) => {
@@ -10249,7 +10261,35 @@ export default {
           });
       });
       
-    }
+    },
+    moveWork(type, nstage, ntask, ntool, ostage, otask, otool) {
+      // type: int 类型
+      // nstage, ntask, ntool: 新目标位置(目标单元/任务/工具)
+      // ostage, otask, otool: 原始位置
+      // this.cid 课程id
+      let params = [
+        {
+          cid: this.cid,
+          nstage: nstage,
+          ntask: ntask,
+          ntool: ntool,
+          type: type,
+          ostage: ostage,
+          otask: otask,
+          otool: otool
+        }
+      ];
+      return this.ajax
+        .post(this.$store.state.api + "moveCourseWork", params)
+        .then(res => {
+          console.log(res);
+        })
+        .catch(err => {
+          console.error("移动作品失败,网络异常");
+          console.error(err);
+          throw err;
+        });
+    },
   },
   beforeDestroy() {
     clearTimeout(this.timer);

+ 6 - 2
src/components/pages/easy/addCourse.vue

@@ -8843,10 +8843,14 @@ export default {
           });
       }
     },
-    steps(newValue) {
+    steps(newValue, oldValue) {
       if (newValue == 4) {
         if (this.org == "16ace517-b5c7-4168-a9bb-a9e0035df840") {
-          window.topU.U.UF.F.closeWindow(window.topU.$("#openCourseUpdate"));
+          try {
+            window.topU.U.UF.F.closeWindow(window.topU.$("#openCourseUpdate"));            
+          } catch (error) {
+            
+          }
         }
         this.goTo(
           "/course?userid=" +

+ 5 - 1
src/components/pages/newCourse/addCourse.vue

@@ -8143,7 +8143,11 @@ export default {
           return;
         }
         if(this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840'){
-           window.topU.U.UF.F.closeWindow( window.topU.$("#openCourseUpdate"))
+          try {
+            window.topU.U.UF.F.closeWindow(window.topU.$("#openCourseUpdate"));
+          } catch (error) {
+            
+          }
         }
         this.goTo(
           "/course?userid=" +

+ 5 - 1
src/components/pages/pptEasy/addCourse.vue

@@ -2884,7 +2884,11 @@ export default {
     steps(newValue) {
       if (newValue == 4) {
         if (this.org == "16ace517-b5c7-4168-a9bb-a9e0035df840") {
-          window.topU.U.UF.F.closeWindow(window.topU.$("#openCourseUpdate"));
+          try {
+            window.topU.U.UF.F.closeWindow(window.topU.$("#openCourseUpdate"));
+          } catch (error) {
+            
+          }
         }
         this.goTo(
           "/course?userid=" +