瀏覽代碼

题卡管理新增卡格式下载

zhangjie 1 年之前
父節點
當前提交
804499b930
共有 2 個文件被更改,包括 29 次插入2 次删除
  1. 9 0
      src/modules/base/api.js
  2. 20 2
      src/modules/base/views/CardManage.vue

+ 9 - 0
src/modules/base/api.js

@@ -232,6 +232,15 @@ export const downloadCardFile = (id) => {
     }
   );
 };
+export const downloadCardExchangeFile = (id) => {
+  return $postParam(
+    "/api/admin/exam/card/download_card_exchange",
+    { id },
+    {
+      responseType: "blob",
+    }
+  );
+};
 // course-target-template-manage
 export const courseTargetTemplateListPage = (datas) => {
   return $postParam("/api/admin/basic/course-target-template/list", datas);

+ 20 - 2
src/modules/base/views/CardManage.vue

@@ -122,7 +122,7 @@
         <el-table-column
           class-name="action-column"
           label="操作"
-          width="180"
+          width="230"
           fixed="right"
         >
           <template slot-scope="scope">
@@ -188,7 +188,14 @@
               class="btn-primary"
               type="text"
               @click="toDownload(scope.row)"
-              >下载</el-button
+              >下载题卡</el-button
+            >
+            <el-button
+              v-if="checkPrivilege('link', 'Download')"
+              class="btn-primary"
+              type="text"
+              @click="toDownloadCardExchange(scope.row)"
+              >下载卡格式</el-button
             >
           </template>
         </el-table-column>
@@ -242,6 +249,7 @@ import {
   deleteCard,
   convertCardImage,
   downloadCardFile,
+  downloadCardExchangeFile,
 } from "../api";
 import ModifyCardInfo from "../components/ModifyCardInfo";
 import pickerOptions from "@/constants/datePickerOptions";
@@ -364,6 +372,16 @@ export default {
       if (!res) return;
       this.$message.success("下载成功!");
     },
+    async toDownloadCardExchange(row) {
+      const res = await downloadByApi(() => {
+        return downloadCardExchangeFile(row.id);
+      }, "").catch((e) => {
+        this.$message.error(e || "下载失败,请重新尝试!");
+      });
+
+      if (!res) return;
+      this.$message.success("下载成功!");
+    },
     // image-preview
     toPreviewImage(row) {
       this.imageList = row.imageUrls;