lsc 3 月之前
父节点
当前提交
a8d1e8d8c6
共有 2 个文件被更改,包括 62 次插入16 次删除
  1. 59 16
      src/components/pages/aiAddCourse/addCourse.vue
  2. 3 0
      src/components/pages/aiAddCourse/evaList.vue

+ 59 - 16
src/components/pages/aiAddCourse/addCourse.vue

@@ -5230,6 +5230,7 @@
                               :languageSetting="languageSetting" 
                               :userid="userid" 
                               :aiJson="aiJson"
+                              @addAppendixEva="addAppendixEva"
                               @setEvaList="setEvaList"
                               @addCourseBehavior="addCourseBehavior"
                               v-if="panTaskElist() == 0 && pjIndex.indexOf(itemTool.tool[0]) != -1"
@@ -7881,6 +7882,7 @@ export default {
       course_info: "",
       stepShow: true,
       anLoading: [],
+      appendixFile: [],
     };
   },
   directives: {
@@ -9640,7 +9642,7 @@ export default {
       this.unitJson[0].chapterInfo[0].taskJson[this.lineCount].chapterData.unshift(json);
       // this.dialogVisibleAiCreateVideo = false;
     },
-    async createTeacherAn(index){
+    async createTeacherAn(index, type){
       // this.lineCount = index;
       let md = new MarkdownIt();
       if(this.courseState == 4){
@@ -9653,22 +9655,24 @@ export default {
         // }else {
         for(var i = 0; i < this.unitJson[0].chapterInfo[0].taskJson.length; i++){
           let _task = this.unitJson[0].chapterInfo[0].taskJson[i]
-          let name = _task.task+'-教案'
+          let name = `任务${i+1}`+_task.task+'-教案'
           let _html =  _task.taskDetail3 ? md.render(_task.taskDetail3) : ''
           await this.generate(name, _html, 0)
         }
         // }
       }else if(this.courseState == 5){
-        this.anLoading[index] = true
+        if(type != 2){
+          this.anLoading[index] = true
+        }
         if(index == 0 || index){
           let _task = this.unitJson[0].chapterInfo[0].taskJson[index]
-          let name = _task.task+'-教案'
+          let name = `任务${index+1}`+_task.task+'-教案'
           let _html =  _task.taskDetail3 ? md.render(_task.taskDetail3) : ''
-          await this.generate(name, _html, index)
+          await this.generate(name, _html, index,"", type)
         }else {
           for(var i = 0; i < this.unitJson[0].chapterInfo[0].taskJson.length; i++){
             let _task = this.unitJson[0].chapterInfo[0].taskJson[i]
-            let name = _task.task+'-教案'
+            let name = `任务${i+1}`+_task.task+'-教案'
             let _html =  _task.taskDetail3 ? md.render(_task.taskDetail3) : ''
             await this.generate(name, _html, i)
           }
@@ -9734,7 +9738,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           _this.taskAnCancelToken[index] = null
         });
     },
-    async generate(a, html, index, callback) {
+    async generate(a, html, index, callback, type) {
       // <html lang="en">
       
       // 将html文件中需要用到的数据挂载到store上
@@ -9786,7 +9790,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       //   await this.beforeUploadHtml(file, index, callback)
       //   return
       // }
-      await this.beforeUploadHtml(file, index, callback)
+      await this.beforeUploadHtml(file, index, callback, type)
 
     },
     async generateExport(a, html, index) {
@@ -9895,7 +9899,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
 
       });
     },
-    beforeUploadHtml(event, index, callback) {
+    beforeUploadHtml(event, index, callback, type) {
         var file = event;
         var credentials = {
             accessKeyId: "AKIATLPEDU37QV5CHLMH",
@@ -9950,12 +9954,31 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
                     // }else {
                       _index = index
                     // }
-                    _this.unitJson[0].chapterInfo[0].taskJson[_index].chapterData.unshift({
-                        name: file.name,
-                        url: data.Location,
-                        type: 3,
-                      })
-                      console.log(data.Location);
+                    if(type != 2){
+                      _this.unitJson[0].chapterInfo[0].taskJson[_index].chapterData.unshift({
+                        name: file.name,
+                        url: data.Location,
+                        type: 3,
+                      })
+                    }else{
+                      let fileName = file.name;
+                      let baseName = fileName.split('.').slice(0, -1).join('.'); // 获取不带扩展名的文件名
+                      let extension = fileName.split('.').pop(); // 获取文件扩展名
+                      let count = 1;
+                      // 检查文件名是否已存在
+                      while (_this.appendixFile.some(item => item.name === fileName)) {
+                        fileName = `${baseName} (${count}).${extension}`; // 修改文件名
+                        count++;
+                      }
+                      _this.appendixFile.unshift({
+                        name: fileName,
+                        url: data.Location,
+                        type: 3,
+                      })
+                      
+                    }
+
+                    console.log(data.Location);
                   }
                 });
         }
@@ -12671,6 +12694,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
             knowFileids2: this.knowFileids2,
             recordVideoText: this.recordVideoText,
             recordAudioUrl: this.recordAudioUrl,
+            appendixFile: this.appendixFile,
           }),
           iresearch: this.isFileSearch ? 1 : 2,
         },
@@ -12950,6 +12974,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
             knowFileids2: this.knowFileids2,
             recordVideoText: this.recordVideoText,
             recordAudioUrl: this.recordAudioUrl,
+            appendixFile: this.appendixFile,
           }),
           iresearch: this.isFileSearch ? 1 : 2,
         },
@@ -15136,6 +15161,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
                 this.knowFileids2 = (JSON.parse(res.data[0][0].setting).knowFileids2) ? JSON.parse(res.data[0][0].setting).knowFileids2 : [];
                 this.recordVideoText = (JSON.parse(res.data[0][0].setting).recordVideoText) ? JSON.parse(res.data[0][0].setting).recordVideoText : "";
                 this.recordAudioUrl = (JSON.parse(res.data[0][0].setting).recordAudioUrl) ? JSON.parse(res.data[0][0].setting).recordAudioUrl : "";
+                this.appendixFile = (JSON.parse(res.data[0][0].setting).appendixFile) ? JSON.parse(res.data[0][0].setting).appendixFile : [];
                 
                 if(this.targetCourseText2 || (!this.teacherCourseText)){
                   this.courseTextBool = true
@@ -15309,6 +15335,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
                 this.knowFileids2 = (JSON.parse(res.data[0][0].setting).knowFileids2) ? JSON.parse(res.data[0][0].setting).knowFileids2 : [];
                 this.recordVideoText = (JSON.parse(res.data[0][0].setting).recordVideoText) ? JSON.parse(res.data[0][0].setting).recordVideoText : "";
                 this.recordAudioUrl = (JSON.parse(res.data[0][0].setting).recordAudioUrl) ? JSON.parse(res.data[0][0].setting).recordAudioUrl : "";
+                this.appendixFile = (JSON.parse(res.data[0][0].setting).appendixFile) ? JSON.parse(res.data[0][0].setting).appendixFile : [];
 
                 if(this.targetCourseText2 || (!this.teacherCourseText)){
                   this.courseTextBool = true
@@ -17627,7 +17654,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
               tableContent += `| ${item.target} | ${item.detail} | ${item.rule.replaceAll('\n', ' ')} |\n`;
             });
             let html = md.render(tableContent);
-            let name = `任务${i+1}工具${j+1}的评价`
+            let name = `任务${i+1}工具${j+1}的评价.docx`
             let file = await this.generateExport2(name, html, i)
 
             zip.file(`${name}.docx`, file, { binary: true })
@@ -17649,6 +17676,21 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
         }, 2000);
       });
     },
+    async addAppendixEva(i, j){
+      let md = new MarkdownIt();
+
+      let tool = this.unitJson[0].chapterInfo[0].taskJson[i].toolChoose[j]
+      if(tool.eList && tool.eList.length){
+        let tableContent = '| 素养 | 评价标准 | 评价细则 |\n| --- | --- | --- |\n';
+        tool.eList.forEach(item => {
+          tableContent += `| ${item.target} | ${item.detail} | ${item.rule.replaceAll('\n', ' ')} |\n`;
+        });
+        let html = md.render(tableContent);
+        let name = `任务${i+1}工具${j+1}的评价.docx`
+        let file = await this.generateExport2(name, html, i)
+        this.beforeUploadHtml(file, 0, "", 2)
+      } 
+    },
     clickGenTT2(){
       if (this.courseName == "") {
         this.$message.error("请补充填写课程名称");
@@ -23391,6 +23433,7 @@ ${(_this.templateid == "4480d65a-1e48-11ef-bee5-005056b86db5" || _this.templatei
           }
           this.isTeacherTaskCancelToken2[_tindex2] = null
           callback ? callback() : ''
+          this.createTeacherAn(_tindex2, 2);
           this.saveCourse()
           return;
         } else {

+ 3 - 0
src/components/pages/aiAddCourse/evaList.vue

@@ -393,6 +393,9 @@ Language: ${this.getLang()}
 
                     console.log(elist);
                     _this.eList = elist
+                    setTimeout(() => {
+                        _this.$emit('addAppendixEva', _this.itemTaskIndex, _this.toolIndex)
+                    }, 100);
                     _this.$forceUpdate()
                 }
                 _this.cancelToken = null