Browse Source

修改下载

SanHQin 2 months ago
parent
commit
7774ac0705
1 changed files with 11 additions and 4 deletions
  1. 11 4
      src/components/pages/test/check/index.vue

+ 11 - 4
src/components/pages/test/check/index.vue

@@ -2049,7 +2049,11 @@ const getFile = (url) => {
         console.log(err, err.stack);
         resolve({ data: 1 });
       } else {
-        resolve({ data: data.Body });
+        if(data.Body.byteLength <= 85 * 1024 * 1024){
+          resolve({ data: data.Body });
+        }else{
+          resolve({ data: 1 });
+        }
         console.log(data);
       } // sxuccessful response
     });
@@ -2371,7 +2375,7 @@ export default {
         this.opQvisible = false
     },
  // 点击开始评分
-    async markSco(){ 
+    async markSco(){
       if (!this.cueWord.openCeTit.trim()) return this.$message.error('请输入标题')
       if (!this.cueWord.openCeCon.trim()) return this.$message.error('请输入指令')
       if (this.cueWord.fieldList.length == 0) return this.$message.error('请选择引用字段')
@@ -2439,7 +2443,7 @@ export default {
         // const result = userWork.filter(item => this.cueWord.fieldList.includes(item.tit));
 
         let messages = `
-NOTICE 
+NOTICE
 Role: 你是一个资深的教师,你要根据评分标准,对作业内容进行评分
 Language: ${this.getLang()}
 
@@ -2456,7 +2460,7 @@ ${this.cueWord.fieldList.includes('年级') ? '年级:' + this.getTType(this.t
 ${this.cueWord.fieldList.includes('学科') ? '学科:' + this.getTType(this.teaType[2].id, val.cclassid) : ''}
 ${this.cueWord.fieldList.includes('职务') ? '职务:' + this.getTType(this.teaType[3].id, val.cclassid) : ''}
 ${this.cueWord.fieldList.includes('教龄') ? '教龄:' + this.getTType(this.teaType[4].id, val.cclassid) : ''}
-${this.cueWord.fieldList.includes('作业提交时间') ? '作业提交时间:' + val.time : ''} 
+${this.cueWord.fieldList.includes('作业提交时间') ? '作业提交时间:' + val.time : ''}
 ${userWork}
 
 # 输出要求 #
@@ -4220,9 +4224,12 @@ ${userWork}
         });
       }
       Promise.all(promises).then(() => {
+        console.log("开始下载")
+        this.fileLoading[index].bool = true;
         zip.generateAsync({ type: "blob" }).then((content) => {
           // 生成二进制流
           FileSaver.saveAs(content, `${this.testJson.title}-${title}.zip`); // 利用file-saver保存文件  自定义文件名
+          this.fileLoading[index].bool = false;
         });
       });
     },