Przeglądaj źródła

feat: 报告下载调整

zhangjie 11 miesięcy temu
rodzic
commit
60b4a45109

+ 8 - 5
src/modules/mark/components/ScoreReportPreview.vue

@@ -68,11 +68,14 @@ export default {
 
       const filename = `${this.title}.pdf`;
       const res = await downloadByApi(() => {
-        return scoreReportExport({
-          // examId: this.instance.examId,
-          // paperNumber: this.instance.paperNumber,
-          htmlContent: this.$refs.reportRef.getTemp(),
-        });
+        const formData = new FormData();
+        const htmlFile = new File(
+          [this.$refs.reportRef.getTemp()],
+          `${Date.now()}.html`,
+          { type: "text/html" }
+        );
+        formData.append("file", htmlFile);
+        return scoreReportExport(formData);
       }, filename).catch((e) => {
         this.$message.error(e || "下载失败,请重新尝试!");
       });