zhangjie преди 5 години
родител
ревизия
42e100b8d8

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
     "crypto-js": "^4.0.0",
     "deepmerge": "^3.2.0",
     "element-ui": "^2.13.1",
+    "js-md5": "^0.7.3",
     "jsbarcode": "^3.11.0",
     "vue": "^2.6.10",
     "vue-ls": "^3.2.1",

+ 2 - 8
src/components/UploadButton.vue

@@ -4,7 +4,6 @@
     :headers="headers"
     :max-size="maxSize"
     :format="format"
-    :accept="accept"
     :data="uploadData"
     :before-upload="handleBeforeUpload"
     :on-error="handleError"
@@ -18,7 +17,7 @@
 </template>
 
 <script>
-import { fileMd5 } from "../plugins/crypto";
+import { fileMD5 } from "../plugins/md5";
 
 export default {
   name: "import-file",
@@ -60,11 +59,6 @@ export default {
       md5: ""
     };
   },
-  computed: {
-    accept() {
-      return this.format.map(el => `.${el}`).join();
-    }
-  },
   methods: {
     checkFileFormat(fileType) {
       const _file_format = fileType
@@ -89,7 +83,7 @@ export default {
         return Promise.reject();
       }
 
-      const md5 = await fileMd5(file);
+      const md5 = await fileMD5(file);
       this.headers["md5"] = md5;
 
       return true;

+ 2 - 2
src/constants/enumerate.js

@@ -1,7 +1,7 @@
 // 启用/禁用
 export const ABLE_TYPE = {
-  DISABLE: "禁用",
-  ENABLE: "启用"
+  0: "禁用",
+  1: "启用"
 };
 
 // 性别

+ 4 - 8
src/modules/base/api.js

@@ -4,15 +4,11 @@ import { $get, $post } from "@/plugins/axios";
 export const userListPage = datas => {
   return $get("/api/print/basic/user/list", datas);
 };
-export const userDetail = userId => {
-  return $get("/api/print/basic/sys/userQuery", { userId });
+export const userDetail = id => {
+  return $get("/api/print/basic/sys/userQuery", { id });
 };
 export const updateUser = datas => {
-  if (datas.id) {
-    return $post("/api/print/basic/user/add", datas);
-  } else {
-    return $post("/api/print/basic/user/update", datas);
-  }
+  return $post("/api/print/basic/user/update", datas);
 };
 export const ableUser = datas => {
   return $post("/api/print/basic/user/enable", datas);
@@ -29,7 +25,7 @@ export const saveCardRule = datas => {
   return $post("/api/print/basic/cardRule/add", datas);
 };
 export const warningRuleDetail = schoolId => {
-  return $post("/api/print/basic/wranRule/listBySchoolId", { schoolId });
+  return $get("/api/print/basic/warnRule/listBySchoolId", { schoolId });
 };
 export const saveWarningRule = datas => {
   return $post("/api/print/basic/warnRule/add", datas);

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

@@ -76,7 +76,7 @@ export default {
     },
     uploadSuccess(response) {
       this.$message.success("导入成功!");
-      this.extendColumns = response.data.data.map(item => {
+      this.extendColumns = response.data.map(item => {
         item.select = false;
         return item;
       });

+ 0 - 114
src/modules/base/components/ModifyData.vue

@@ -1,114 +0,0 @@
-<template>
-  <el-dialog
-    class="modify-data"
-    :visible.sync="modalIsShow"
-    :title="title"
-    top="10vh"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    @open="visibleChange"
-  >
-    <el-form
-      ref="modalFormComp"
-      :model="modalForm"
-      :rules="rules"
-      :key="modalForm.id"
-      label-width="100px"
-    >
-      <el-form-item prop="name" label="年级名称">
-        <el-input
-          v-model.trim="modalForm.name"
-          placeholder="请输入年级名称"
-          clearable
-        ></el-input>
-      </el-form-item>
-    </el-form>
-    <div slot="footer">
-      <el-button type="danger" @click="cancel" plain>取消</el-button>
-      <el-button type="primary" :disabled="isSubmit" @click="submit"
-        >确认</el-button
-      >
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { updateUser } from "../api";
-
-const initModalForm = {
-  id: "",
-  name: ""
-};
-
-export default {
-  name: "modify-data",
-  props: {
-    instance: {
-      type: Object,
-      default() {
-        return {};
-      }
-    }
-  },
-  computed: {
-    isEdit() {
-      return !!this.instance.id;
-    },
-    title() {
-      return (this.isEdit ? "编辑" : "新增") + "年级";
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      isSubmit: false,
-      modalForm: { ...initModalForm },
-      rules: {
-        name: [
-          {
-            required: true,
-            message: "请输入年级名称",
-            trigger: "change"
-          }
-        ]
-      }
-    };
-  },
-  methods: {
-    initData(val) {
-      if (val.id) {
-        this.modalForm = this.$objAssign(initModalForm, val);
-      } else {
-        this.modalForm = { ...initModalForm };
-      }
-    },
-    visibleChange() {
-      this.initData(this.instance);
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    },
-    async submit() {
-      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
-      if (!valid) return;
-
-      if (this.isSubmit) return;
-      this.isSubmit = true;
-      const data = await updateUser(this.modalForm).catch(() => {
-        this.isSubmit = false;
-      });
-
-      if (!data) return;
-
-      this.isSubmit = false;
-      this.$message.success(this.title + "成功!");
-      this.$emit("modified");
-      this.cancel();
-    }
-  }
-};
-</script>

+ 10 - 6
src/modules/base/components/RuleCard.vue

@@ -51,7 +51,7 @@
       :model="modalForm"
       style="max-width: 850px;"
     >
-      <el-form-item label="考务字段:">
+      <el-form-item label="考务字段:" style="min-height:200px;">
         <business-fields
           :data="modalForm"
           ref="BusinessFields"
@@ -157,6 +157,8 @@ export default {
       this.modalForm = Object.assign(this.modalForm, data[0]);
       this.modalForm.examNumberStyle += "";
       this.modalForm.paperType += "";
+      this.modalForm.examAbsent = Boolean(this.modalForm.examAbsent);
+      this.modalForm.writeSign = Boolean(this.modalForm.writeSign);
       this.dataReady = true;
     },
     async submit() {
@@ -174,12 +176,14 @@ export default {
         ...this.modalForm,
         ...this.$refs.BusinessFields.getSelectColumns()
       };
-      modals.examNumberStyle *= 1;
-      modals.paperType *= 1;
-      const data = await saveCardRule(modals).catch(() => {
-        this.isSubmit = false;
-      });
+      modals.examNumberStyle = Number(modals.examNumberStyle);
+      modals.paperType = Number(modals.paperType);
+      modals.examAbsent = Number(modals.examAbsent);
+      modals.writeSign = Number(modals.writeSign);
+      const data = await saveCardRule(modals).catch(() => {});
+      this.isSubmit = false;
       if (!data) return;
+
       this.$message.success("保存成功!");
     }
   }

+ 7 - 5
src/modules/base/components/RuleWarning.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="rule-warning rule-form">
     <p class="rule-tips">题卡/试卷制作计划预警:以“印刷计划”时间为参照</p>
-    <el-form ref="ModalForm" label-width="90px">
+    <el-form ref="ModalForm" label-width="100px" style="min-height: 200px;">
       <el-form-item
         v-for="(ruleItem, index) in warnRules"
         :key="index"
@@ -39,10 +39,13 @@ export default {
   data() {
     return {
       warnRules: [],
-      times: [1, 3, 5],
+      times: ["1", "3", "5"],
       isSubmit: false
     };
   },
+  created() {
+    this.init();
+  },
   methods: {
     async init() {
       this.warnRules = await warningRuleDetail();
@@ -57,9 +60,8 @@ export default {
         };
       });
 
-      const data = await saveWarningRule({ list }).catch(() => {
-        this.isSubmit = false;
-      });
+      const data = await saveWarningRule({ list }).catch(() => {});
+      this.isSubmit = false;
       if (!data) return;
       this.$message.success("保存成功!");
     }

+ 12 - 15
src/modules/base/views/UserEdit.vue

@@ -42,7 +42,7 @@
           style="width:88px;"
           type="primary"
           :disabled="isSubmit"
-          @click="submit('loginForm')"
+          @click="submit('modalFormComp')"
           >保存</el-button
         >
         <el-button style="width:88px;" @click="goback">返回</el-button>
@@ -96,10 +96,14 @@ export default {
   },
   methods: {
     async init() {
-      this.roles = await roleList();
-      const user = await userDetail(this.$router.params.userId);
-      this.modalForm = Object.assign({}, this.modalForm, user);
-      this.modalForm.userId = user.id;
+      const data = await roleList();
+      this.roles = data.records;
+      const user = await userDetail(this.$route.params.userId);
+      if (!user.account) {
+        this.$message.error("当前用户不存在!");
+        return;
+      }
+      this.modalForm = Object.assign({}, this.modalForm, user.account);
     },
     async submit(name) {
       const valid = await this.$refs[name].validate().catch(() => {});
@@ -107,18 +111,11 @@ export default {
 
       if (this.isSubmit) return;
       this.isSubmit = true;
-      const data = await updateUser(this.modalForm).catch(() => {
-        this.isSubmit = false;
-      });
+      const data = await updateUser(this.modalForm).catch(() => {});
+      this.isSubmit = false;
       if (!data) return;
 
-      this.isSubmit = false;
-      this.$ls.set("token", data.token, this.GLOBAL.authTimeout);
-      this.$ls.set("user", data.user, this.GLOBAL.authTimeout);
-      this.$store.commit("setUser", data.user);
-      this.$router.push({
-        name: "Home"
-      });
+      this.gaback();
     }
   }
 };

+ 22 - 13
src/modules/base/views/UserManage.vue

@@ -19,9 +19,9 @@
           >
             <el-option
               v-for="item in roles"
-              :key="item.id"
-              :value="item.id"
-              :label="item.name"
+              :key="item.roleCode"
+              :value="item.roleCode"
+              :label="item.roleName"
             ></el-option>
           </el-select>
         </el-form-item>
@@ -67,11 +67,15 @@
           align="center"
           :index="indexMethod"
         ></el-table-column>
-        <el-table-column prop="login_name" label="用户名"></el-table-column>
+        <el-table-column prop="loginName" label="用户名"></el-table-column>
         <el-table-column prop="name" label="姓名"></el-table-column>
         <el-table-column prop="roleName" label="角色"></el-table-column>
         <el-table-column prop="courseName" label="科目"></el-table-column>
-        <el-table-column prop="enable" label="状态"></el-table-column>
+        <el-table-column prop="enable" label="状态">
+          <template slot-scope="scope">
+            {{ ABLE_TYPE[scope.row.enable + ""] }}
+          </template>
+        </el-table-column>
         <el-table-column label="操作" align="center" width="120px">
           <template slot-scope="scope">
             <el-button
@@ -119,7 +123,7 @@
 
 <script>
 import { ABLE_TYPE } from "@/constants/enumerate";
-import { userListPage, ableUser, updatePwd } from "../api";
+import { userListPage, ableUser, updatePwd, roleList } from "../api";
 import UploadButton from "@/components/UploadButton";
 
 export default {
@@ -130,7 +134,7 @@ export default {
       filter: {
         loginName: "",
         roleCode: "",
-        enable: null
+        enable: ""
       },
       current: 1,
       size: this.GLOBAL.pageSize,
@@ -138,7 +142,7 @@ export default {
       visible: false,
       ABLE_TYPE,
       roles: [],
-      users: [{ id: "1", enable: false }],
+      users: [],
       // import
       uploadUrl: this.GLOBAL.domain + "/api/print/basic/user/add",
       uploadData: {
@@ -148,19 +152,23 @@ export default {
     };
   },
   created() {
+    this.getRoleList();
     this.getList();
   },
   methods: {
     indexMethod(index) {
       return (this.current - 1) * this.size + index + 1;
     },
+    async getRoleList() {
+      const data = await roleList();
+      this.roles = data.records;
+    },
     async getList() {
       const datas = {
         ...this.filter,
         pageNumber: this.current,
         pageSize: this.size
       };
-      datas.enable *= 1;
       const data = await userListPage(datas);
       this.users = data.records;
       this.total = data.total;
@@ -170,11 +178,12 @@ export default {
       this.getList();
     },
     async toEnable(row) {
+      const enable = Number(!row.enable);
       await ableUser({
-        userId: row.id,
-        enable: !row.enable
+        id: row.id,
+        enable
       });
-      row.enable = !row.enable;
+      row.enable = enable;
     },
     toEdit(row) {
       this.$router.push({
@@ -186,7 +195,7 @@ export default {
     },
     async toResetPwd(row) {
       await updatePwd({
-        userId: row.userId,
+        id: row.id,
         password: "123456"
       });
       this.$message.success("密码重置成功!");

+ 4 - 0
src/modules/card/components/elementPropEdit/EditImage.vue

@@ -86,6 +86,10 @@ export default {
     },
     imageChange(e) {
       const file = e.target.files[0];
+      if (file.size > 20480) {
+        this.$message.error("图片大小不要超过20kb");
+        return;
+      }
       const reader = new FileReader();
       reader.readAsDataURL(file);
       reader.onload = e => {

+ 14 - 14
src/modules/exam-center/api.js

@@ -5,45 +5,45 @@ export const waitTaskListPage = datas => {
   return $get("/api/print/exam/examTask/listNotDonePage", datas);
 };
 export const waitTaskDetail = id => {
-  return $get("/api/print/exam/notDone/detail", { id });
+  return $get("/api/print/exam/examTask/detailNotDone", { id });
 };
 export const saveWaitTask = datas => {
-  return $post("/api/print/exam/notDone/draft", datas);
+  return $post("/api/print/exam/examTask/draft", datas);
 };
 export const submitWaitTask = datas => {
-  return $post("/api/print/exam/notDone/submit", datas);
+  return $post("/api/print/exam/examTask/submit", datas);
 };
 
 // done-task
 export const doneTaskListPage = datas => {
   return $get("/api/print/exam/examTask/listDonePage", datas);
 };
-export const doneTaskDetail = datas => {
-  return $get("/api/print/exam/done/detail", datas);
+export const doneTaskDetail = taskId => {
+  return $get("/api/print/exam/examTask/detailDone", { taskId });
 };
 // 撤回
-export const revokeDoneTask = id => {
-  return $get("/api/print/exam/done/revoke", { id });
+export const revokeDoneTask = ({ taskId, examId }) => {
+  return $get("/api/print/exam/examTask/revoke", { taskId, examId });
 };
 
 // exam-manage
 export const examListPage = datas => {
-  return $get("/api/print/exam/listPage", datas);
+  return $get("/api/print/exam/exam/listPage", datas);
 };
 export const examList = () => {
-  return $get("/api/print/exam/list", {});
+  return $get("/api/print/exam/exam/list", {});
 };
 export const createExam = datas => {
-  return $post("/api/print/exam/add", datas);
+  return $post("/api/print/exam/exam/add", datas);
 };
 export const examRoomDetail = datas => {
-  return $get("/api/print/exam/detailRoomList", datas);
+  return $get("/api/print/exam/exam/listExamDetailPage", datas);
 };
 export const studentDetail = datas => {
-  return $get("/api/print/exam/detailStuentList", datas);
+  return $get("/api/print/exam/exam/listExamStudentPage", datas);
 };
 export const deleteExam = id => {
-  return $post("/api/print/exam/delete", { id });
+  return $post("/api/print/exam/exam/delete", { id });
 };
 
 // card-manage
@@ -53,7 +53,7 @@ export const allCardList = datas => {
 
 // print-manage
 export const printTaskListPage = datas => {
-  return $get("/api/print/manager/list", datas);
+  return $get("/api/print/exam/exam/listPrintPage", datas);
 };
 
 // card-audit

+ 1 - 1
src/modules/exam-center/views/CardAudit.vue

@@ -154,7 +154,7 @@ export default {
     },
     async getExamList() {
       const data = await examList();
-      this.exams = data.records.map(item => {
+      this.exams = data.map(item => {
         return {
           id: item.examCode,
           name: item.examName

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

@@ -156,7 +156,7 @@ export default {
     },
     async getExamList() {
       const data = await examList();
-      this.exams = data.records.map(item => {
+      this.exams = data.map(item => {
         return {
           id: item.examCode,
           name: item.examName

+ 2 - 2
src/modules/exam-center/views/DoneTask.vue

@@ -85,7 +85,7 @@ export default {
     };
   },
   created() {
-    // this.init();
+    this.init();
   },
   methods: {
     init() {
@@ -108,7 +108,7 @@ export default {
     },
     async getExamList() {
       const data = await examList();
-      this.exams = data.records.map(item => {
+      this.exams = data.map(item => {
         return {
           id: item.examCode,
           name: item.examName

+ 2 - 2
src/modules/exam-center/views/ExamManage.vue

@@ -125,7 +125,7 @@ export default {
     };
   },
   created() {
-    // this.init();
+    this.init();
   },
   methods: {
     init() {
@@ -148,7 +148,7 @@ export default {
     },
     async getExamList() {
       const data = await examList();
-      this.exams = data.records.map(item => {
+      this.exams = data.map(item => {
         return {
           id: item.examCode,
           name: item.examName

+ 1 - 1
src/modules/exam-center/views/PrintManage.vue

@@ -129,7 +129,7 @@ export default {
     },
     async getExamList() {
       const data = await examList();
-      this.exams = data.records.map(item => {
+      this.exams = data.map(item => {
         return {
           id: item.examCode,
           name: item.examName

+ 2 - 2
src/modules/exam-center/views/WaitTask.vue

@@ -85,7 +85,7 @@ export default {
     };
   },
   created() {
-    // this.init();
+    this.init();
   },
   methods: {
     init() {
@@ -108,7 +108,7 @@ export default {
     },
     async getExamList() {
       const data = await examList();
-      this.exams = data.records.map(item => {
+      this.exams = data.map(item => {
         return {
           id: item.examCode,
           name: item.examName

+ 2 - 4
src/modules/login/views/Login.vue

@@ -108,12 +108,10 @@ export default {
 
       if (this.isSubmit) return;
       this.isSubmit = true;
-      const data = await login(this.loginModel).catch(() => {
-        this.isSubmit = false;
-      });
+      const data = await login(this.loginModel).catch(() => {});
+      this.isSubmit = false;
       if (!data) return;
 
-      this.isSubmit = false;
       this.$ls.set("token", data.token, this.GLOBAL.authTimeout);
       this.$ls.set("schoolId", data.account.schoolId, this.GLOBAL.authTimeout);
       this.$ls.set("user", data.account, this.GLOBAL.authTimeout);

+ 0 - 43
src/plugins/crypto.js

@@ -1,43 +0,0 @@
-const CryptoJS = require("crypto-js");
-
-/**
- *
- * @param {String} str 字符串
- */
-export const md5 = str => {
-  return CryptoJS.MD5(str + "").toString();
-};
-
-/**
- *
- * @param {File} file 二进制文件
- */
-export const fileMd5 = file => {
-  return new Promise((resolve, reject) => {
-    const reader = new FileReader();
-    reader.onloadend = function() {
-      const arrayBuffer = reader.result;
-      resolve(CryptoJS.MD5(arrayBuffer).toString());
-    };
-    reader.onerror = function(err) {
-      reject(err);
-    };
-    reader.readAsArrayBuffer(file);
-  });
-};
-
-/**
- *
- * @param {String} key 编码的key值
- * @param {String} content 需要编码的内容
- */
-export const aes = (key, content) => {
-  const encodeKey = CryptoJS.enc.Utf8.parse(key);
-
-  const enstr = CryptoJS.AES.encrypt(content + "", encodeKey, {
-    mode: CryptoJS.mode.ECB,
-    padding: CryptoJS.pad.Pkcs7
-  }).toString();
-
-  return encodeURIComponent(enstr);
-};

+ 23 - 0
src/plugins/md5.js

@@ -0,0 +1,23 @@
+const md5 = require("js-md5");
+
+/**
+ *
+ * @param {any} str 字符串
+ */
+export const MD5 = content => {
+  return md5(content);
+};
+
+export const fileMD5 = file => {
+  return new Promise((resolve, reject) => {
+    const reader = new FileReader();
+    reader.onloadend = function() {
+      const arrayBuffer = reader.result;
+      resolve(md5(arrayBuffer));
+    };
+    reader.onerror = function(err) {
+      reject(err);
+    };
+    reader.readAsArrayBuffer(file);
+  });
+};

+ 6 - 1
vue.config.js

@@ -1,4 +1,3 @@
-
 var webpack = require("webpack");
 var TerserPlugin = require("terser-webpack-plugin");
 var devProxy = {};
@@ -22,6 +21,12 @@ var config = {
         Quill: "quill/dist/quill.js"
       }
     ]);
+    // 限制base64图片的大小在20kb以下
+    config.module
+      .rule("images")
+      .use("url-loader")
+      .loader("url-loader")
+      .tap(options => Object.assign(options, { limit: 20480 }));
   }
 };
 

+ 5 - 0
yarn.lock

@@ -5025,6 +5025,11 @@ js-levenshtein@^1.1.3:
   resolved "https://registry.npm.taobao.org/js-levenshtein/download/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"
   integrity sha1-xs7ljrNVA3LfjeuF+tXOZs4B1Z0=
 
+js-md5@^0.7.3:
+  version "0.7.3"
+  resolved "https://registry.npm.taobao.org/js-md5/download/js-md5-0.7.3.tgz#b4f2fbb0b327455f598d6727e38ec272cd09c3f2"
+  integrity sha1-tPL7sLMnRV9ZjWcn447Ccs0Jw/I=
+
 js-message@1.0.5:
   version "1.0.5"
   resolved "https://registry.npm.taobao.org/js-message/download/js-message-1.0.5.tgz#2300d24b1af08e89dd095bc1a4c9c9cfcb892d15"