Browse Source

fix: 修复拖拽单元时状态未正确清除的问题

添加对拖拽类型的检查以防止错误触发课程更新
增加定时器清除逻辑确保状态正确重置
延迟清除dragType以避免操作冲突
lsc 6 days ago
parent
commit
a11cf2e089
1 changed files with 14 additions and 1 deletions
  1. 14 1
      src/components/pages/newCourse/addCourse.vue

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

@@ -12886,6 +12886,7 @@ export default {
       }
     },
     seleteCourseUpdate() {
+      if (this.dragType == "unit") return;
       let params = {
         cid: this.cid,
       };
@@ -14528,6 +14529,8 @@ export default {
       }
     },
     dragUnitStart(val, i) {
+      if (this.timer) clearTimeout(this.timer);
+      this.timer = null;
       this.dragType = "Unit";
       this.oldIndex = i;
       this.oldData = val;
@@ -14578,8 +14581,13 @@ export default {
             newItems.splice(this.newIndex, 0, this.oldData);
             this.unitJson = [...newItems];
             this.moveWork(1, this.newIndex, 0, 0, this.oldIndex, 0, 0);
+            console.log('dragType',this.dragType);
             this.typeIndex = "";
             this.newIndex = "";
+            setTimeout(() => {
+              this.dragType = ""; 
+            }, 5000);
+            // this.dragType = "";
             this.dragType = "";
             this.isdrag = "";
             this.updateWork();
@@ -14601,11 +14609,16 @@ export default {
         this.unitJson = [...newItems];
         this.typeIndex = "";
         this.newIndex = "";
-        this.dragType = "";
+        setTimeout(() => {
+          this.dragType = ""; 
+        }, 5000);
         this.isdrag = "";
         this.updateWork();
         this.$forceUpdate();
       }
+      this.timer = setTimeout(() => {
+        this.seleteCourseUpdate();
+      }, 5000);
     },
     getWorksCount(type, stage, task, tool) {
       return new Promise((resolve, reject) => {