zhangjie 6 mesi fa
parent
commit
d4081645fd
1 ha cambiato i file con 8 aggiunte e 30 eliminazioni
  1. 8 30
      src/modules/exam/components/ModifyTaskPaper.vue

+ 8 - 30
src/modules/exam/components/ModifyTaskPaper.vue

@@ -273,11 +273,6 @@
       show-watermark
     ></card-preview-dialog>
 
-    <!-- PreviewAttachment -->
-    <preview-attachment
-      ref="PreviewAttachment"
-      :attachment-ids="attachmentIds"
-    ></preview-attachment>
     <!-- PreviewFile -->
     <preview-file ref="PreviewFile" :data="curFile"></preview-file>
   </div>
@@ -287,11 +282,9 @@
 import UploadPaperDialog from "./UploadPaperDialog";
 import ModifyCard from "../../card/components/ModifyCard";
 import CardPreviewDialog from "../../card/components/CardPreviewDialog.vue";
-import PreviewAttachment from "@/components/PreviewAttachment.vue";
 import PreviewFile from "@/components/PreviewFile.vue";
 
 import { taskApplyDetail, taskPaperApplyEdit, cardForSelectList } from "../api";
-import { attachmentPreview } from "../../login/api";
 import { COMMON_CARD_RULE_ID } from "@/constants/enumerate";
 import { copyCard } from "../../card/api";
 
@@ -322,7 +315,6 @@ export default {
     UploadPaperDialog,
     ModifyCard,
     CardPreviewDialog,
-    PreviewAttachment,
     PreviewFile,
   },
   props: {
@@ -385,11 +377,9 @@ export default {
       abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
       cards: [],
       user: this.$ls.get("user", {}),
-      // attachmentId preview
-      attachmentIds: [],
       // preview file
       curFile: {
-        url: "",
+        id: "",
         type: "",
       },
     };
@@ -497,27 +487,15 @@ export default {
       }
     },
     async toViewAttachment(attachment) {
-      if (!attachment.jpgAttachmentId) {
-        if (!attachment.attachmentId) {
-          this.$message.error("附件丢失!");
-          return;
-        }
-        const data = await attachmentPreview(attachment.attachmentId);
-        if (!data[0].url) {
-          this.$message.error("附件丢失!");
-          return;
-        }
-        this.curFile = {
-          url: data[0].url,
-          type: "application/pdf",
-        };
-        this.$refs.PreviewFile.open();
+      if (!attachment.attachmentId) {
+        this.$message.error("附件丢失!");
         return;
       }
-
-      const datas = JSON.parse(attachment.jpgAttachmentId);
-      this.attachmentIds = datas.map((item) => item.attachmentId);
-      this.$refs.PreviewAttachment.open();
+      this.curFile = {
+        id: attachment.attachmentId,
+        type: "application/pdf",
+      };
+      this.$refs.PreviewFile.open();
     },
     toViewCard(attachment) {
       this.curAttachment = { ...attachment };