lsc 2 years ago
parent
commit
53076aeab2
1 changed files with 13 additions and 10 deletions
  1. 13 10
      src/components/pages/addCourse.vue

+ 13 - 10
src/components/pages/addCourse.vue

@@ -593,7 +593,7 @@
                                   minwidth: 215px;
                                 "
                                 readonly="true"
-                                @click="selectAttText(index1)"
+                                @click="selectAttText(itemTaskIndex,index1)"
                               />
 
                               <div class="chapter_upload_ud" style="z-index: 99">
@@ -1486,8 +1486,10 @@ export default {
     },
     addAttText(i) {
       this.AttText = {};
-      this.AttText.index = i;
+      this.AttText.title = '';
+      this.taskCount = i
       this.AttTextType = 0;
+      this.$forceUpdate();
       this.dialogVisible6 = true;
     },
     beforeUpload1(event, type) {
@@ -2114,33 +2116,34 @@ export default {
     },
     addAttTextMessage() {
       this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
-        this.AttText.index
+        this.taskCount
       ].chapterData.push({
         name: this.AttText.title,
         url: this.AttText.text,
         type: 6,
       });
-      this.imgChange1(null, null, 6, this.AttText.index);
+      this.imgChange1(null, null, 6, this.taskCount);
       this.dialogVisible6 = false;
     },
-    selectAttText(i) {
-      this.dialogVisible6 = true;
+    selectAttText(itemTaskIndex,i) {
       this.AttText.title = this.unitJson[
         this.unitIndex
-      ].chapterInfo[0].taskJson[this.AttText.index].chapterData[i].name;
+      ].chapterInfo[0].taskJson[itemTaskIndex].chapterData[i].name;
       this.AttText.text = this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
-        this.AttText.index
+        itemTaskIndex
       ].chapterData[i].url;
+      this.taskCount = itemTaskIndex
       this.AttTextIndex = i;
       this.AttTextType = 1;
+      this.dialogVisible6 = true;
     },
     updateAttText() {
       this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
-        this.AttText.index
+        this.taskCount
       ].chapterData[this.AttTextIndex].name = this.AttText.title;
 
       this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
-        this.AttText.index
+        this.taskCount
       ].chapterData[this.AttTextIndex].url = this.AttText.text;
       this.dialogVisible6 = false;
     },