lsc 3 月之前
父節點
當前提交
e9c04c8bca

+ 38 - 4
src/components/pages/aiAddCourse/addCourse.vue

@@ -13224,7 +13224,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -13248,6 +13248,8 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
               );
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate();
+            this.moveWork(3, i, j, tooli - 1, i, j, tooli);
+            this.updateWork();
           })
           .catch(() => {
             return;
@@ -13280,7 +13282,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -13304,6 +13306,8 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
               );
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate();
+            this.moveWork(3, i, j, tooli + 1, i, j, tooli);
+            this.updateWork();
           })
           .catch(() => {
             return;
@@ -17844,7 +17848,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       );
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换任务顺序将删除所有工具的提交成果,是否继续此操作?",
+          "切换任务顺序将一起移动所有工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -17893,6 +17897,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
                 ...newItems,
               ];
             }
+            this.moveWork(2, this.checkUnitIndex, this.newIndex, 0, this.oldUnitIndex, this.oldIndex, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.dragType = "";
@@ -17994,7 +17999,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       console.log(count1, count2);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换阶段顺序将删除所有工具的提交成果,是否继续此操作?",
+          "切换阶段顺序将一起移动所有任务的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -18009,6 +18014,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
             // 在列表中目标位置增加新的节点
             newItems.splice(this.newIndex, 0, this.oldData);
             this.unitJson = [...newItems];
+            this.moveWork(1, this.newIndex, 0, 0, this.oldIndex, 0, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.dragType = "";
@@ -18062,6 +18068,34 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           });
       });
     },
+    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;
+        });
+    },
     getTwoType(id) {
       this.twoJson = [];
       var array = this.CourseTypeJson1[

+ 38 - 4
src/components/pages/aiEasy/addCourse.vue

@@ -12421,7 +12421,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -12445,6 +12445,8 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
               );
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate();
+            this.moveWork(3, i, j, tooli - 1, i, j, tooli);
+            this.updateWork();
           })
           .catch(() => {
             return;
@@ -12477,7 +12479,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -12501,6 +12503,8 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
               );
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate();
+            this.moveWork(3, i, j, tooli + 1, i, j, tooli);
+            this.updateWork();
           })
           .catch(() => {
             return;
@@ -17050,7 +17054,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       );
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换任务顺序将删除所有工具的提交成果,是否继续此操作?",
+          "切换任务顺序将一起移动所有工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -17099,6 +17103,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
                 ...newItems,
               ];
             }
+            this.moveWork(2, this.checkUnitIndex, this.newIndex, 0, this.oldUnitIndex, this.oldIndex, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.dragType = "";
@@ -17200,7 +17205,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       console.log(count1, count2);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换阶段顺序将删除所有工具的提交成果,是否继续此操作?",
+          "切换阶段顺序将一起移动所有任务的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -17215,6 +17220,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
             // 在列表中目标位置增加新的节点
             newItems.splice(this.newIndex, 0, this.oldData);
             this.unitJson = [...newItems];
+            this.moveWork(1, this.newIndex, 0, 0, this.oldIndex, 0, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.dragType = "";
@@ -17268,6 +17274,34 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           });
       });
     },
+    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;
+        });
+    },
     getTwoType(id) {
       this.twoJson = [];
       var array = this.CourseTypeJson1[

+ 40 - 3
src/components/pages/easy/addCourse.vue

@@ -10592,7 +10592,7 @@ export default {
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -10617,6 +10617,8 @@ export default {
             );
             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;
@@ -10636,6 +10638,7 @@ export default {
         );
         this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
         this.$forceUpdate();
+        this.updateWork();
       }
     },
     async downTool(e, i, j, tooli) {
@@ -10650,7 +10653,7 @@ export default {
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -10675,6 +10678,8 @@ export default {
             );
             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;
@@ -10694,6 +10699,7 @@ export default {
         );
         this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
         this.$forceUpdate();
+        this.updateWork();
       }
     },
     addWork(gotype) {
@@ -14114,7 +14120,7 @@ export default {
       let count2 = await this.getWorksCount(2, 0, this.oldIndex, 0);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换任务顺序将删除所有工具的提交成果,是否继续此操作?",
+          "切换任务顺序将一起移动所有工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -14144,10 +14150,12 @@ export default {
             this.unitJson[this.unitIndex].chapterInfo[0].taskJson = [
               ...newItems
             ];
+            this.moveWork(2, 0, this.newIndex, 0, 0, this.oldIndex, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.isdrag = "";
             this.$forceUpdate();
+            this.updateWork(2);
           })
           .catch(() => {
             this.typeIndex = "";
@@ -14178,6 +14186,7 @@ export default {
         this.typeIndex = "";
         this.newIndex = "";
         this.$forceUpdate();
+        this.updateWork();
       }
     },
     getWorksCount(type, stage, task, tool) {
@@ -14204,6 +14213,34 @@ 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;
+        });
+    },
     openCodeEditor(type,val, unitIndex,itemTaskIndex = 0,index1){
       console.log('openCodeEditor',type,val,unitIndex,itemTaskIndex,index1);
 

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

@@ -10323,7 +10323,7 @@ export default {
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -10347,6 +10347,8 @@ export default {
               );
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate();
+            this.moveWork(3, i, j, tooli - 1, i, j, tooli);
+            this.updateWork();
           })
           .catch(() => {
             return;
@@ -10379,7 +10381,7 @@ export default {
       let count2 = await this.getWorksCount(3, i, j, tooli);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换工具顺序将删除此工具的提交成果,是否继续此操作?",
+          "切换工具顺序将一起移动此工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -10403,6 +10405,8 @@ export default {
               );
             this.unitJson[i].chapterInfo[0].taskJson[j].toolChoose[tooli] = a;
             this.$forceUpdate();
+            this.moveWork(3, i, j, tooli + 1, i, j, tooli);
+            this.updateWork();
           })
           .catch(() => {
             return;
@@ -13788,7 +13792,7 @@ export default {
       } else {
         this.unitJson[stageIndex].chapterInfo[0].taskJson[i].toolOpen = true;
       }
-      if(this.this.cid){
+      if(this.cid){
         this.updateWork3(stageIndex);
 
       }
@@ -14403,7 +14407,7 @@ export default {
       );
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换任务顺序将删除所有工具的提交成果,是否继续此操作?",
+          "切换任务顺序将一起移动所有工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -14441,6 +14445,7 @@ export default {
                 ...newItems,
               ];
             }
+            this.moveWork(2, this.checkUnitIndex, this.newIndex, 0, this.oldUnitIndex, this.oldIndex, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.dragType = "";
@@ -14531,7 +14536,7 @@ export default {
       console.log(count1, count2);
       if (count1 > 0 || count2 > 0) {
         this.$confirm(
-          "切换阶段顺序将删除所有工具的提交成果,是否继续此操作?",
+          "切换阶段顺序将一起移动所有工具的提交成果,是否继续此操作?",
           "提示",
           {
             confirmButtonText: "确定",
@@ -14546,6 +14551,7 @@ export default {
             // 在列表中目标位置增加新的节点
             newItems.splice(this.newIndex, 0, this.oldData);
             this.unitJson = [...newItems];
+            this.moveWork(1, this.newIndex, 0, 0, this.oldIndex, 0, 0);
             this.typeIndex = "";
             this.newIndex = "";
             this.dragType = "";
@@ -14599,6 +14605,34 @@ 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;
+        });
+    },
     getTwoType(id) {
       this.twoJson = [];
       var array = this.CourseTypeJson1[