lsc 2 years ago
parent
commit
2600288ceb

+ 11 - 0
package-lock.json

@@ -15,6 +15,7 @@
         "hevue-img-preview": "^5.0.3",
         "html-docx-js": "^0.3.1",
         "html2canvas": "^1.4.1",
+        "image-conversion": "^2.1.1",
         "js-audio-recorder": "^1.0.7",
         "jsmind": "^0.4.8",
         "lamejs": "^1.2.1",
@@ -6319,6 +6320,11 @@
       "integrity": "sha1-Cpf7h2mG6AgcYxFg+PnziRV/AEM=",
       "dev": true
     },
+    "node_modules/image-conversion": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmmirror.com/image-conversion/-/image-conversion-2.1.1.tgz",
+      "integrity": "sha512-hnMOmP7q2jxA+52FZ+wHNhg3fdFRlgfngsQH2JQHEQkafY7tj/8F15e6Rv/RxDegc872jvyaRHwMbkTZK1Cjbg=="
+    },
     "node_modules/import-cwd": {
       "version": "2.1.0",
       "resolved": "https://registry.npm.taobao.org/import-cwd/download/import-cwd-2.1.0.tgz",
@@ -21705,6 +21711,11 @@
       "integrity": "sha1-Cpf7h2mG6AgcYxFg+PnziRV/AEM=",
       "dev": true
     },
+    "image-conversion": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmmirror.com/image-conversion/-/image-conversion-2.1.1.tgz",
+      "integrity": "sha512-hnMOmP7q2jxA+52FZ+wHNhg3fdFRlgfngsQH2JQHEQkafY7tj/8F15e6Rv/RxDegc872jvyaRHwMbkTZK1Cjbg=="
+    },
     "import-cwd": {
       "version": "2.1.0",
       "resolved": "https://registry.npm.taobao.org/import-cwd/download/import-cwd-2.1.0.tgz",

+ 1 - 0
package.json

@@ -19,6 +19,7 @@
     "hevue-img-preview": "^5.0.3",
     "html-docx-js": "^0.3.1",
     "html2canvas": "^1.4.1",
+    "image-conversion": "^2.1.1",
     "js-audio-recorder": "^1.0.7",
     "jsmind": "^0.4.8",
     "lamejs": "^1.2.1",

+ 7 - 0
src/components/components/answerData2.vue

@@ -16,6 +16,13 @@
         count+'人'
         }}</span></span>
       </div>
+      <div class="correct">
+        <span
+          >正确率为<span>{{
+            people.length > 0 ? Math.round(count / people.length * 10000) / 10000 * 100 + "%" : 0
+          }}</span></span
+        >
+      </div>
     </div>
   </div>
 </template>

+ 37 - 3
src/components/components/askStatic.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="sjBox" v-if="askJSONC && askJSONC.askJson">
     <div class="a_add_title">
-      <div style="font-size: 25px">{{ askJSONC.askJson.askTitle }}</div>
+      <div style="font-size: 25px">{{ askJSONC.askTitle }}</div>
     </div>
     <div class="a_addBox">
-      <div class="a_add_box" v-for="(item, index) in askJSONC.askJson.askJson" :key="index">
+      <div class="a_add_box" v-for="(item, index) in askJSONC.askJson" :key="index">
         <div class="a_add_head">
           <div>
             <span>{{ index + 1 + "、" + item.askstitle }}</span>
@@ -32,6 +32,17 @@
                   " :show-text="false"></el-progress>
                 </span>
               </div>
+              <div class="a_add_persent_div" v-for="(item1, checkIndex) in item.askItem" :key="checkIndex"
+                v-if=" item.answer == checkIndex">
+                <span>正确率</span>
+                <span>{{
+                (checkJson[index].checkPerent[checkIndex]
+                ? checkJson[index].checkPerent[checkIndex]
+                : 0) +'%'
+                }}</span>
+                <span>
+                </span>
+              </div>
             </div>
           </div>
         </div>
@@ -68,6 +79,7 @@ export default {
       dialogVisible: false,
       person: [],
       timu: [],
+      checkJson2:[]
     };
   },
   watch: {
@@ -85,8 +97,30 @@ export default {
       this.dialogVisible = true;
     },
   },
+  watch: {
+    checkJson: {
+      immediate: true,
+      deep: true,
+      handler(newValue, oldValue) {
+        this.askJSONC = this.askJSON ? this.askJSON : {};
+        for(var i = 0;i<this.checkJson.length;i++){
+          // debuggerA
+          let el = this.checkJson[i]
+          console.log(el)
+        }
+        this.checkJson2 = this.checkJson
+      }
+    }
+  },
   mounted() {
-    this.askJSONC = this.askJSON ? JSON.parse(this.askJSON)[0] : {};
+    // this.askJSONC = this.askJSON ? JSON.parse(this.askJSON)[0] : {};
+    this.askJSONC = this.askJSON ? this.askJSON : {};
+    for(var i = 0;i<this.checkJson.length;i++){
+      let el = this.checkJson[i]
+      console.log(el)
+    }
+    this.checkJson2 = this.checkJson
+    
   },
 };
 </script>

+ 1 - 3
src/components/study.vue

@@ -823,9 +823,7 @@
                       </div>
                       <AskStatic v-if="
                         worksStudent[jdIndex][rwIndex][toolIndex].length > 0
-                      " :askJSON="
-                        worksStudent[jdIndex][rwIndex][toolIndex][0].works
-                      " :checkJson="checkJson[jdIndex][rwIndex][toolIndex]"></AskStatic>
+                      " :askJSON="tool.askJson" :checkJson="checkJson[jdIndex][rwIndex][toolIndex]"></AskStatic>
                     </div>
                     <div v-if="
                       worksStudent[jdIndex] &&

+ 15 - 3
src/components/studyStudent.vue

@@ -930,7 +930,7 @@
                     <AskStatic v-if="
                       worksStudent.length &&
                       worksStudent[toolIndex].length > 0
-                    " :askJSON="worksStudent[toolIndex][0].works" :checkJson="checkJson[toolIndex]"></AskStatic>
+                    " :askJSON="tool" :checkJson="checkJson[toolIndex]"></AskStatic>
                   </div>
                   <div v-if="
                     tType &&
@@ -2121,6 +2121,7 @@ import Time from "./tools/time.vue";
 import Mind from "./tools/jsmind.vue";
 import Sunburst from "./tools/sunburst";
 import SeeBoard from "./tools/seeBoard";
+import * as imageConversion from 'image-conversion'
 export default {
   components: { EditorBar, Time, pdf, AskStatic, Mind, Sunburst, SeeBoard, AnswerData2 },
   data() {
@@ -3072,7 +3073,7 @@ export default {
           console.error(err);
         });
     },
-    beforeUpload1(event, type, i) {
+    async beforeUpload1(event, type, i) {
       // this.$message.success('进入上传')
 
       var file = event.target.files[0];
@@ -3102,6 +3103,7 @@ export default {
         "PPSM",
       ];
       var excelA = ['XLSX', 'XLXB', 'XLS', 'XLSM']
+      var photoA = ["BMP", "GIF", "PNG", "JPGE", "JPG", "TIF", "PCX", "TGA", "EXIF", "FPX", "SVG", "APNG"];
       if (
         b.indexOf(
           file.name
@@ -3123,6 +3125,16 @@ export default {
           return;
         }
       }
+
+      if (photoA.indexOf(
+        file.name
+          .split(".")
+        [file.name.split(".").length - 1].toLocaleUpperCase()
+      ) != -1) {
+        // const blob = await imageConversion.compress(file, 0.8)
+        const blob = await imageConversion.compressAccurately(file, 32)
+        file = new File([blob], file.name, {type: file.type})
+      }
       _this.progress = 0;
       _this.proVisible = true;
 
@@ -6552,7 +6564,7 @@ export default {
   align-items: flex-end;
 }
 
-.buttonA{
+.buttonA {
   margin-left: 10px;
   padding: 0;
 }