Parcourir la source

新增删除试卷题卡功能

zhangjie il y a 2 ans
Parent
commit
9501d14bfa
2 fichiers modifiés avec 33 ajouts et 1 suppressions
  1. 11 1
      src/modules/paper/api.js
  2. 22 0
      src/modules/paper/views/EditPaper.vue

+ 11 - 1
src/modules/paper/api.js

@@ -86,7 +86,17 @@ export const paperDetailAddQuestionApi = (
     questions
   );
 };
-
+export const paperCardDeleteApi = (paperId) => {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/card/delete/paper`,
+    {},
+    {
+      params: {
+        paperId,
+      },
+    }
+  );
+};
 // paper-info
 export const paperAuditInfoApi = ({ paperId, curPage, pageSize }) => {
   return $httpWithMsg.get(

+ 22 - 0
src/modules/paper/views/EditPaper.vue

@@ -111,6 +111,15 @@
           >
             编辑题卡
           </el-button>
+          <el-button
+            v-if="enableCardEdit"
+            type="danger"
+            plain
+            size="small"
+            @click="toDeletCard"
+          >
+            清除题卡
+          </el-button>
         </div>
         <div>
           <el-button
@@ -582,6 +591,7 @@ import {
   paperQuestionSaveApi,
   paperDetailAddQuestionApi,
   paperQuestionChangeApi,
+  paperCardDeleteApi,
 } from "../api";
 import { QUESTION_API } from "@/constants/constants";
 
@@ -777,6 +787,18 @@ export default {
         },
       });
     },
+    async toDeletCard() {
+      const confirm = await this.$confirm(
+        `确定要清除当前试卷的题卡吗?`,
+        "提示",
+        {
+          type: "warning",
+        }
+      ).catch(() => {});
+      if (confirm !== "confirm") return;
+      await paperCardDeleteApi(this.paperId);
+      this.$message.success("操作成功!");
+    },
     // header-action ----end
     // 考试说明
     toEditExamRemark() {