zhangjie 5 years ago
parent
commit
e42293eec4

+ 2 - 2
.env.production

@@ -1,5 +1,5 @@
 NODE_ENV=production
-VUE_APP_DOMAIN=
+VUE_APP_DOMAIN=http://localhost:8111
 VUE_APP_TIMEOUT=600000
 VUE_APP_PAGE_SIZE=10
-VUE_APP_AUTH_TIMEOUT=7200000
+VUE_APP_AUTH_TIMEOUT=7200000

+ 44 - 9
public/pag.html

@@ -917,8 +917,8 @@
       padding-bottom: 0;
     }
     .elem-fill-line .elem-body {
-      padding-bottom: 30px;
       font-size: 0;
+      padding-bottom: 30px;
     }
     .elem-fill-line .elem-fill-quesiton {
       display: inline-block;
@@ -1010,10 +1010,10 @@
                   <div class="page-column-body">
                     <div class="topic-element page-column-element">
                       <div
-                        id="element-elm1ogleju81fgio"
+                        id="element-bl7rlbo8o056u3o2"
                         data-type="CARD_HEAD"
                         class="topic-preview element-item element-item-card-head"
-                        style="left: 0px; top: 0px; width: 704px; height: 393px;"
+                        style="left: 0px; top: 0px; width: 704px; height: 442px;"
                       >
                         <div class="page-element card-head card-head-normal">
                           <div class="card-head-top">
@@ -1028,7 +1028,9 @@
                                     <!---->
                                     <div class="stdno-auto">
                                       <div class="stdno-auto-barcode">
-                                        <img src="${examNumber}" />
+                                        <img
+                                          src="data:image/png;base64,${examNumber}"
+                                        />
                                       </div>
                                     </div>
                                     <!---->
@@ -1073,8 +1075,8 @@
                                 </div>
                                 <div class="grid-col">
                                   <div
-                                    class="head-dynamic card-head-body-spin head-dynamic-1"
-                                    style="height: 86px;"
+                                    class="head-dynamic card-head-body-spin head-dynamic-2"
+                                    style="height: 137px;"
                                   >
                                     <div
                                       class="head-dynamic-part head-dynamic-write"
@@ -1087,7 +1089,40 @@
                                         注意:签名则表示您认可答题卡提供的信息与您本人信息相符;如签名与信息不符或者未签名,试卷作废。
                                       </p>
                                     </div>
-                                    <!----><!---->
+                                    <!---->
+                                    <div
+                                      id="head-dynamic-aorb"
+                                      class="head-dynamic-part head-dynamic-aorb head-dynamic-aorb-auto"
+                                      style="height: 56px;"
+                                    >
+                                      <div
+                                        class="dynamic-aorb-item dynamic-aorb-title"
+                                      >
+                                        <p class="dynamic-aorb-content">
+                                          试卷类型:
+                                        </p>
+                                      </div>
+                                      <!---->
+                                      <div
+                                        class="dynamic-aorb-item dynamic-aorb-info"
+                                      >
+                                        <div class="dynamic-aorb-content">
+                                          <i>${paperTypeName}</i>
+                                        </div>
+                                      </div>
+                                      <div
+                                        class="dynamic-aorb-item dynamic-aorb-barcode"
+                                      >
+                                        <div
+                                          id="dynamic-aorb-barcode"
+                                          class="dynamic-aorb-content"
+                                        >
+                                          <img
+                                            src="data:image/png;base64,${paperType}"
+                                          />
+                                        </div>
+                                      </div>
+                                    </div>
                                   </div>
                                 </div>
                               </div>
@@ -1099,7 +1134,7 @@
                     </div>
                     <div class="topic-element page-column-element">
                       <div
-                        id="element-bl4v53r82iff6l1e"
+                        id="element-6ogicgmoc1v5tnsi"
                         data-type="TOPIC_HEAD"
                         class="topic-preview element-item element-item-topic-head"
                         style="left: 0px; top: 0px; width: 0px; height: 60px;"
@@ -1439,7 +1474,7 @@
                   <div class="page-column-body">
                     <div class="topic-element page-column-element">
                       <div
-                        id="element-40dd5f08vncf4t7o"
+                        id="element-uqk21b0q49pja3jg"
                         data-type="TOPIC_HEAD"
                         class="topic-preview element-item element-item-topic-head"
                         style="left: 0px; top: 0px; width: 0px; height: 60px;"

+ 7 - 0
src/assets/styles/base.scss

@@ -159,3 +159,10 @@ body {
   box-shadow: 5px 5px 4px 0px rgba(28, 208, 161, 0.3);
   border-radius: 10px;
 }
+.cont-link {
+  color: $--color-primary;
+  cursor: pointer;
+  &:hover {
+    color: $--color-success;
+  }
+}

+ 5 - 0
src/assets/styles/element-ui-costom.scss

@@ -286,6 +286,11 @@
     color: $--color-text-regular !important;
     font-weight: bold;
   }
+  &.is-disabled {
+    .el-radio__label {
+      color: $--color-text-secondary !important;
+    }
+  }
 }
 
 // el-pagination

+ 5 - 2
src/modules/card/components/elementEdit/cardHeadSpin/HeadDynamic.vue

@@ -66,7 +66,7 @@
         v-if="data.aOrBType === 'auto'"
       >
         <div class="dynamic-aorb-content">
-          <i>A</i>
+          <i>{{ aorbBarcodeName }}</i>
         </div>
       </div>
       <div
@@ -95,7 +95,10 @@ export default {
   data() {
     return {
       aorbBarcodeSrc:
-        this.data["fieldInfos"] && this.data["fieldInfos"]["paperType"]
+        this.data["fieldInfos"] && this.data["fieldInfos"]["paperType"],
+      aorbBarcodeName:
+        (this.data["fieldInfos"] && this.data["fieldInfos"]["paperTypeName"]) ||
+        "A"
     };
   },
   computed: {

+ 1 - 1
src/modules/card/enumerate.js

@@ -50,7 +50,7 @@ export const transformField = data => {
 };
 
 export const getAOrBSystem = data => {
-  return data.enablePaperType
+  return data["enablePaperType"]
     ? data.enablePaperType.split(",").length > 1
     : null;
 };

+ 8 - 0
src/modules/card/store.js

@@ -39,6 +39,14 @@ const mutations = {
   },
   setOpenElementEditDialog(state, openElementEditDialog) {
     state.openElementEditDialog = openElementEditDialog;
+  },
+  initState(state) {
+    state.curElement = {};
+    state.curDragElement = {};
+    state.curPageNo = 0;
+    state.pages = [];
+    state.cardConfig = {};
+    state.openElementEditDialog = false;
   }
 };
 

+ 29 - 9
src/modules/card/views/CardDesign.vue

@@ -297,7 +297,8 @@ export default {
       "setCardConfig",
       "setOpenElementEditDialog",
       "setCurDragElement",
-      "setPages"
+      "setPages",
+      "initState"
     ]),
     ...mapActions("card", [
       "removePage",
@@ -307,10 +308,10 @@ export default {
       "rebuildPages"
     ]),
     async initCard() {
+      await this.getCardConfig();
       if (this.isEdit) {
         this.getCardTempDetail();
       } else {
-        await this.getCardConfig();
         this.initPageData();
       }
       this.addWatch();
@@ -318,11 +319,18 @@ export default {
     async getCardTempDetail() {
       const detData = await cardDetailEdit(this.cardId);
       const tempData = await cardTempDetail(this.cardId);
-      const cont = JSON.parse(tempData.content);
       this.prepareTcPCard = Object.assign(this.prepareTcPCard, detData);
-      this.cardDetailId = tempData.id;
-      this.setPages(cont.pages);
-      this.setCardConfig(cont.cardConfig);
+
+      // 可能存在题卡内容没有记录的情况
+      if (tempData) {
+        const cont = JSON.parse(tempData.content);
+        this.cardDetailId = tempData.id;
+        this.setPages(cont.pages);
+        this.setCardConfig(cont.cardConfig);
+      } else {
+        // 没有题卡内容时,直接创建新的内容
+        this.initPageData();
+      }
     },
     initPageData() {
       this.addNewPage();
@@ -389,14 +397,19 @@ export default {
       const tcPCard = this.$objAssign(
         {
           examId: "",
-          enablePaperType: "",
+          enablePaperType: "A",
           paperAttachmentId: "",
           courseName: "",
           courseCode: "",
           cardSource: "",
           title: ""
         },
-        { ...this.prepareTcPCard, title: this.cardConfig.cardName }
+        {
+          ...this.prepareTcPCard,
+          title: this.cardConfig.cardName,
+          // todo:A,B最好前端配置一下,以便支持扩展
+          enablePaperType: this.cardConfig.aOrB ? "A,B" : "A"
+        }
       );
 
       let data = {
@@ -410,6 +423,10 @@ export default {
       return data;
     },
     async save() {
+      if (!this.cardConfig.cardName) {
+        this.$message.error("题卡标题不能为空!");
+        return Promise.reject("error:题卡标题不能为空");
+      }
       const result = await saveCard(this.getCardData());
       this.cardDetailId = result.cardDetailId;
       this.$ls.set("cardDetailId", this.cardDetailId);
@@ -424,7 +441,9 @@ export default {
         this.prepareTcPCard.taskId &&
         this.prepareTcPCard.cardSource === "1"
       ) {
-        saveWaitTask({ ...this.prepareTcPCard, cardId: this.cardId });
+        saveWaitTask({
+          tcPExamTaskDetail: { ...this.prepareTcPCard, cardId: this.cardId }
+        });
       }
     },
     registWindowSubmit() {
@@ -442,6 +461,7 @@ export default {
   beforeDestroy() {
     this.$ls.remove("cardDetailId");
     this.$ls.remove("prepareTcPCard");
+    this.initState();
   }
 };
 </script>

+ 11 - 5
src/modules/card/views/CardPreview.vue

@@ -100,8 +100,8 @@ export default {
   },
   methods: {
     async initFrame() {
-      const card = await cardTempDetail(this.cardId);
-      const { cardConfig, pages } = JSON.parse(card.content);
+      const tempData = await cardTempDetail(this.cardId);
+      const { cardConfig, pages } = JSON.parse(tempData.content);
       let fieldInfos = {};
       cardConfig.businessParams.map(item => {
         fieldInfos[item.field] = "${" + item.field + "}";
@@ -109,8 +109,10 @@ export default {
       if (cardConfig.examNumberStyle === "auto")
         fieldInfos.examNumber = "data:image/png;base64,${examNumber}";
 
-      if (cardConfig.aOrB && cardConfig.aOrBType === "auto")
+      if (cardConfig.aOrB && cardConfig.aOrBType === "auto") {
         fieldInfos.paperType = "data:image/png;base64,${paperType}";
+        fieldInfos.paperTypeName = "${paperTypeName}";
+      }
 
       this.cardConfig = cardConfig;
       this.pages = this.appendFieldInfo(pages, fieldInfos);
@@ -123,7 +125,11 @@ export default {
       });
     },
     async init() {
-      const card = await cardTempDetail(this.cardId);
+      const tempData = await cardTempDetail(this.cardId);
+      if (!tempData) {
+        this.$message.error("当前题卡还没开始创建!");
+        return;
+      }
       let stdInfo = {};
       if (this.studentNo) {
         stdInfo = await cardStudentInfo({
@@ -131,7 +137,7 @@ export default {
           studentNo: this.studentNo
         });
       }
-      const { cardConfig, pages } = JSON.parse(card.content);
+      const { cardConfig, pages } = JSON.parse(tempData.content);
       const fieldInfos = this.fetchFieldInfos(cardConfig, stdInfo);
 
       this.cardConfig = cardConfig;

+ 3 - 0
src/modules/exam-center/api.js

@@ -93,6 +93,9 @@ export const printTaskListPage = datas => {
 export const auditListPage = datas => {
   return $get("/api/print/card/card/listAuditPage", datas);
 };
+export const schoolList = () => {
+  return $get("/api/print/card/card/listSchools", {});
+};
 
 // custom upload-file
 export const customUpload = options => {

+ 22 - 12
src/modules/exam-center/components/CardOptionDialog.vue

@@ -9,7 +9,7 @@
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       append-to-body
-      @opened="visibleChange"
+      @open="visibleChange"
     >
       <div class="card-option-body">
         <p>请您选择创建题卡方式:</p>
@@ -23,6 +23,7 @@
               v-for="item in cardSourceTypes"
               :key="item.type"
               :label="item.type"
+              :disabled="item.disabled"
               >{{ item.name }}</el-radio
             >
           </el-radio-group>
@@ -31,7 +32,7 @@
         <div class="card-select" v-if="modalForm.cardSource === '0'">
           <el-select
             v-model="modalForm.refCardId"
-            style="width: 193px;"
+            style="width: 300px;"
             placeholder="请选择"
             clearable
           >
@@ -39,8 +40,9 @@
               v-for="item in cards"
               :key="item.id"
               :value="item.id"
-              :label="item.title"
-            ></el-option>
+              :label="item.name"
+            >
+            </el-option>
           </el-select>
           <span class="card-view" @click="toPreview">预览</span>
         </div>
@@ -104,22 +106,22 @@ export default {
         cardSource: "",
         refCardId: ""
       },
+      noExam: false,
+      onlySelect: false,
       cards: [],
       courses: [],
       cardSourceTypes: [],
       CARD_SOURCE_TYPE
     };
   },
-  computed: {
-    noExam() {
-      return !this.data.examId;
-    }
-  },
   methods: {
     visibleChange() {
+      this.noExam = !this.data["examId"];
+      this.onlySelect = this.data["cardSource"] === 0;
       this.getCardSourceTypes();
       this.modalForm.cardSource = this.cardSourceTypes[0].type;
       this.modalForm = this.$objAssign(this.modalForm, this.data);
+      this.modalForm.cardSource += "";
 
       if (this.noExam) {
         this.getCourseByUser();
@@ -129,11 +131,12 @@ export default {
     },
     getCardSourceTypes() {
       let cardSourceTypes = [];
-      Object.keys(CARD_SOURCE_TYPE).map(key => {
+      Object.keys(CARD_SOURCE_TYPE).forEach(key => {
         if (key === "0" && this.noExam) return;
         cardSourceTypes.push({
           type: key,
-          name: CARD_SOURCE_TYPE[key]
+          name: CARD_SOURCE_TYPE[key],
+          disabled: this.onlySelect && key !== "0"
         });
       });
       this.cardSourceTypes = cardSourceTypes;
@@ -143,10 +146,16 @@ export default {
       this.modalForm.courseName = course.courseName;
     },
     async getCardList() {
-      this.cards = await cardList({
+      const data = await cardList({
         courseNameCode: this.modalForm.courseNameCode,
         enablePaperType: this.modalForm.enablePaperType
       });
+      this.cards = data.map(item => {
+        return {
+          id: item.id,
+          name: `${item.title}(${item.cardCode})`
+        };
+      });
     },
     async getCourseByUser() {
       const data = await courseByUser();
@@ -189,6 +198,7 @@ export default {
 
       const data = { ...this.modalForm };
       if (data.cardSource !== "0") data.refCardId = "";
+      data.cardSource = data.cardSource * 1;
       this.$emit("confirm", data);
       this.cancel();
     },

+ 12 - 1
src/modules/exam-center/components/UploadSamplePaperDialog.vue

@@ -55,7 +55,7 @@
 
 <script>
 import UploadButton from "@/components/UploadButton";
-import { createCard } from "../api";
+import { createCard, saveWaitTask } from "../api";
 
 export default {
   name: "upload-sample-paper-dialog",
@@ -136,6 +136,17 @@ export default {
       this.isSubmit = false;
       if (!data) return;
 
+      // 自助创建时暂存任务
+      if (this.data.taskId && this.data.cardSource === "2") {
+        await saveWaitTask({
+          tcPExamTaskDetail: {
+            ...this.data,
+            cardId: data.cardId,
+            paperAttachmentId: this.modalForm.paperAttachmentId
+          }
+        });
+      }
+
       this.$message.success("申请成功!");
       this.$emit("confirm");
       this.cancel();

+ 98 - 20
src/modules/exam-center/views/CardAudit.vue

@@ -13,7 +13,7 @@
       <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
         <el-form-item label="学校名称:">
           <el-select
-            v-model="filter.schoolId"
+            v-model="filter.schId"
             style="width: 142px;"
             placeholder="请选择"
             clearable
@@ -54,25 +54,35 @@
           <el-button type="primary" icon="icon icon-search" @click="toPage(1)"
             >查询</el-button
           >
-          <!-- <el-button
+          <el-button
             type="warning"
             icon="icon icon-download"
-            @click="toPage(1)"
+            @click="toDownloadAll"
             v-if="filter.auditingStatus == 0"
             >批量下载试卷文件</el-button
-          > -->
+          >
         </el-form-item>
       </el-form>
     </div>
 
     <div class="part-box">
-      <el-table ref="TableList" :data="examPages" border stripe>
+      <el-table ref="TableList" :data="cards" border stripe>
         <el-table-column prop="schoolName" label="学校名称"></el-table-column>
-        <el-table-column prop="title" label="学院"></el-table-column>
-        <el-table-column prop="printTime" label="题卡ID"></el-table-column>
-        <el-table-column prop="printTime" label="申请时间"></el-table-column>
-        <el-table-column prop="cardStatus" label="申请人"></el-table-column>
-        <el-table-column prop="overtime" label="标题"></el-table-column>
+        <!-- <el-table-column prop="title" label="学院"></el-table-column> -->
+        <el-table-column prop="cardId" label="题卡ID"></el-table-column>
+        <el-table-column prop="createTime" label="申请时间"></el-table-column>
+        <el-table-column prop="userName" label="申请人"></el-table-column>
+        <el-table-column prop="title" label="标题">
+          <template slot-scope="scope">
+            <p
+              class="cont-link"
+              @click="downloadPaper(scope.row)"
+              title="点击下载试卷文件"
+            >
+              {{ scope.row.title }}
+            </p>
+          </template>
+        </el-table-column>
         <el-table-column label="操作" align="center">
           <template slot-scope="scope">
             <el-button
@@ -80,15 +90,15 @@
               type="text"
               icon="icon icon-modify"
               @click="toEdit(scope.row)"
-              title="确认"
+              title="设计题卡"
               v-if="filter.auditingStatus == 0"
             ></el-button>
             <el-button
               class="btn-table-icon"
               type="text"
               icon="icon icon-circle-right"
-              @click="toEdit(scope.row)"
-              title="确认"
+              @click="toPreview(scope.row)"
+              title="查看"
               v-else
             ></el-button>
           </template>
@@ -111,7 +121,8 @@
 
 <script>
 import { AUDITING_STATUS } from "@/constants/enumerate";
-import { auditListPage } from "../api";
+import { download } from "@/plugins/utils";
+import { auditListPage, schoolList } from "../api";
 
 export default {
   name: "card-check",
@@ -120,8 +131,7 @@ export default {
       filter: {
         auditingStatus: "0",
         cardCode: "",
-        schoolId: "",
-        collegeId: ""
+        schId: ""
       },
       current: 1,
       size: this.GLOBAL.pageSize,
@@ -130,14 +140,19 @@ export default {
       AUDITING_STATUS,
       schools: [],
       colleges: [],
-      examPages: [{ id: "" }],
+      cards: [],
       curExam: {}
     };
   },
   created() {
+    this.filter.schId = this.$ls.get("schoolId");
     this.getList();
+    this.getSchoolList();
   },
   methods: {
+    async getSchoolList() {
+      this.schools = await schoolList();
+    },
     async getList() {
       const datas = {
         ...this.filter,
@@ -145,19 +160,82 @@ export default {
         pageSize: this.size
       };
       const data = await auditListPage(datas);
-      this.examPages = data.records;
+      this.cards = data.records;
       this.total = data.total;
     },
     toPage(page) {
       this.current = page;
       this.getList();
     },
+    async downloadPaper(row) {
+      let load = this.$message({
+        iconClass: "el-message__icon el-icon-loading",
+        message: "Loading...",
+        duration: 0
+      });
+      const data = await download({
+        type: "get",
+        url: `/api/print/card/card/downloadSimplePaper?cardId=${row.cardId}`,
+        fileName: `${row.schoolName}_${row.cardId}${row.attachentType}`,
+        header: {
+          token: this.$ls.get("token")
+        }
+      }).catch(error => {
+        this.$message.error(error);
+      });
+
+      load.close();
+      if (!data) return;
+      this.$message.success("文件已开始下载!");
+    },
+    async toDownloadAll() {
+      let load = this.$message({
+        iconClass: "el-message__icon el-icon-loading",
+        message: "Loading...",
+        duration: 0
+      });
+
+      let filterNams = [AUDITING_STATUS[this.filter.auditingStatus]];
+      if (this.filter.cardCode) filterNams.push(this.filter.cardCode);
+      filterNams.push(`page-${this.current}.zip`);
+
+      const cardIds = this.cards.map(item => item.cardId).join(",");
+
+      const data = await download({
+        type: "get",
+        url: `/api/print/card/card/downloadPapers?cardIds=${cardIds}`,
+        fileName: filterNams.join("-"),
+        header: {
+          token: this.$ls.get("token")
+        }
+      }).catch(error => {
+        this.$message.error(error);
+      });
+
+      load.close();
+      if (!data) return;
+      this.$message.success("文件已开始下载!");
+    },
     selectAuditStatus(val) {
       this.filter.auditingStatus = val * 1;
+      this.toPage(1);
     },
     toEdit(row) {
-      this.curExam = row;
-      this.$refs.ModifyData.open();
+      this.$router.push({
+        name: "CardDesign",
+        params: {
+          cardId: row.cardId
+        }
+      });
+    },
+    toPreview(row) {
+      this.$router.push({
+        name: "CardPreview",
+        params: {
+          cardId: row.cardId,
+          viewType: "view"
+        }
+      });
     }
   }
 };

+ 0 - 1
src/modules/exam-center/views/CardManage.vue

@@ -128,7 +128,6 @@
 
     <!-- card-option-dialog -->
     <card-option-dialog
-      :data="{}"
       ref="CardOptionDialog"
       @confirm="cardConfirm"
     ></card-option-dialog>

+ 35 - 8
src/modules/exam-center/views/WaitTaskDetail.vue

@@ -41,8 +41,7 @@
             v-if="index === 0"
           >
             <span @click="toCreateCard"
-              ><i class="icon icon-plus-act"></i
-              >{{ task.cardId ? "预览题卡" : "创建答题卡" }}</span
+              ><i class="icon icon-plus-act"></i>{{ cardTodoName }}</span
             >
           </td>
         </tr>
@@ -105,6 +104,19 @@ export default {
   computed: {
     paperTypeFieldContent() {
       return this.PAPER_TYPE_FIELDS.join("/");
+    },
+    cardTodoName() {
+      let name = "创建答题卡";
+      if (this.task.cardId) {
+        if (this.task.cardSource === 0) {
+          name = "选择题卡";
+        } else if (this.task.cardSource === 1) {
+          name = "编辑题卡";
+        } else {
+          name = "查看题卡";
+        }
+      }
+      return name;
     }
   },
   mounted() {
@@ -118,9 +130,12 @@ export default {
         courseName: nameCode[0],
         courseCode: nameCode[1]
       });
-      this.pTypeEnable = this.task.enablePaperType.split(",").length > 1;
+      this.pTypeEnable =
+        this.task.enablePaperType &&
+        this.task.enablePaperType.split(",").length > 1;
       this.parsePaperAttachment();
       this.pTypeEnableChange(this.pTypeEnable);
+      this.task.enablePaperType = this.getEnablePaperType();
     },
     parsePaperAttachment() {
       const paperAttachment =
@@ -160,7 +175,18 @@ export default {
     },
     toCreateCard() {
       if (this.task.cardId) {
-        window.open(`/#/card/preview/${this.task.cardId}/view`);
+        if (this.task.cardSource === 0) {
+          this.$refs.CardOptionDialog.open();
+        } else if (this.task.cardSource === 1) {
+          this.$router.push({
+            name: "CardDesign",
+            params: {
+              cardId: this.task.cardId
+            }
+          });
+        } else {
+          window.open(`/#/card/preview/${this.task.cardId}/view`);
+        }
         return;
       }
       this.$refs.CardOptionDialog.open();
@@ -168,16 +194,17 @@ export default {
     cardConfirm(options) {
       this.task = Object.assign(this.task, options);
     },
+    getEnablePaperType() {
+      return this.curPaperAttachments.map(item => item.name).join(",");
+    },
     getTaskData() {
       let datas = { ...this.task };
       datas.taskId = this.taskId;
       datas.paperAttachmentId = JSON.stringify({
         paper: this.curPaperAttachments
       });
-      datas.enablePaperType = this.curPaperAttachments
-        .map(item => item.name)
-        .join(",");
-      return datas;
+      datas.enablePaperType = this.getEnablePaperType();
+      return { tcPExamTaskDetail: datas };
     },
     toSubmit() {
       this.$confirm(

+ 1 - 32
src/modules/login/views/Login.vue

@@ -25,22 +25,6 @@
               <i class="icon icon-lock" slot="prefix"></i
             ></el-input>
           </el-form-item>
-          <el-form-item prop="roleCode">
-            <el-select
-              style="width:175px;"
-              v-model="loginModel.roleCode"
-              placeholder="请选择角色"
-            >
-              <i class="icon icon-role" slot="prefix"></i>
-              <el-option
-                v-for="item in roles"
-                :key="item.id"
-                :label="item.roleName"
-                :value="item.roleCode"
-              >
-              </el-option>
-            </el-select>
-          </el-form-item>
           <el-form-item>
             <el-button
               style="width:116px;"
@@ -61,7 +45,6 @@
 <script>
 import { password } from "@/plugins/formRules";
 import { login } from "../api";
-import { roleList } from "@/modules/base/api";
 
 export default {
   name: "login",
@@ -69,8 +52,7 @@ export default {
     return {
       loginModel: {
         loginName: "sysadmin",
-        password: "123456",
-        roleCode: ""
+        password: "123456"
       },
       loginRules: {
         loginName: [
@@ -80,13 +62,6 @@ export default {
             trigger: "change"
           }
         ],
-        roleCode: [
-          {
-            required: true,
-            message: "请选择角色",
-            trigger: "change"
-          }
-        ],
         password
       },
       roles: [],
@@ -94,15 +69,9 @@ export default {
     };
   },
   mounted() {
-    this.getRoleList();
     this.$ls.clear();
   },
   methods: {
-    async getRoleList() {
-      const data = await roleList();
-      this.roles = data.records;
-      this.loginModel.roleCode = this.roles[0].roleCode;
-    },
     async submit(name) {
       const valid = await this.$refs[name].validate().catch(() => {});
       if (!valid) return;

+ 1 - 1
src/plugins/axios.js

@@ -44,7 +44,7 @@ const errorDataCallback = error => {
   message = message.indexOf("###") !== -1 ? "参数错误" : message;
 
   // TODO:自定义处理逻辑,以下为epcc实例
-  if (error.code === "105" || error.code === "106" || error.code === "102") {
+  if (error.code === "106") {
     message = "身份验证失效,请重新登录";
     MessageBox.confirm(message, "重新登陆?", {
       type: "error",

+ 12 - 3
src/plugins/utils.js

@@ -71,6 +71,11 @@ function download(option) {
 
     xhr.onload = function() {
       if (this.readyState === 4 && this.status === 200) {
+        if (this.response.size < 1024) {
+          reject("文件不存在!");
+          return;
+        }
+
         var blob = this.response;
         let pdfUrl = "";
         let uRl = window.URL || window.webkitURL;
@@ -85,14 +90,18 @@ function download(option) {
         document.body.appendChild(a);
         a.click();
         a.parentNode.removeChild(a);
-        resolve();
+        resolve(true);
       } else {
-        reject(this);
+        reject("请求错误!");
       }
     };
 
     if (opt.type.toUpperCase() === "POST") {
-      xhr.send(opt.data);
+      let fromData = new FormData();
+      for (let key in opt.data) {
+        fromData.append(key, opt.data[key]);
+      }
+      xhr.send(fromData);
     } else {
       xhr.send();
     }