Browse Source

课堂观察

SanHQin 1 month ago
parent
commit
fe8fa200d1

+ 1 - 1
dist/index.html

@@ -32,7 +32,7 @@
       width: 100%;
       background: #e6eaf0;
       font-family: '黑体';
-    }</style><link href=./static/css/app.7f6f3b73c99f76935981f686bc33bd2f.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.161e82026ac2ae03ab6f.js></script><script type=text/javascript src=./static/js/vendor.bb486323f0fa002ba2e7.js></script><script type=text/javascript src=./static/js/app.8be4ed35b3f4a2fc2a29.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.a48046a97091992c49c965216837369a.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.161e82026ac2ae03ab6f.js></script><script type=text/javascript src=./static/js/vendor.bb486323f0fa002ba2e7.js></script><script type=text/javascript src=./static/js/app.00520943d9d01208c21b.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.a48046a97091992c49c965216837369a.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.a48046a97091992c49c965216837369a.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.00520943d9d01208c21b.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.00520943d9d01208c21b.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.161e82026ac2ae03ab6f.js.map


+ 238 - 143
src/components/pages/classroomObservation/dialog/batchCreationClassDialog.vue

@@ -60,7 +60,9 @@
                 >
               </div>
               <span>
-                <span @click="exportDoc" style="color:#409EFF">批量导出doc</span>
+                <span @click="exportDoc" style="color:#409EFF"
+                  >批量导出doc</span
+                >
               </span>
               <span>
                 <span @click="delSelectBtn" style="color: red;">删除</span>
@@ -300,31 +302,44 @@ export default {
               text: "文本转录",
               status: "0",
               progress: "0"
-            },
-            {
-              type: "getFileIds",
-              text: "获取文件fileid",
-              status: "0"
-            },
-            {
-                type:"getWordCloudMap",
-                text:"获取词云图",
-                status:"0"
-              },
-            {
-              type: "generateReport",
-              text: "生成报告",
-              status: "0",
-              progress: "0"
-            },
-            {
-              type: "createClass",
-              text: "创建课堂",
-              status: "0",
-              progress: "0"
             }
           ];
-        } else if (["audio/wav",'audio/x-m4a','audio/mpeg'].includes(i.type) ) {
+          if (data.jsonData.automaticCoding) {
+            data.jsonData.steps.push({
+              type: "automaticCoding",
+              text: "自动编码"
+            });
+          }
+
+          data.jsonData.steps.push(
+            ...[
+              {
+                type: "getFileIds",
+                text: "获取文件fileid",
+                status: "0"
+              },
+              {
+                type: "getWordCloudMap",
+                text: "获取词云图",
+                status: "0"
+              },
+              {
+                type: "generateReport",
+                text: "生成报告",
+                status: "0",
+                progress: "0"
+              },
+              {
+                type: "createClass",
+                text: "创建课堂",
+                status: "0",
+                progress: "0"
+              }
+            ]
+          );
+        } else if (
+          ["audio/wav", "audio/x-m4a", "audio/mpeg"].includes(i.type)
+        ) {
           data.jsonData.baseMessage.imageList.fileList = [
             {
               name: i.name,
@@ -364,9 +379,9 @@ export default {
                 status: "0"
               },
               {
-                type:"getWordCloudMap",
-                text:"获取词云图",
-                status:"0"
+                type: "getWordCloudMap",
+                text: "获取词云图",
+                status: "0"
               },
               {
                 type: "generateReport",
@@ -426,9 +441,9 @@ export default {
                 status: "0"
               },
               {
-                type:"getWordCloudMap",
-                text:"获取词云图",
-                status:"0"
+                type: "getWordCloudMap",
+                text: "获取词云图",
+                status: "0"
               },
               {
                 type: "generateReport",
@@ -469,7 +484,7 @@ export default {
                 if (_data.id) {
                   data.jsonData.fileData.fileObj = fileObj;
                   data.id = _data.id;
-                  this.dataList.push(data);
+                  this.dataList.unshift(data);
                 }
                 resolve();
               })
@@ -484,8 +499,8 @@ export default {
       Promise.all(promiseList)
         .then(res => {
           this.$message.success("创建成功");
-          if(!this.dataList.find(i =>i.status == 1)){
-            this.startTask(this.dataList.find(i =>i.status === "0").id);
+          if (!this.dataList.find(i => i.status == 1)) {
+            this.startTask(this.dataList.find(i => i.status === "0").id);
           }
         })
         .catch(err => {
@@ -530,21 +545,33 @@ export default {
     //修改课堂的baseMessage
     editBaseMessageSuccess({ editId, message }) {
       if (editId) {
-        let _editorBarData = null
+        let _editorBarData = null;
         let _transcriptionData = null;
-        if(this.dataList.find(i=>i.id===editId).jsonData.baseMessage.editorBarData){
-          _editorBarData = this.dataList.find(i=>i.id===editId).jsonData.baseMessage.editorBarData;
+        if (
+          this.dataList.find(i => i.id === editId).jsonData.baseMessage
+            .editorBarData
+        ) {
+          _editorBarData = this.dataList.find(i => i.id === editId).jsonData
+            .baseMessage.editorBarData;
         }
 
-        if(this.dataList.find(i=>i.id===editId).jsonData.baseMessage.transcriptionData){
-          _transcriptionData = this.dataList.find(i=>i.id===editId).jsonData.baseMessage.transcriptionData;
+        if (
+          this.dataList.find(i => i.id === editId).jsonData.baseMessage
+            .transcriptionData
+        ) {
+          _transcriptionData = this.dataList.find(i => i.id === editId).jsonData
+            .baseMessage.transcriptionData;
         }
         this.dataList.find(i => i.id === editId).jsonData.baseMessage = message;
-        if(_editorBarData){
-          this.dataList.find(i=>i.id===editId).jsonData.baseMessage.editorBarData = _editorBarData;
+        if (_editorBarData) {
+          this.dataList.find(
+            i => i.id === editId
+          ).jsonData.baseMessage.editorBarData = _editorBarData;
         }
-        if(_transcriptionData){
-          this.dataList.find(i=>i.id===editId).jsonData.baseMessage.transcriptionData = _transcriptionData;
+        if (_transcriptionData) {
+          this.dataList.find(
+            i => i.id === editId
+          ).jsonData.baseMessage.transcriptionData = _transcriptionData;
         }
         this.$forceUpdate();
         this.$refs.editBaseMessageDialogRef.close();
@@ -649,7 +676,7 @@ export default {
             delete dataCopy.jsonData.baseMessage.editorBarData.tableList;
           }
 
-          if(dataCopy.jsonData.errorMessage){
+          if (dataCopy.jsonData.errorMessage) {
             delete dataCopy.jsonData.errorMessage;
           }
 
@@ -793,7 +820,7 @@ export default {
           //按顺序处理任务
           let _step = _stepList[i];
           console.log(_step);
-          if(!this.nowDoTaskId.includes(_startData.id))break;
+          if (!this.nowDoTaskId.includes(_startData.id)) break;
           if (_step.status === "1") continue;
           if (_step.type === "uploadFile") continue;
           if (_step.type === "getVideoVoice") {
@@ -804,17 +831,18 @@ export default {
             ).jsonData.steps = _stepList;
             let _fileData = _startData.jsonData.fileData;
             let audioFile = await this.getVideoToVoiceAndUploadMixin(_fileData);
-            if(audioFile.data==3){
+            if (audioFile.data == 3) {
               this.dataList.find(
                 i => i.id === _startData.id
-              ).jsonData.errorMessage = {content:"视频提取音频失败",err:audioFile.err};
+              ).jsonData.errorMessage = {
+                content: "视频提取音频失败",
+                err: audioFile.err
+              };
 
-              this.dataList.find(
-                i => i.id === _startData.id
-              ).status = "3"
+              this.dataList.find(i => i.id === _startData.id).status = "3";
               break;
             }
-            if(!this.nowDoTaskId.includes(_startData.id))break;
+            if (!this.nowDoTaskId.includes(_startData.id)) break;
             _startData.jsonData.fileData.videoUrl = _fileData.url;
             _startData.jsonData.fileData.fileObj = audioFile.fileObj;
             _startData.jsonData.fileData.url = audioFile.audioUrl.Location;
@@ -835,8 +863,8 @@ export default {
                 this.dataList.find(i => i.id === _startData.id).jsonData
               )
             );
-            _startData.jsonData.fileData.fileObj = audioFile.fileObj;//防止文件因为json失效
-            console.log("data👉",JSON.parse(JSON.stringify(_startData)))
+            _startData.jsonData.fileData.fileObj = audioFile.fileObj; //防止文件因为json失效
+            console.log("data👉", JSON.parse(JSON.stringify(_startData)));
             console.log(`${_startData.id}:已完成视频转音频`);
           } else if (_step.type === "transcription") {
             //文本转录
@@ -848,7 +876,7 @@ export default {
                 i => i.id === _startData.id
               ).jsonData.steps = _stepList;
               let { editorBarData } = await this.getTextContentMixin(fileData);
-              if(!this.nowDoTaskId.includes(_startData.id))break;
+              if (!this.nowDoTaskId.includes(_startData.id)) break;
               this.dataList.find(
                 i => i.id === _startData.id
               ).jsonData.baseMessage.editorBarData = editorBarData;
@@ -863,9 +891,11 @@ export default {
                 )
               );
               console.log(`${_startData.id}:已获取转录文稿(txt)`);
-              console.log("data👉",JSON.parse(JSON.stringify(_startData)))
+              console.log("data👉", JSON.parse(JSON.stringify(_startData)));
             } else if (
-              ['video/mp4','audio/wav','audio/x-m4a','audio/mpeg'].includes(fileData.type)
+              ["video/mp4", "audio/wav", "audio/x-m4a", "audio/mpeg"].includes(
+                fileData.type
+              )
             ) {
               //mp4与wav文件
               _stepList[i].status = "2";
@@ -874,26 +904,30 @@ export default {
               ).jsonData.steps = _stepList;
 
               let _file = _startData.jsonData.fileData.fileObj;
-              if(!_file && JSON.stringify(_file)!="{}"){
-                let fileBody = await this.getFileBody(_startData.jsonData.fileData.url);
-                let _type = _startData.jsonData.fileData.type.split('/')[1];
-                if(_type=='x-m4a'){
-                  _type="m4a"
-                }else if(_type=="mpeg"){
-                  _type = "mp3"
+              if (!_file && JSON.stringify(_file) != "{}") {
+                let fileBody = await this.getFileBody(
+                  _startData.jsonData.fileData.url
+                );
+                let _type = _startData.jsonData.fileData.type.split("/")[1];
+                if (_type == "x-m4a") {
+                  _type = "m4a";
+                } else if (_type == "mpeg") {
+                  _type = "mp3";
                 }
-                _file = new File([fileBody.data], `audio.${_type}`, { type: _startData.jsonData.fileData.type });
+                _file = new File([fileBody.data], `audio.${_type}`, {
+                  type: _startData.jsonData.fileData.type
+                });
               }
 
-              if (["audio/x-m4a","audio/mpeg"].includes(_file.type)) {
+              if (["audio/x-m4a", "audio/mpeg"].includes(_file.type)) {
                 let _data = await this.audioToWavMixin(_file);
-                if(_data!==1){
+                if (_data !== 1) {
                   _file = _data.data;
-                }else{
-                  console.log("报错👉",_data)
+                } else {
+                  console.log("报错👉", _data);
                 }
               }
-              console.log("转录文件",_file)
+              console.log("转录文件", _file);
 
               let {
                 transcriptionContent,
@@ -921,6 +955,51 @@ export default {
             }
           } else if (_step.type === "automaticCoding") {
             if (_startData.jsonData.automaticCoding) {
+              // const fileData = _startData.jsonData.fileData;
+              // if (fileData.type === "text/plain") {
+              //   _stepList[i].status = "2";
+              //   this.dataList.find(
+              //     i => i.id === _startData.id
+              //   ).jsonData.steps = _stepList;
+              //   //选择了字段编码
+              //   let _content =
+              //     _startData.jsonData.baseMessage.editorBarData.content;
+              //   let _tableList =
+              //     _startData.jsonData.baseMessage.editorBarData.table;
+              //   if (!_content) {
+              //     _content = await this.getFile(
+              //       _startData.jsonData.baseMessage.editorBarData.url
+              //     );
+              //     _content = _content.data;
+              //     this.dataList.find(
+              //       i => i.id === _startData.id
+              //     ).jsonData.baseMessage.editorBarData.content = _content;
+              //   }
+
+              //   if (!_tableList) {
+              //     let _result = [];
+              //     let _data = _content;
+              //     let _div = document.createElement("div");
+              //     _div.innerHTML = _data;
+              //     let _tableRows = _div.querySelectorAll(`table tbody tr`);
+              //     _tableRows.forEach((i, index) => {
+              //       if (index == 0) return;
+              //       let obj = {
+              //         index: i.cells[0].textContent,
+              //         startTime: i.cells[1].textContent,
+              //         endTime: i.cells[2].textContent,
+              //         value: i.cells[3].textContent,
+              //         time: i.cells[4].textContent,
+              //         role: i.cells[5] ? i.cells[5].textContent : "",
+              //         code: i.cells[6] ? i.cells[6].textContent : ""
+              //       };
+              //       _result.push(obj);
+              //     });
+
+              //     _tableList = _result;
+              //   }
+              // } else {
+              const fileData = _startData.jsonData.fileData;
               _stepList[i].status = "2";
               this.dataList.find(
                 i => i.id === _startData.id
@@ -939,7 +1018,7 @@ export default {
                   i => i.id === _startData.id
                 ).jsonData.baseMessage.editorBarData.content = _content;
               }
-              if(!_tableList){
+              if (!_tableList) {
                 let _result = [];
                 let _data = _content;
                 let _div = document.createElement("div");
@@ -961,13 +1040,26 @@ export default {
 
                 _tableList = _result;
               }
+              let editorBarData = "";
 
-              let { editorBarData} = await this.automaticCodingMixin({ tableList: _tableList});
-              if(!this.nowDoTaskId.includes(_startData.id))break;
+              if (fileData.type == "text/plain") {
+                let _result = await this.automaticCodingForTextMixin({
+                  tableList: _tableList
+                });
+                editorBarData = _result.editorBarData;
+              } else {
+                let _result = await this.automaticCodingMixin({
+                  tableList: _tableList
+                });
+                editorBarData = _result.editorBarData;
+              }
+
+              if (!this.nowDoTaskId.includes(_startData.id)) break;
 
               _stepList[i].status = "1";
 
-              this.dataList.find(i => i.id === _startData.id).jsonData = _startData.jsonData;
+              this.dataList.find(i => i.id === _startData.id).jsonData =
+                _startData.jsonData;
               this.dataList.find(
                 i => i.id === _startData.id
               ).jsonData.baseMessage.editorBarData = editorBarData;
@@ -981,8 +1073,9 @@ export default {
                   this.dataList.find(i => i.id === _startData.id).jsonData
                 )
               );
-              console.log("data👉",JSON.parse(JSON.stringify(_startData)))
+              console.log("data👉", JSON.parse(JSON.stringify(_startData)));
               console.log(`${_startData.id}:已获完成自动编码`);
+              // }
             } else {
               _stepList[i].status = "1";
               this.dataList.find(
@@ -1003,7 +1096,7 @@ export default {
             ).jsonData.steps = _stepList;
             let _fileData = _startData.jsonData.baseMessage.editorBarData;
             let { fileId } = await this.getFileIdMixin(_fileData.url);
-            if(!this.nowDoTaskId.includes(_startData.id))break;
+            if (!this.nowDoTaskId.includes(_startData.id)) break;
             this.dataList.find(
               i => i.id === _startData.id
             ).jsonData.file_ids = fileId;
@@ -1017,25 +1110,24 @@ export default {
                 this.dataList.find(i => i.id === _startData.id).jsonData
               )
             );
-            console.log("data👉",JSON.parse(JSON.stringify(_startData)))
+            console.log("data👉", JSON.parse(JSON.stringify(_startData)));
             console.log(`${_startData.id}:已获取fileId`);
-          }else if(_step.type=="getWordCloudMap"){
+          } else if (_step.type == "getWordCloudMap") {
             //文件获取fileId
             _stepList[i].status = "2";
             this.dataList.find(
               i => i.id === _startData.id
             ).jsonData.steps = _stepList;
 
-
             let _fileData = _startData.jsonData.baseMessage.editorBarData;
 
             let _content = await this.getFile(_fileData.url);
 
-            let _result = await this.getWordCloudMapMixin( _content.data);
+            let _result = await this.getWordCloudMapMixin(_content.data);
 
-            this.dataList.find(
-              i => i.id === _startData.id
-            ).jsonData.baseMessage.imageList.NephogramList.push(_result);
+            this.dataList
+              .find(i => i.id === _startData.id)
+              .jsonData.baseMessage.imageList.NephogramList.push(_result);
 
             _stepList[i].status = "1";
             this.dataList.find(
@@ -1104,7 +1196,8 @@ export default {
                     assistantData: _assistantData,
                     baseMessage: _startData.jsonData.baseMessage
                   });
-                  if(!this.nowDoTaskId.includes(_startData.id))return resolve();
+                  if (!this.nowDoTaskId.includes(_startData.id))
+                    return resolve();
                   if (data.data == 1) {
                     if (_num < _maxNum) {
                       //重试
@@ -1123,16 +1216,15 @@ export default {
 
             await Promise.all(promises).then(() => {
               console.log(`${_startData.id}:已完成分析获取`);
-              if(!this.nowDoTaskId.includes(_startData.id))return;
-              console.log("data👉",JSON.parse(JSON.stringify(_startData)))
+              if (!this.nowDoTaskId.includes(_startData.id)) return;
+              console.log("data👉", JSON.parse(JSON.stringify(_startData)));
               console.log(_startData.jsonData.analysisList);
               _stepList[i].status = "1";
               this.dataList.find(
                 i => i.id === _startData.id
               ).jsonData.steps = _stepList;
-              this.dataList.find(
-                i => i.id === _startData.id
-              ).jsonData = _startData.jsonData
+              this.dataList.find(i => i.id === _startData.id).jsonData =
+                _startData.jsonData;
 
               this.updateTask(_startData.id);
               _startData.jsonData = JSON.parse(
@@ -1141,7 +1233,7 @@ export default {
                 )
               );
             });
-            if(!this.nowDoTaskId.includes(_startData.id))break;
+            if (!this.nowDoTaskId.includes(_startData.id)) break;
           } else if (_step.type === "createClass") {
             //创建课堂
             _stepList[i].status = "2";
@@ -1152,18 +1244,18 @@ export default {
             //创建课堂   赋值好fileid   替换创建后课堂的基础数据  继续下一个任务
             let newOption = await this.createClassMixin(_startData.jsonData);
 
-            if([1,2,3].includes(newOption.data)){
+            if ([1, 2, 3].includes(newOption.data)) {
               this.dataList.find(
                 i => i.id === _startData.id
-              ).jsonData.errorMessage = {content:"创建课堂失败",err:data.err};
+              ).jsonData.errorMessage = {
+                content: "创建课堂失败",
+                err: data.err
+              };
 
-              this.dataList.find(
-                i => i.id === _startData.id
-              ).status = "3"
+              this.dataList.find(i => i.id === _startData.id).status = "3";
               break;
-
             }
-            if(!this.nowDoTaskId.includes(_startData.id))break;
+            if (!this.nowDoTaskId.includes(_startData.id)) break;
 
             this.$emit("addNewCourseOption", newOption.data);
             this.dataList.find(i => i.id === _startData.id).jsonData.createId =
@@ -1195,7 +1287,7 @@ export default {
       if (_waitTask) {
         //暂停这个任务,
         this.dataList.find(i => i.id === id).status = "0";
-        this.nowDoTaskId = this.nowDoTaskId.filter(i=>i!==id);
+        this.nowDoTaskId = this.nowDoTaskId.filter(i => i !== id);
         // 开始另一个任务
         this.startTask(_waitTask.id);
       } else {
@@ -1205,19 +1297,20 @@ export default {
     },
     //停止任务
     stopTask(id) {
-      let stopTask = this.dataList.find(i=>i.id===id);
-      if(stopTask.status==='0'){
+      let stopTask = this.dataList.find(i => i.id === id);
+      if (stopTask.status === "0") {
         this.dataList.find(i => i.id === id).status = "3";
-      }if(stopTask.status==='1'){
+      }
+      if (stopTask.status === "1") {
         this.dataList.find(i => i.id === id).status = "3";
-        this.nowDoTaskId = this.nowDoTaskId.filter(i=>i!==id);
+        this.nowDoTaskId = this.nowDoTaskId.filter(i => i !== id);
       }
 
-      console.log(stopTask)
+      console.log(stopTask);
 
       let _waitTask = this.dataList.find(i => i.status === "0");
-      console.log(_waitTask)
-      if(_waitTask){
+      console.log(_waitTask);
+      if (_waitTask) {
         // 开始另一个任务
         this.startTask(_waitTask.id);
       }
@@ -1233,66 +1326,69 @@ export default {
       //   this.dataList.find(i => i.id === id).status = "3";
       // }
     },
-    goToEdit(id){
-      let _data = this.dataList.find(i=>i.id===id);
-      if(_data){
+    goToEdit(id) {
+      let _data = this.dataList.find(i => i.id === id);
+      if (_data) {
         let createId = _data.jsonData.createId;
-        this.$emit("changeClass",createId);
+        this.$emit("changeClass", createId);
         this.close();
       }
     },
     test() {
       this.testMixin();
     },
-    exportDoc(){
+    exportDoc() {
       let _exportList = this.dataList.filter(
         i =>
           this.selectList.includes(i.id) &&
           (this.selectStatus === "99" ||
             this.statusList
               .find(i2 => i2.value === this.selectStatus)
-              .allow.includes(i.status)) && i.status == "2"
+              .allow.includes(i.status)) &&
+          i.status == "2"
       );
 
-      if (_exportList.length <= 0) return this.$message.info("请先选择已经完成的任务列表");
-
+      if (_exportList.length <= 0)
+        return this.$message.info("请先选择已经完成的任务列表");
 
       let promise = [];
 
       let _notify = this.$notify.info({
-          title: '提示',
-          message: '正在批量导出word中,请稍等...',
-          duration: 0,
-          showClose: false,
-        });
-
-      _exportList.forEach((i,index)=>{
-        i.jsonData.baseMessage.courseName = i.jsonData.baseMessage.courseName+"_"+index;
-        promise.push(this.getDocFnPromise(i))
-      })
+        title: "提示",
+        message: "正在批量导出word中,请稍等...",
+        duration: 0,
+        showClose: false
+      });
 
-      Promise.all(promise).then(res=>{
-        _notify.close();
-        console.log(res)
-        if(res.length==1){
-          saveAs(res[0], `${res[0].name}`);
-          this.$message.success("导出报告成功")
-        }else if(res.length>1){
-          const zip = new JSZip();
-          res.forEach(i=>{
-            zip.file(`${i.name}`, i, { binary: true });
-          })
-          zip.generateAsync({ type: "blob" }).then(content => {
-            // 生成二进制流
-            saveAs(content, `课堂观察报告.zip`); // 利用file-saver保存文件  自定义文件名
-          });
-          this.$message.success("导出报告成功")
-        }
-      }).catch(err=>{
-        console.log("err",err)
-      })
+      _exportList.forEach((i, index) => {
+        i.jsonData.baseMessage.courseName =
+          i.jsonData.baseMessage.courseName + "_" + index;
+        promise.push(this.getDocFnPromise(i));
+      });
 
-    },
+      Promise.all(promise)
+        .then(res => {
+          _notify.close();
+          console.log(res);
+          if (res.length == 1) {
+            saveAs(res[0], `${res[0].name}`);
+            this.$message.success("导出报告成功");
+          } else if (res.length > 1) {
+            const zip = new JSZip();
+            res.forEach(i => {
+              zip.file(`${i.name}`, i, { binary: true });
+            });
+            zip.generateAsync({ type: "blob" }).then(content => {
+              // 生成二进制流
+              saveAs(content, `课堂观察报告.zip`); // 利用file-saver保存文件  自定义文件名
+            });
+            this.$message.success("导出报告成功");
+          }
+        })
+        .catch(err => {
+          console.log("err", err);
+        });
+    }
   },
   mounted() {
     this.getTaskList();
@@ -1464,7 +1560,6 @@ export default {
   display: flex;
   align-items: center;
   justify-content: space-between;
-
 }
 
 .b_b_o_right > div {

+ 19 - 1
src/components/pages/classroomObservation/dialog/uploadFileToCreateClassDialog.vue

@@ -75,8 +75,12 @@
                   />
                 </div>
               </div>
+              <div class="fl_item addFile" v-if="fileList.length > 0" @click="addFile()">
+              <span>继续添加文件</span>
             </div>
-            <div class="b_m_l_noFile" v-else @click="addFile()">
+            </div>
+
+            <div class="b_m_l_noFile" v-if="fileList.length==0" @click="addFile()">
               <img
                 src="../../../../assets/icon/classroomObservation/file_processing.svg"
               />
@@ -664,4 +668,18 @@ export default {
 .uploadingProgress {
   background-color: rgba(54, 129, 252, 1);
 }
+
+.addFile{
+  width: 95%;
+  min-height: 45px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+  margin-top: 10px;
+  box-sizing: border-box;
+  border: dashed  1px #969BA3;
+  border-radius: 10px;
+  margin:0 auto;
+}
 </style>

+ 152 - 1
src/components/pages/classroomObservation/tools/mixin.js

@@ -1269,7 +1269,7 @@ CH:${_CH}
 						</tr>`
           })
 
-          tableContent += `<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>`
+          // tableContent += `<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>`
 
           var blob = new Blob([tableContent], { type: "text/plain;charset=utf-8" });
           blob.lastModifiedDate = new Date();
@@ -1442,6 +1442,157 @@ CH:${_CH}
         })
       })
 
+    },
+    //文本的自动编码
+    automaticCodingForTextMixin(data) {
+      return new Promise(async (resolve) => {
+        let { tableList } = data;
+
+        let roleObj = {};
+        let tableContent = `<table
+	border="0"
+	width="100%"
+	cellpadding="0"
+	cellspacing="0"
+	style="text-align: center"
+>
+	<tbody>
+		<tr>
+			<th>序号</th>
+			<th>开始时间</th>
+			<th>结束时间</th>
+			<th>发言内容</th>
+			<th>时长</th>
+			<th>说话人身份</th>
+			<th>行为编码</th>
+	</tr>`;
+
+        console.log("说话人身份编码开始")
+        // 说话人身份编码
+        while (tableList.some(i => i.role == '')) {
+          let _ajaxList = tableList.filter(i => i.role == '').slice(0, 10);
+          console.log(`说话人身份编码:`, _ajaxList)
+          const params = {
+            inputs: {
+              options: "老师,学生",
+              rows: JSON.stringify(
+                _ajaxList.map(i => {
+                  return { content: i.value, role: i.role };
+                })
+              )
+            },
+            response_mode: "blocking",
+            user: this.userId
+          };
+
+          let roleRes = await this.getWavRoleList(params);
+          if (roleRes.data === 1) continue;;
+          let _roleResult = roleRes.data.data.outputs.result;
+
+          _ajaxList.forEach((item, index) => {
+            let _findIndex = tableList.findIndex(i => i.index === item.index);
+            if (_findIndex != -1) {
+              tableList[_findIndex].role = _roleResult[index];
+            }
+          })
+          // let _numRole = [];
+
+          // _roleResult.forEach((txt, index) => {
+          //   let _oldRole = _ajaxList[index].role;
+          //   if (_numRole.map(i => i.role).includes(_oldRole)) {
+          //     let _findIndex = _numRole.findIndex(
+          //       i => i.role == _oldRole
+          //     );
+          //     if (txt == "学生") {
+          //       _numRole[_findIndex].s += 1;
+          //     } else if (txt == "老师") {
+          //       _numRole[_findIndex].t += 1;
+          //     }
+          //   } else {
+          //     if (txt == "学生") {
+          //       _numRole.push({ role: _oldRole, t: 0, s: 1 });
+          //     } else if (txt == "老师") {
+          //       _numRole.push({ role: _oldRole, t: 1, s: 0 });
+          //     }
+          //   }
+          // });
+
+          //根据数量判断是老师还是学生
+          // _numRole.forEach(i => {
+          //   if (i.t > i.s) {
+          //     roleObj[i.role] = "老师";
+          //   } else if (i.t < i.s) {
+          //     roleObj[i.role] = "学生";
+          //   }
+          // });
+
+          //已经有的role
+          // let roleKeys = Object.keys(roleObj);
+
+          // tableList.forEach(i => {
+          //   if (roleKeys.includes(i.role)) {
+          //     i.role = roleObj[i.role];
+          //   }
+          // });
+        }
+        console.log("说话人身份编码完成")
+
+        console.log("allRole",tableList.map(i=>i.role))
+
+        console.log("说话人行为编码开始")
+        //说话人行为编码
+        while (tableList.some(i => i.code == "" && i.role.indexOf("Guest") == -1 && i.value != "")) {
+          let _ajaxList = tableList.filter(i => i.code == "" && i.role.indexOf("Guest") == -1 && i.value != "").slice(0, 10);
+          console.log(`说话人行为编码:`, _ajaxList)
+          let params = {
+            inputs: {
+              rows: JSON.stringify(
+                _ajaxList.map(i => ({
+                  content: i.value,
+                  role: i.role
+                }))
+              ),
+              options: "老师讲课,老师提问或点名,老师板书或操作,老师评价或反馈,老师其他,学生发言,学生小组活动,学生自主学习,学生汇报分享,学生其他",
+              attention: "- 先根据说话人角色判断,再在对应角色的选项中选择选项\n- 如果没有合适的选项,默认使用`老师其他`或者`学生其他`"
+            },
+            response_mode: "blocking",
+            user: this.userId
+          };
+
+          let _codeRes = await this.getBehavioralCoding(params)
+          if (_codeRes.data === 1) continue;
+          const _codeResult = _codeRes.data.data.outputs.result;
+
+          _ajaxList.forEach((item, index) => {
+            let _findIndex = tableList.findIndex(i => i.index === item.index);
+            if (_findIndex != -1) {
+              tableList[_findIndex].code = _codeResult[index];
+            }
+          })
+        }
+        console.log("说话人行为编码完成")
+
+        tableList.forEach((item, index) => {
+          tableContent += `<tr>
+          <td>${index + 1}</td>
+          <td>${item.startTime}</td>
+          <td>${item.endTime}</td>
+          <td>${item.value}</td>
+          <td>${item.time}</td>
+          <td>${item.role}</td>
+          <td>${item.code}</td>
+        </tr>`
+        })
+        // tableContent += `<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>`
+
+        var blob = new Blob([tableContent], { type: "text/plain;charset=utf-8" });
+        blob.lastModifiedDate = new Date();
+        blob.name = `classroomObservation.txt`;
+        this.uploadFileMixin(blob).then(upload => {
+          resolve({ editorBarData: { type: "0", url: upload.Location, content: tableContent, tableList: tableList } })
+        })
+      })
+
     },
     getWavRoleList(params) {
       return new Promise((resolve, reject) => {

Some files were not shown because too many files changed in this diff