瀏覽代碼

feat: 接口调试

zhangjie 1 月之前
父節點
當前提交
2827e55276

+ 2 - 3
src/components/ImportFile.vue

@@ -1,9 +1,8 @@
 <template>
   <div class="import-file">
-    <div class="tpl-download">
-      <span v-if="templateUrl">模板下载:</span>
+    <div v-if="templateUrl" class="tpl-download">
+      <span>模板下载:</span>
       <svg-btn
-        v-if="templateUrl"
         name="daoru"
         color="#6D5FF6"
         hoverBgColor="#fff"

+ 15 - 7
src/modules/paper-export/views/PaperTemplateBuild.vue

@@ -14,7 +14,7 @@
           <el-option value="MODE5" label="整卷连续"></el-option>
         </el-select>
         <el-select
-          v-model="curPaperTemp"
+          v-model="paperTemplateId"
           class="margin-right-10"
           placeholder="请选择"
           value-key="id"
@@ -25,7 +25,7 @@
             v-for="item in paperTempList"
             :key="item.id"
             :label="item.name"
-            :value="item"
+            :value="item.id"
           >
           </el-option>
         </el-select>
@@ -53,6 +53,7 @@
         ref="PaperBuildConfig"
         :config-sources="configSources"
         :confirm-disabled="downloading"
+        :build-config="buildConfig"
         @confirm="toAction('buildPackage')"
       ></paper-build-config>
       <paper-template-view
@@ -159,6 +160,7 @@ export default {
       paperId: this.$route.params.paperId,
       viewType: this.$route.params.viewType,
       seqMode: "MODE3",
+      paperTemplateId: "",
       showScaleEdit: false,
       buildConfig: {},
       keys: [],
@@ -211,6 +213,7 @@ export default {
         }
 
         this.seqMode = paperSet.seqMode;
+        this.paperTemplateId = paperSet.paperTemp.id;
         this.curPaperTemp = paperSet.paperTemp;
         this.configModalForm = paperSet.configModalForm;
 
@@ -308,19 +311,24 @@ export default {
         this.$message.error("导出模板缺失!");
         return;
       }
-      this.paperTempChange(this.paperTempList[0]);
+
+      const curPaperTemp = this.paperTempList.find(
+        (item) => item.id === this.paperTemplateId
+      );
+      this.paperTempChange(curPaperTemp || this.paperTempList[0]);
     },
     async getParamInfo() {
       const res = await paperParamInfoApi(this.paperId);
-      this.seqMode = res.data.seqMode;
-      this.curPaperTemp = res.data.curPaperTemp;
-      this.buildConfig = res.data;
+      const result = res.data || {};
+      this.seqMode = result.seqMode || "MODE3";
+      this.paperTemplateId = result.paperTemplateId || "";
+      this.buildConfig = result;
     },
     async saveParamInfo() {
       await paperParamSaveApi({
         paperId: this.paperId,
         seqMode: this.seqMode,
-        curPaperTemp: this.curPaperTemp,
+        paperTemplateId: this.paperTemplateId,
         ...this.$refs.PaperBuildConfig.getData(),
       });
     },

+ 1 - 1
src/modules/paper/views/EditPaper.vue

@@ -898,7 +898,7 @@ export default {
       return this.paper.auditStatus === "PASS";
     },
     locked() {
-      return !this.paper.locks;
+      return this.paper.locks;
     },
     ...mapGetters(["authButtons"]),
   },

+ 6 - 7
src/modules/questions/component/CourseOutlineDialog.vue

@@ -12,13 +12,12 @@
       destroy-on-close
       @open="visibleChange"
     >
-      <el-form v-if="course?.outlineFilePath" label-width="80px">
-        <el-form-item label="文档:">
-          <el-link :href="course.outlineFilePath" target="_blank"
-            >教学大纲PDF</el-link
-          >
-        </el-form-item>
-      </el-form>
+      <div v-if="course?.outlineFilePath">
+        <span class="inline-middle">文档:</span>
+        <el-link :href="course.outlineFilePath" target="_blank"
+          >教学大纲PDF</el-link
+        >
+      </div>
       <div class="upload-gray-box">
         <import-file
           ref="ImportFile"

+ 39 - 6
src/modules/questions/views/GenPaper.vue

@@ -288,16 +288,15 @@
           label="试卷模板"
         >
           <el-select
-            v-model="curPaperTemp"
+            v-model="exportModel.paperTemplateId"
             placeholder="请选择试卷模板"
-            value-key="id"
             @change="paperTempChange"
           >
             <el-option
               v-for="item in paperTempList"
               :key="item.id"
               :label="item.name"
-              :value="item"
+              :value="item.id"
             >
             </el-option>
           </el-select>
@@ -339,6 +338,7 @@
         ref="PaperBuildConfig"
         :config-sources="configSources"
         :show-confirm-btn="false"
+        :build-config="buildConfig"
       ></paper-build-config>
       <div slot="footer">
         <el-button
@@ -458,7 +458,11 @@ import { QUESTION_API } from "@/constants/constants";
 import { LEVEL_TYPE, PUBLICITY_LIST } from "../constants/constants";
 import { mapState } from "vuex";
 import { downloadByApi, downloadByBlob } from "@/plugins/download";
-import { paperTemplateListApi } from "../../paper-export/api";
+import {
+  paperTemplateListApi,
+  paperParamInfoApi,
+  paperParamSaveApi,
+} from "../../paper-export/api";
 import { deepCopy } from "@/plugins/utils";
 import { paperDetailInfoApi } from "../../paper/api";
 import { buildPdf } from "@/plugins/htmlToPdf";
@@ -519,6 +523,7 @@ export default {
         templateId: "",
         exportContent: "",
         seqMode: "MODE3",
+        paperTemplateId: "",
       },
       pageCountMode: "SIMPLE",
       isShow: true,
@@ -535,6 +540,7 @@ export default {
         examId: [{ required: true, message: "请输入名称", trigger: "change" }],
       },
       // pdf download
+      buildConfig: {},
       paperPreviewUrl: "",
       answerPreviewUrl: "",
       downloading: false,
@@ -596,9 +602,19 @@ export default {
     delete window.submitPaperTemp;
   },
   methods: {
-    exportContentChange(val) {
+    async exportContentChange(val) {
       if (val === "PAPER") {
-        this.getPaperTempList();
+        await this.getParamInfo();
+        await this.getPaperTempList();
+
+        if (!this.paperTempList.length) {
+          this.$message.error("导出模板缺失!");
+          return;
+        }
+        const curPaperTemp = this.paperTempList.find(
+          (item) => item.id === this.exportModel.paperTemplateId
+        );
+        this.paperTempChange(curPaperTemp || this.paperTempList[0]);
         return;
       }
       if (val === "ANSWER") {
@@ -1059,12 +1075,28 @@ export default {
       this.searchGenPaper();
     },
     // download paper pdf
+    async getParamInfo() {
+      const res = await paperParamInfoApi(this.exportModel.id);
+      const result = res.data || {};
+      this.exportModel.seqMode = result.seqMode || "MODE3";
+      this.exportModel.paperTemplateId = result.paperTemplateId || "";
+      this.buildConfig = result;
+    },
+    async saveParamInfo() {
+      await paperParamSaveApi({
+        paperId: this.exportModel.id,
+        seqMode: this.exportModel.seqMode,
+        paperTemplateId: this.exportModel.paperTemplateId,
+        ...this.$refs.PaperBuildConfig.getData(),
+      });
+    },
     async getPaperTempList() {
       if (this.paperTempList.length) return;
       const res = await paperTemplateListApi("PAPER_EXPORT");
       this.paperTempList = res.data;
     },
     paperTempChange(paperTemp) {
+      this.curPaperTemp = paperTemp;
       // console.log(paperTemp);
       let paperTempJson = paperTemp.content
         ? JSON.parse(paperTemp.content)
@@ -1102,6 +1134,7 @@ export default {
       if (this.downloading) return;
       this.downloading = true;
 
+      this.saveParamInfo();
       const configModalForm = this.$refs.PaperBuildConfig.getData();
       window.paperSet = {
         paperTemp: this.curPaperTemp,