Quellcode durchsuchen

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

lsc vor 8 Monaten
Ursprung
Commit
0499139e8e

+ 4 - 0
dist/index.html

@@ -32,7 +32,11 @@
       width: 100%;
       background: #e6eaf0;
       font-family: '黑体';
+<<<<<<< HEAD
     }</style><link href=./static/css/app.f95bf6feddf7aa62f61971efba3860be.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.571c38d63f24b1ae9e16.js></script><script type=text/javascript src=./static/js/vendor.2485ee65a402fb60e5a9.js></script><script type=text/javascript src=./static/js/app.55218c764cd98dbddcf1.js></script></body></html><script>function stopSafari() {
+=======
+    }</style><link href=./static/css/app.6c04b4e9d7349cf983f7281390603d6e.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.949266e941635483ba4e.js></script><script type=text/javascript src=./static/js/vendor.e1cf871eb7c38dbf5c5b.js></script><script type=text/javascript src=./static/js/app.281d69805149f14c0891.js></script></body></html><script>function stopSafari() {
+>>>>>>> 9b8a06a144c6104df69528a8cc3e89e02748d386
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/css/app.6c04b4e9d7349cf983f7281390603d6e.css


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/css/app.6c04b4e9d7349cf983f7281390603d6e.css.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/css/app.f95bf6feddf7aa62f61971efba3860be.css


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/css/app.f95bf6feddf7aa62f61971efba3860be.css.map


+ 0 - 0
dist/static/img/videoFile.8b2406f.svg → dist/static/img/videoFile.2273786.svg


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/0.62586bda94a1b515c352.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/0.62586bda94a1b515c352.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/0.7da288988865a9378b49.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/2.94e1427bfc7ef0b4c685.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/2.96e371dc7fcc92b785ca.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/2.96e371dc7fcc92b785ca.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 0
dist/static/js/app.281d69805149f14c0891.js


Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 0
dist/static/js/app.281d69805149f14c0891.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 0
dist/static/js/app.55218c764cd98dbddcf1.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/app.55218c764cd98dbddcf1.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/manifest.571c38d63f24b1ae9e16.js.map


+ 2 - 2
dist/static/js/manifest.571c38d63f24b1ae9e16.js → dist/static/js/manifest.949266e941635483ba4e.js

@@ -1,2 +1,2 @@
-!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,a,c){for(var i,u,f,s=0,l=[];s<r.length;s++)u=r[s],t[u]&&l.push(t[u][0]),t[u]=0;for(i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);for(n&&n(r,a,c);l.length;)l.shift()();if(c)for(s=0;s<c.length;s++)f=o(o.s=c[s]);return f};var r={},t={6:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var a=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,o.nc&&c.setAttribute("nonce",o.nc),c.src=o.p+"static/js/"+e+"."+{0:"7da288988865a9378b49",1:"d8d4e9b1fe43bbb0a681",2:"94e1427bfc7ef0b4c685",3:"3a9f53a78da16650e6b8"}[e]+".js";var i=setTimeout(u,12e4);function u(){c.onerror=c.onload=null,clearTimeout(i);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return c.onerror=c.onload=u,a.appendChild(c),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="./",o.oe=function(e){throw console.error(e),e}}([]);
-//# sourceMappingURL=manifest.571c38d63f24b1ae9e16.js.map
+!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,a,c){for(var i,u,f,s=0,l=[];s<r.length;s++)u=r[s],t[u]&&l.push(t[u][0]),t[u]=0;for(i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);for(n&&n(r,a,c);l.length;)l.shift()();if(c)for(s=0;s<c.length;s++)f=o(o.s=c[s]);return f};var r={},t={6:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var a=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,o.nc&&c.setAttribute("nonce",o.nc),c.src=o.p+"static/js/"+e+"."+{0:"62586bda94a1b515c352",1:"d8d4e9b1fe43bbb0a681",2:"96e371dc7fcc92b785ca",3:"3a9f53a78da16650e6b8"}[e]+".js";var i=setTimeout(u,12e4);function u(){c.onerror=c.onload=null,clearTimeout(i);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return c.onerror=c.onload=u,a.appendChild(c),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="./",o.oe=function(e){throw console.error(e),e}}([]);
+//# sourceMappingURL=manifest.949266e941635483ba4e.js.map

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 0
dist/static/js/manifest.949266e941635483ba4e.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/vendor.e1cf871eb7c38dbf5c5b.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/vendor.e1cf871eb7c38dbf5c5b.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 18848
package-lock.json


+ 1 - 0
package.json

@@ -38,6 +38,7 @@
     "lodash": "^4.17.21",
     "markdown-it": "^13.0.2",
     "opencc-js": "^1.0.5",
+    "papaparse": "^5.4.1",
     "pdfjs-dist": "^2.5.207",
     "pptxgenjs": "^3.12.0",
     "qrcodejs2": "^0.0.2",

+ 50 - 76
src/components/pages/classroomObservation/components/chatArea.vue

@@ -428,6 +428,7 @@ import EditorBar from "./wangEnduit";
 const lamejs = require("lamejs");
 import vpdf from "./vpdf";
 import _ from "lodash";
+import Papa from "papaparse";
 // const recorder = new Recorder({
 // 	sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
 // 	sampleRate: 48000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
@@ -459,7 +460,7 @@ const OPTIONS_GROUP = {
   ],
 };
 const ATTENTION_GROUP = {
-  default: "先根据说话人角色判断,再在对应角色的选项中选择选项",
+  default: "- 先根据说话人角色判断,再在对应角色的选项中选择选项\n- 如果没有合适的选项,默认使用`老师其他`或者`学生其他`",
 };
 
 // 自定义指令,用于处理点击外部区域的事件
@@ -686,7 +687,7 @@ export default {
       input.onchange = () => {
         this.uploadFileLoading = true;
         let file = input.files[0];
-        if (!/\.(wav|txt|pdf|xlsx|doc|docx)$/i.test(file.name)) {
+        if (!/\.(wav|txt|pdf|xlsx|doc|docx|csv)$/i.test(file.name)) {
           this.uploadFileLoading = false;
           return this.$message.info(
             "请上传.wav,.txt,.pdf,.xlsx,.doc,.docx,.csv格式的文件"
@@ -1804,8 +1805,8 @@ ${JSON.stringify(_list)}
             } else {
               // 判断是不是音频文件
               const audioRegex = /\.(mp3|wav|ogg|flac|m4a)$/i;
-              const txtRegex = /\.(txt)$/i;
-              const otherRegex = /\.(pdf|xlsx|doc|docx|csv)$/i;
+              const txtRegex = /\.(txt|csv)$/i;
+              const otherRegex = /\.(pdf|xlsx|doc|docx)$/i;
               // if (audioRegex.test(data.Location)) {
               // 	// console.log(data);
               // 	_this.uploadWavFileAndGetText(file)
@@ -1848,73 +1849,44 @@ ${JSON.stringify(_list)}
                         _this.controlsStatus = 2;
                         _this.showIndexPage = false;
                         _this.pageStatus = 2;
-                        // _this.transcriptionData.content += _res.data;
-                        _this.editorBarData.type = "0";
-                        let _textData = _res.data;
-                        if (flag) {
-                          let _result = `<table
-														border="0"
-														width="100%"
-														cellpadding="0"
-														cellspacing="0"
-														style="text-align: center"
-													>
-														<tbody>`;
-                          _textData.split("\n").forEach((item, index) => {
-                            if (index == _textData.split("\n").length - 1) return;
-                            if (index == 0) {
-                              _result += `<tr>`;
-                              if (
-                                item.split("").filter((char) => char === ",").length >= 6
-                              ) {
-                                item.split(",").forEach((item2, index2) => {
-                                  _result += `
-																			<th>${item2}</th>
-																		`;
-                                });
-                              } else {
-                                item
-                                  .trim()
-                                  .split(/\s+/)
-                                  .forEach((item2, index2) => {
-                                    _result += `
-																			<th>${item2}</td>
-																		`;
-                                  });
-                              }
-                              _result += `</tr>`;
-                              return;
-                            }
-                            _result += `<tr>`;
-                            if (
-                              item.split("").filter((char) => char === ",").length >= 6
-                            ) {
-                              item.split(",").forEach((item2, index2) => {
-                                _result += `
-																			<td>${item2}</td>
-																		`;
-                              });
-                            } else {
-                              item
-                                .trim()
-                                .split(/\s+/)
-                                .forEach((item2, index2) => {
-                                  _result += `
-																			<td>${item2}</td>
-																		`;
-                                });
-                            }
-
-                            _result += `</tr>`;
-                          });
-                          _result += `
-															</tbody>
-														</table>`;
-                          _this.editorBarData.content = _result;
-                        } else {
-                          _this.editorBarData.content = _textData;
-                        }
-
+                        const arr = Papa.parse(_res.data, {
+                          header: false,
+                        }).data.slice(1);
+                        console.log(arr);
+                        const _editorBarDataContent = `<table
+                          border="0"
+                          width="100%"
+                          cellpadding="0"
+                          cellspacing="0"
+                          style="text-align: center"
+                        >
+                          <tbody>
+                            <tr>
+                              <th>序号1</th>
+                              <th>开始时间</th>
+                              <th>结束时间</th>
+                              <th>发言内容</th>
+                              <th>时长</th>
+                              <th>说话人身份</th>
+                              <th>行为编码</th>
+                            </tr>
+                            ${arr.map(
+                              (row) => `
+                              <tr>
+                                <td>${_.get(row, 0, "")}</td>
+                                <td>${_.get(row, 1, "")}</td>
+                                <td>${_.get(row, 2, "")}</td>
+                                <td>${_.get(row, 3, "")}</td>
+                                <td>${_.get(row, 4, "")}</td>
+                                <td>${_.get(row, 5, "")}</td>
+                                <td>${_.get(row, 6, "")}</td>
+                              </tr>
+                              `
+                            ).join('\n')}
+                          </tbody>
+                        </table>`;
+                        _this.editorBarData.type = '0';
+                        _this.editorBarData.content = _editorBarDataContent;
                         // _this.transcriptionData.content = _res.data;
                         _this.editorBarData.url = "";
                         _this.saveEditorBar();
@@ -2092,8 +2064,7 @@ ${JSON.stringify(_list)}
 
         if (this.editorBarData.type == 0) {
           let _data = this.editorBarData.content;
-          let _div = document.createElement("div");
-          _div.innerHTML = _data;
+          let _div = document.createRange().createContextualFragment(_data);
           let _tableRows = _div.querySelectorAll(`table tbody tr`);
           _tableRows.forEach((i, index) => {
             while (i.cells.length > 7) {
@@ -2357,7 +2328,7 @@ ${JSON.stringify(_list)}
         },
       };
       // large chunk size will cause token limit and slower
-      const chunkSize = 30;
+      const chunkSize = 10;
       this.actionTypesMap.jsonData[key] = Array.from({ length: tableRows.length }).fill(
         ""
       );
@@ -2375,7 +2346,10 @@ ${JSON.stringify(_list)}
               inputs: {
                 // PERF better to just include `role` and `content` to minimize token cost
                 rows: JSON.stringify(
-                  rows.map((r) => [r.cells[3].textContent, r.cells[5].textContent])
+                  rows.map((r) => ({
+                    content: r.cells[3].textContent,
+                    role: r.cells[5].textContent,
+                  }))
                 ),
                 options: options.join(","),
                 attention,
@@ -2397,7 +2371,7 @@ ${JSON.stringify(_list)}
           this.actionTypesMap.jsonData[key].splice(
             index * chunkSize,
             rows.length,
-            ...chunkResult
+            ...Object.assign(new Array(rows.length), chunkResult.slice(0, rows.length))
           );
           this.changeEditorBar({
             transcriptionData: this.transcriptionData.content,

+ 66 - 14
src/components/pages/components/worksDetail2.vue

@@ -228,12 +228,19 @@
               />
             </div> -->
           </div>
-          <div class="zyBoxC">
+          <div class="zyBoxC" ref="reportPdf">
             <div class="courseTitle" v-if="allWorks.course">
               <div class="txName">
                 <div class="tx"><img :src="tx" alt="" /></div>
                 <div>{{ allWorks.sName }}</div>
                 <div>{{ allWorks.course }}</div>
+                <el-button
+                  type="primary"
+                  size="mini"
+                  style="margin-left: 15px;"
+                  @click="getPdf"
+                  >导出pdf</el-button
+                >
               </div>
 
               <div class="topButton" v-if="tableData.length > 1">
@@ -1582,6 +1589,8 @@ import StudentData from "./studentData";
 import pdf from "./vpdf";
 import htmlDocx from "html-docx-js/dist/html-docx";
 import saveAs from "file-saver";
+import html2canvas from "html2canvas";
+import jspdf from "jspdf";
 export default {
   components: {
     StudentData,
@@ -1851,6 +1860,49 @@ export default {
     });
   },
   methods: {
+    getPdf(){
+      let domHeight = this.$refs.reportPdf.offsetHeight;
+      console.log('this.$refs.reportPdf',this.$refs.reportPdf.offsetHeight);
+      let maxHeight = 64257;
+      html2canvas(this.$refs.reportPdf, {
+        useCORS: true, // 如果截图的内容里有图片,可能会有跨域的情况,加上这个参数,解决文件跨域问题
+        scale: (maxHeight/domHeight) > 1 ? 1: (maxHeight/domHeight)
+    }).then((canvas) => {
+        const contentWidth = canvas.width;
+        const contentHeight = canvas.height;
+
+        let pageHeight = contentWidth / 592.28 * 841.89;
+        let leftHeight = contentHeight;
+
+        //页面偏移
+        var position = 0;
+        //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
+        var imgWidth = 595.28; // A4 宽度
+        var imgHeight = 592.28/contentWidth * contentHeight; // A4总高度
+        var pageData = canvas.toDataURL('image/jpeg', 1.0);
+
+        var pdf = new jspdf('', 'pt', 'a4');
+
+        //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
+        //当内容未超过pdf一页显示的范围,无需分页
+        // if (leftHeight < pageHeight) {
+            pdf.addImage(pageData, 'JPEG', 10, 0, imgWidth-20, imgHeight );
+        // } else {
+        //     while(leftHeight > 0) {
+        //         pdf.addImage(pageData, 'JPEG', 10, position, imgWidth-20, imgHeight)
+        //         leftHeight -= pageHeight;
+        //         position -= 841.89;
+        //         //避免添加空白页
+        //         if(leftHeight > 0) {
+        //             pdf.addPage();
+        //         }
+        //     }
+        // }
+        pdf.save('js.pdf')
+
+    })
+
+    },
 		changeClass(){//切换班级
 			this.searchWork2();
 			this.getCourseDetail()
@@ -3994,7 +4046,7 @@ export default {
   border-radius: 5px;
   width: 90%;
   box-shadow: 2px 2px 5px #909090;
-  overflow: auto;
+  /* overflow: auto; */
 }
 
 .sd_score .score_box {
@@ -4201,9 +4253,9 @@ export default {
   background: #ededed;
   display: flex;
   align-items: flex-start;
-  justify-content: center;
+  /* justify-content: center; */
   flex-direction: column;
-  height: calc(100% - 50px);
+  min-height: calc(100% - 50px);
 }
 
 .zyBox {
@@ -4550,7 +4602,7 @@ export default {
   flex-direction: row;
   flex-wrap: nowrap;
   align-items: flex-start;
-  height: 253px;
+  /* height: 253px; */
 }
 
 .left_top {
@@ -4571,12 +4623,12 @@ export default {
   align-items: flex-start;
   width: 100%;
   height: calc(100% - 60px);
-  overflow: auto;
+  /* overflow: auto; */
 }
 
 .right_score {
   min-width: 370px;
-  height: 351px;
+  min-height: 351px;
   margin-left: 10px;
 }
 
@@ -4765,9 +4817,9 @@ export default {
   display: flex;
   flex-direction: row;
   flex-wrap: nowrap;
-  align-items: flex-start;
+  /* align-items: flex-start; */
   width: 100%;
-  height: 351px;
+  /* height: 351px; */
   margin-bottom: 20px;
 }
 
@@ -4778,7 +4830,7 @@ export default {
   align-items: center;
   width: 100%;
   flex-wrap: nowrap;
-  overflow: auto;
+  /* overflow: auto; */
   /* height: 500px; */
   height: 100%;
 }
@@ -4893,9 +4945,9 @@ export default {
 }
 .radioBox {
   display: flex;
-  flex-direction: row;
-  flex-wrap: nowrap;
-  align-items: center;
+  flex-direction: column;
+  flex-wrap: wrap;
+  /* align-items: center; */
 }
 .radioBox > div {
   margin: 10px 0 0 10px;
@@ -4954,7 +5006,7 @@ export default {
 }
 .contentAuto {
   width: 100%;
-  height: 253px;
+  /* height: 253px; */
   overflow: auto;
 }
 .evalCss {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.