zhangjie 4 年 前
コミット
4fc9c6eedf

+ 1 - 1
src/modules/base/components/ModifyCardRule.vue

@@ -28,7 +28,7 @@
         </el-form-item>
         <el-form-item prop="remark" label="备注:">
           <el-input
-            v-model.trim="modalForm.remark"
+            v-model="modalForm.remark"
             type="textarea"
             resize="none"
             :rows="2"

+ 1 - 1
src/modules/base/components/ModifyTemplate.vue

@@ -28,7 +28,7 @@
         </el-form-item>
         <el-form-item prop="remark" label="备注:">
           <el-input
-            v-model.trim="modalForm.remark"
+            v-model="modalForm.remark"
             type="textarea"
             resize="none"
             :rows="2"

+ 2 - 2
src/modules/exam/components/ApplyContent.vue

@@ -76,7 +76,7 @@
       <h4 class="mb-2">备注说明:</h4>
       <el-input
         class="mb-2"
-        v-model.trim="curTaskApply.remark"
+        v-model="curTaskApply.remark"
         type="textarea"
         resize="none"
         :rows="2"
@@ -117,7 +117,7 @@
       <el-input
         v-if="IS_AUDIT"
         class="mb-2"
-        v-model.trim="reason"
+        v-model="reason"
         type="textarea"
         resize="none"
         :rows="5"

+ 30 - 5
src/modules/exam/components/BatchAddExamTask.vue

@@ -20,7 +20,6 @@
         <el-form-item prop="batchNo" label="命题任务表:">
           <upload-file-view
             :upload-url="uploadExamTaskUrl"
-            @upload-error="uplaodError"
             @upload-success="uploadExamTaskSuccess"
             ref="ExamTaskUploadFileView"
             v-if="modalIsShow"
@@ -106,7 +105,7 @@
     </div>
 
     <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="save"
+      <el-button type="primary" :disabled="isSubmit" @click="toSave"
         >确认</el-button
       >
       <el-button type="danger" @click="cancel" plain>取消</el-button>
@@ -136,6 +135,7 @@ export default {
       modalForm: { ...initModalForm },
       createTime: [],
       tasks: [],
+      batchConfirmMessage: "",
       rules: {
         batchNo: [
           {
@@ -169,6 +169,7 @@ export default {
       this.modalForm = { ...initModalForm };
       this.tasks = [];
       this.createTime = [];
+      this.batchConfirmMessage = "";
 
       this.$nextTick(() => {
         this.$refs.modalFormComp.clearValidate();
@@ -189,6 +190,22 @@ export default {
         this.modalForm.endTime = "";
       }
     },
+    toSave() {
+      if (!this.batchConfirmMessage) {
+        this.save();
+        return;
+      }
+
+      this.$confirm(`${this.batchConfirmMessage}, 是否继续提交?`, "提示", {
+        cancelButtonClass: "el-button--danger is-plain",
+        confirmButtonClass: "el-button--primary",
+        type: "warning"
+      })
+        .then(() => {
+          this.save();
+        })
+        .catch(() => {});
+    },
     async save() {
       const valid = await this.$refs.modalFormComp.validate().catch(() => {});
       if (!valid) return;
@@ -217,12 +234,20 @@ export default {
       this.cancel();
     },
     // upload-handler
-    uplaodError(errorData) {
-      this.$notify.error({ title: "错误提示", message: errorData.message });
-    },
+    // uplaodError(errorData) {
+    // let message = errorData.message;
+    // try {
+    //   message = JSON.parse(errorData.error);
+    //   message = message.map(item => item.excelErrorType).join(",");
+    // } catch (msg) {
+    //   console.error(msg);
+    // }
+    // if (message) this.$notify.error({ title: "错误提示", message });
+    // },
     uploadExamTaskSuccess(data) {
       this.$message.success("上传成功!");
       this.modalForm.batchNo = data.batchNo;
+      this.batchConfirmMessage = data.errorMsg;
       this.tasks = data.tasks.map(item => {
         item.userId = item.users.length ? item.users[0].id : "";
         return item;

+ 6 - 2
src/modules/exam/components/ModifyExamTask.vue

@@ -99,7 +99,11 @@
     </div>
 
     <div slot="footer">
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
+      <el-button
+        v-if="editType !== 'PREVIEW'"
+        type="primary"
+        :disabled="isSubmit"
+        @click="submit"
         >确认</el-button
       >
       <el-button type="danger" @click="cancel" plain>取消</el-button>
@@ -177,7 +181,7 @@ export default {
               if (/^[0-9a-zA-Z]{3,30}$/.test(value)) {
                 callback();
               } else {
-                callback(new Error("试卷编号只能包字母数字,长度在3-30之间"));
+                callback(new Error("试卷编号只能包字母数字,长度在3-30之间"));
               }
             },
             trigger: "change"

+ 1 - 1
src/modules/exam/views/TaskReviewManage.vue

@@ -220,7 +220,7 @@
         <el-form-item prop="reason">
           <el-input
             class="mb-2"
-            v-model.trim="auditModal.reason"
+            v-model="auditModal.reason"
             type="textarea"
             resize="none"
             :rows="5"

+ 9 - 8
src/plugins/axios.js

@@ -42,7 +42,7 @@ const errorCallback = error => {
  * @param {Object} error Response中的data信息
  */
 const errorDataCallback = error => {
-  let message = error.message || error.error || "数据错误";
+  let message = error.message || error.error || "请求错误";
 
   if (error.code === 4010006 || error.code === 5000012) {
     if (unauthMsgBoxIsShow) return error;
@@ -65,6 +65,7 @@ const errorDataCallback = error => {
   } else {
     Notification.error({ title: "错误提示", message });
   }
+
   return error;
 };
 
@@ -84,7 +85,7 @@ const successCallback = data => {
   if (data.code === 200) {
     return data.data;
   } else {
-    throw new Error(errorDataCallback(data));
+    return Promise.reject(data.data);
   }
 };
 
@@ -105,7 +106,7 @@ const $get = (url, datas) => {
       return successCallback(rep.data);
     })
     .catch(error => {
-      throw new Error(errorCallback(error));
+      return Promise.reject(errorCallback(error));
     });
 };
 
@@ -128,7 +129,7 @@ const $postParam = (url, datas, config = {}) => {
       return successCallback(rep.data);
     })
     .catch(error => {
-      throw new Error(errorCallback(error));
+      return Promise.reject(errorCallback(error));
     });
 };
 
@@ -153,7 +154,7 @@ const $post = (url, datas, config = {}) => {
       return successCallback(rep.data);
     })
     .catch(error => {
-      throw new Error(errorCallback(error));
+      return Promise.reject(errorCallback(error));
     });
 };
 
@@ -174,7 +175,7 @@ const $del = (url, datas) => {
       return rep.data;
     })
     .catch(error => {
-      throw new Error(errorCallback(error));
+      return Promise.reject(errorCallback(error));
     });
 };
 
@@ -195,7 +196,7 @@ const $put = (url, datas) => {
       return rep.data;
     })
     .catch(error => {
-      throw new Error(errorCallback(error));
+      return Promise.reject(errorCallback(error));
     });
 };
 
@@ -216,7 +217,7 @@ const $patch = (url, datas) => {
       return rep.data;
     })
     .catch(error => {
-      throw new Error(errorCallback(error));
+      return Promise.reject(errorCallback(error));
     });
 };