zhangjie il y a 5 ans
Parent
commit
9b60bfc460

+ 1 - 1
.env

@@ -1,2 +1,2 @@
 NODE_ENV=development
-VUE_APP_DOMAIN=http://localhost:9000
+VUE_APP_DOMAIN=

+ 1 - 1
dev-proxy.copy.js

@@ -1,6 +1,6 @@
 module.exports = {
   "/api/": {
-    target: "http://192.168.10.239:9888",
+    target: "http://192.168.10.227:9000",
     changeOrigin: true,
     pathRewrite: {
       "^/api": "/"

BIN
extra/database/client.rdb


BIN
extra/database/org.rdb


+ 0 - 9
src/assets/styles/pages.less

@@ -397,15 +397,6 @@
   /* scan-picture */
   &-picture {
     box-shadow: 0px 20px 30px 0px rgba(0, 0, 0, 0.1);
-    img {
-      display: block;
-      position: absolute;
-      max-width: 100%;
-      max-height: 100%;
-      left: 50%;
-      top: 50%;
-      transform: translate(-50%, -50%);
-    }
   }
   // scan-progress
   &-progress {

+ 4 - 4
src/main.js

@@ -60,7 +60,7 @@ var queue = [];
 axios.interceptors.request.use(
   config => {
     // 显示loading提示
-    if (!queue.length) {
+    if (!queue.length && !config.url.includes("api/file")) {
       load = ViewUI.Message.loading({
         content: "Loading...",
         duration: 0
@@ -89,7 +89,7 @@ axios.interceptors.request.use(
     // 串联并发请求,延时处理是为防止多个loading实例闪屏。
     setTimeout(() => {
       queue.shift();
-      if (!queue.length) load();
+      if (!queue.length) load && load();
     }, 100);
     return Promise.reject(error);
   }
@@ -99,7 +99,7 @@ axios.interceptors.response.use(
     // 关闭loading提示
     setTimeout(() => {
       queue.shift();
-      if (!queue.length) load();
+      if (!queue.length) load && load();
     }, 100);
     return response;
   },
@@ -107,7 +107,7 @@ axios.interceptors.response.use(
     // 关闭loading提示
     setTimeout(() => {
       queue.shift();
-      if (!queue.length) load();
+      if (!queue.length) load && load();
     }, 100);
     return Promise.reject(error);
   }

+ 3 - 3
src/mixins/authUnvalidMixin.js

@@ -7,9 +7,9 @@ export default {
   watch: {
     showToLoginModel(val) {
       if (val) {
-        this.$confirm({
-          content: "身份验证失效,是否重新登陆?",
-          btnStyleSort: true,
+        this.$Modal.confirm({
+          title: "操作警告",
+          content: "身份验证失效,是否重新登陆?",
           onOk: () => {
             this.$store.commit("setShowToLoginModel", false);
             this.$router.push({ name: "Login" });

+ 18 - 7
src/mixins/initStoreMixin.js

@@ -3,23 +3,34 @@ import db from "../plugins/db";
 export default {
   methods: {
     async initScanArea(subjects) {
-      const storeScanArea = await db.getDict("scanArea", {});
+      const storeDict = await db.getAllDict();
+      const needInitDict = ["scanArea"];
+      for (let key in needInitDict) {
+        if (
+          !Object.prototype.hasOwnProperty.call(storeDict, needInitDict[key])
+        ) {
+          await db.initDict(needInitDict[key]);
+        }
+      }
+
+      const storeScanArea = await db.getDict("scanArea", "");
+      const scanArea = storeScanArea ? JSON.parse(storeScanArea) : {};
+
       let newScanArea = {};
       subjects.map(subject => {
         let info = { ...subject };
-        if (
-          storeScanArea[subject.id] &&
-          storeScanArea[subject.id].collectConfig
-        )
-          info.collectConfig = storeScanArea[subject.id].collectConfig;
+        if (scanArea[subject.id] && scanArea[subject.id].collectConfig)
+          info.collectConfig = scanArea[subject.id].collectConfig;
 
         newScanArea[subject.id] = info;
       });
+
       this.$store.commit("client/setScanArea", newScanArea);
     },
     async initStore() {
       const curDate = this.$store.state.client.startCountTime;
-      const scanNo = await db.countScanList(curDate);
+
+      const scanNo = await db.getScanCount(curDate);
       const uploadNo = await db.getUploadCount(curDate);
 
       this.$store.commit("client/setScanNo", scanNo);

+ 5 - 4
src/mixins/uploadTaskMixin.js

@@ -12,7 +12,7 @@ import UploadTask from "../plugins/imageUpload";
 export default {
   data() {
     return {
-      uploadTask: "",
+      uploadTask: null,
       setT: ""
     };
   },
@@ -26,6 +26,7 @@ export default {
       const id = await db.saveUploadInfo(task).catch(err => {
         console.log(err);
       });
+
       if (id) {
         task.id = id;
         this.uploadTask.addUploadTask(task);
@@ -38,10 +39,7 @@ export default {
     },
     async initUploadTask() {
       if (this.setT) clearTimeout(this.setT);
-      // 今日事今日毕的前提下,上传任务只取当天未上传的记录。
-      // const curDate = getLocalDate();
       const unuploadList = await db.searchUploadList({
-        // createdTime: curDate,
         isUpload: 0
       });
       // 创建上传任务
@@ -51,6 +49,7 @@ export default {
           this.uploadSuccessCallback(curUploadTask);
         },
         uploadTaskOverCallback: () => {
+          if (!this.uploadTask) return;
           this.setT = setTimeout(() => {
             this.initUploadTask();
           }, 5 * 1000);
@@ -58,7 +57,9 @@ export default {
       });
     },
     stopUpload() {
+      if (this.setT) clearTimeout(this.setT);
       this.uploadTask && this.uploadTask.stopUploadTask();
+      this.uploadTask = null;
     }
   }
 };

+ 3 - 6
src/modules/client/api.js

@@ -1,7 +1,7 @@
 import { $post, $get } from "@/plugins/axios";
 
 export const uploadFormalImage = (options, datas, config) => {
-  const pathInfo = options.imageEnc ? "image/uploadsheet" : "ms-sheet";
+  const pathInfo = options.imageEncrypt ? "image/uploadsheet" : "ms-sheet";
   return $post(
     `/api/file/${pathInfo}/${options.examId}/${options.subjectId}/${options.examNumber}`,
     datas,
@@ -9,7 +9,7 @@ export const uploadFormalImage = (options, datas, config) => {
   );
 };
 export const uploadSliceImage = (options, datas, config) => {
-  const pathInfo = options.imageEnc ? "image/upload" : "ms-slice";
+  const pathInfo = options.imageEncrypt ? "image/upload" : "ms-slice";
   return $post(
     `/api/file/${pathInfo}/${options.examId}/${options.subjectId}/${options.examNumber}`,
     datas,
@@ -26,10 +26,7 @@ export const uploadStudent = datas => {
   return $post(`/api/upload/student/${datas.subjectId}`, datas);
 };
 export const saveCollectLog = datas => {
-  return $post(`/api/marklog/saveCollectLog`, {
-    ...datas,
-    workId: datas.examId
-  });
+  return $post(`/api/marklog/saveCollectLog`, datas);
 };
 export const getLevelList = examId => {
   return $get(`/api/exam/getLevel/${examId}`);

+ 5 - 1
src/modules/client/components/ScanExceptionDialog.vue

@@ -40,6 +40,7 @@
             <div class="input-append">
               <Input
                 size="default"
+                key="1"
                 v-model.trim="modalForm.examNumber"
                 placeholder="请扫码输入"
                 style="width: 220px;"
@@ -51,6 +52,7 @@
               >
               <Input
                 size="default"
+                key="2"
                 v-model.trim="modalForm.examNumber"
                 placeholder="请在此输入考号"
                 style="width: 220px;"
@@ -177,6 +179,7 @@ export default {
       this.checkStudent();
     },
     async checkStudent() {
+      if (!this.modalForm.examNumber) return;
       const data = await getStudentByExamNumber(this.modalForm.examNumber);
       this.modalForm.studentName = data.name;
     },
@@ -200,7 +203,8 @@ export default {
     async confirm() {
       const valid = await this.$refs.modalFormComp.validate();
       if (!valid) return;
-      this.$emit("confirm", this.modalForm, this.scanType);
+      this.$emit("confirm", this.modalForm.examNumber, this.scanType);
+      this.cancel();
     }
   },
   beforeDestroy() {

+ 2 - 0
src/modules/client/store.js

@@ -51,6 +51,8 @@ const actions = {
     const scanArea = Object.assign({}, state.scanArea, {
       [curSubject.id]: curSubject
     });
+    console.log(scanArea);
+
     commit("setCurSubject", curSubject);
     commit("setScanArea", scanArea);
     db.setDict("scanArea", JSON.stringify(scanArea));

+ 12 - 2
src/modules/client/views/Camera.vue

@@ -45,7 +45,7 @@
 </template>
 
 <script>
-import { mapMutations } from "vuex";
+import { mapState, mapMutations } from "vuex";
 
 export default {
   name: "camera",
@@ -66,6 +66,9 @@ export default {
       }
     };
   },
+  computed: {
+    ...mapState("client", ["curSubject", "clientConfig"])
+  },
   methods: {
     ...mapMutations("client", ["setCamera"]),
     inputOver(code) {
@@ -80,7 +83,14 @@ export default {
       if (!valid) return;
 
       this.setCamera(this.modalForm.camera);
-      this.$router.push({ name: "ScanArea" });
+
+      const scanRouter = this.clientConfig.packageScan
+        ? "GroupScan"
+        : "LineScan";
+      const routerName = this.curSubject.collectConfig
+        ? scanRouter
+        : "ScanArea";
+      this.$router.push({ name: routerName });
     }
   }
 };

+ 1 - 1
src/modules/client/views/CheckInfo.vue

@@ -98,7 +98,7 @@ export default {
     confirm() {
       this.modalIsShow = false;
       this.setCurLevel(this.modalFsorm.level);
-      const scanName = this.config.isPackageMode ? "GroupScan" : "LineScan";
+      const scanName = this.config.packageScan ? "GroupScan" : "LineScan";
       this.$router.push({ name: scanName });
     }
   }

+ 9 - 27
src/modules/client/views/GroupScan.vue

@@ -61,7 +61,7 @@
           ><span>{{ task.examNumber }}</span>
         </p>
         <div class="history-item-body">
-          <img :src="task.url" :alt="task.name" />
+          <img :src="task.formalImgPath" :alt="task.name" />
         </div>
       </div>
     </div>
@@ -87,7 +87,7 @@
 
 <script>
 const fs = require("fs");
-import db from "../plugins/db";
+import db from "../../../plugins/db";
 import { getStudentGroupByExamNumber } from "../api";
 import {
   decodeImageCode,
@@ -113,26 +113,7 @@ export default {
         message: ""
       },
       historyLimit: 30,
-      historyList: [
-        {
-          name: "张一二三",
-          examNumber: "1901040084",
-          url:
-            "http://127.0.0.1:9000/api/file/image/download/31/1/734/1?random=676176fc-24cd-407a-a7bc-fabc49bd2dbc"
-        },
-        {
-          name: "张一二三",
-          examNumber: "1901040084",
-          url:
-            "http://127.0.0.1:9000/api/file/image/download/31/1/733/1?random=e2966291-ffba-4b19-985d-0cad9ae1b75b"
-        },
-        {
-          name: "张一二三",
-          examNumber: "1901040084",
-          url:
-            "http://127.0.0.1:9000/api/file/image/download/31/1/731/1?random=b305c27c-76d0-4477-a1ef-c9b8554a4671"
-        }
-      ],
+      historyList: [],
       setT: "",
       holding: false,
       curImage: {
@@ -177,7 +158,7 @@ export default {
       this.$Message.error("请先完成采集设置!");
       return;
     }
-    // this.getInitFile();
+    this.getInitFile();
     // this.test();
   },
   methods: {
@@ -287,7 +268,8 @@ export default {
         // 考号不合法异常
         this.curException = {
           showAction: false,
-          message: validRes.message
+          message: validRes.message,
+          collectConfig: this.getCurCollectConfig()
         };
         this.$refs.ScanExceptionDialog.open();
       }
@@ -338,7 +320,7 @@ export default {
       const result = await saveOutputImage(
         this.curImage.url,
         {
-          workId: this.user.workId,
+          examId: this.user.examId,
           subjectId: this.curSubject.id,
           examNumber
         },
@@ -389,9 +371,9 @@ export default {
           formalImgPath: curStudent.formalImgPath,
           sliceImgPath: curStudent.sliceImgPath,
           isManual: curStudent.isManual,
-          imageEnc: this.clientConfig.imageEnc,
+          imageEncrypt: this.clientConfig.imageEncrypt,
           level: this.curLevel,
-          clientUserId: this.user.id,
+          clientUserId: this.user.userId,
           clientUsername: this.user.name,
           clientUserLoginTime: this.user.loginTime
         });

+ 9 - 27
src/modules/client/views/LineScan.vue

@@ -49,7 +49,7 @@
           ><span>{{ task.examNumber }}</span>
         </p>
         <div class="history-item-body">
-          <img :src="task.url" :alt="task.name" />
+          <img :src="task.formalImgPath" :alt="task.name" />
         </div>
       </div>
     </div>
@@ -75,7 +75,7 @@
 
 <script>
 const fs = require("fs");
-import db from "../plugins/db";
+import db from "../../../plugins/db";
 import { getStudentByExamNumber } from "../api";
 import {
   decodeImageCode,
@@ -101,26 +101,7 @@ export default {
         message: ""
       },
       historyLimit: 30,
-      historyList: [
-        {
-          name: "张一二三",
-          examNumber: "1901040084",
-          url:
-            "http://127.0.0.1:9000/api/file/image/download/31/1/734/1?random=676176fc-24cd-407a-a7bc-fabc49bd2dbc"
-        },
-        {
-          name: "张一二三",
-          examNumber: "1901040084",
-          url:
-            "http://127.0.0.1:9000/api/file/image/download/31/1/733/1?random=e2966291-ffba-4b19-985d-0cad9ae1b75b"
-        },
-        {
-          name: "张一二三",
-          examNumber: "1901040084",
-          url:
-            "http://127.0.0.1:9000/api/file/image/download/31/1/731/1?random=b305c27c-76d0-4477-a1ef-c9b8554a4671"
-        }
-      ],
+      historyList: [],
       setT: "",
       holding: false,
       curImage: {
@@ -147,7 +128,7 @@ export default {
       this.$Message.error("请先完成采集设置!");
       return;
     }
-    // this.getInitFile();
+    this.getInitFile();
     // this.test();
   },
   methods: {
@@ -250,7 +231,8 @@ export default {
         // 考号不合法异常
         this.curException = {
           showAction: false,
-          message: validRes.message
+          message: validRes.message,
+          collectConfig: this.getCurCollectConfig()
         };
         this.$refs.ScanExceptionDialog.open();
       }
@@ -282,7 +264,7 @@ export default {
       const result = await saveOutputImage(
         this.curImage.url,
         {
-          workId: this.user.workId,
+          examId: this.user.examId,
           subjectId: this.curSubject.id,
           examNumber
         },
@@ -321,9 +303,9 @@ export default {
         formalImgPath: this.curStudent.formalImgPath,
         sliceImgPath: this.curStudent.sliceImgPath,
         isManual: this.curStudent.isManual,
-        imageEnc: this.clientConfig.imageEnc,
+        imageEncrypt: this.clientConfig.imageEncrypt,
         level: this.curLevel,
-        clientUserId: this.user.id,
+        clientUserId: this.user.userId,
         clientUsername: this.user.name,
         clientUserLoginTime: this.user.loginTime
       });

+ 3 - 3
src/modules/client/views/ScanArea.vue

@@ -31,7 +31,7 @@ export default {
       },
       curSetting: {},
       config: {
-        isPackageMode: true
+        packageScan: true
       },
       setT: ""
     };
@@ -62,10 +62,10 @@ export default {
       });
       this.updateCurSubject(curSubject);
 
-      if (this.clientConfig.isLevelKnown) {
+      if (this.clientConfig.paperStage) {
         this.$router.push({ name: "CheckInfo" });
       } else {
-        const scanName = this.clientConfig.isPackageMode
+        const scanName = this.clientConfig.packageScan
           ? "GroupScan"
           : "LineScan";
         this.$router.push({ name: scanName });

+ 8 - 4
src/modules/client/views/Subject.vue

@@ -14,6 +14,13 @@
         </ul>
       </div>
     </div>
+
+    <div
+      style="position:fixed;width:30px;height:30px;bottom: 20px;right: 20px;z-index:999;"
+      @click="$router.push({ name: 'Login' })"
+    >
+      login
+    </div>
   </div>
 </template>
 
@@ -44,11 +51,8 @@ export default {
       this.setCurSubject(curSuject);
 
       this.$router.push({
-        name: "GroupScan"
+        name: "Camera"
       });
-      // this.$router.push({
-      //   name: "Camera"
-      // });
     }
   }
 };

+ 3 - 3
src/modules/example/views/DataManage.vue

@@ -4,7 +4,7 @@
       <Form ref="FilterForm" label-position="left" :label-width="80" inline>
         <FormItem label="工作">
           <WorkSelect
-            v-model.trim="filter.workId"
+            v-model.trim="filter.examId"
             placeholder="请选择工作"
             style="width:200px;"
           ></WorkSelect>
@@ -12,7 +12,7 @@
         <FormItem label="科目">
           <SubjectSelect
             v-model.trim="filter.subjectId"
-            :work-id="filter.workId"
+            :work-id="filter.examId"
             placeholder="请选择科目"
             style="width:200px;"
           ></SubjectSelect>
@@ -96,7 +96,7 @@ export default {
         name: "",
         status: "",
         userId: "",
-        workId: "",
+        examId: "",
         subjectId: ""
       },
       current: 1,

+ 9 - 2
src/plugins/axios.js

@@ -1,6 +1,7 @@
 import axios from "axios";
 import qs from "qs";
 import ViewUI from "view-design";
+import { objTypeOf } from "./utils";
 // import router from "../router";
 // import Vue from "vue";
 
@@ -101,9 +102,15 @@ const $get = (url, datas) => {
  * @param {String} url 请求地址
  * @param {Object} datas 请求数据
  */
-const $post = (url, datas) => {
+const $post = (url, datas, config = {}) => {
+  let sqDatas = "";
+  if (objTypeOf(datas) === "object" || objTypeOf(datas) === "array") {
+    sqDatas = qs.stringify(datas, { allowDots: true });
+  } else {
+    sqDatas = datas;
+  }
   return axios
-    .post(url, datas)
+    .post(url, sqDatas, config)
     .then(rep => {
       return successCallback(rep.data);
     })

+ 8 - 8
src/plugins/db.js

@@ -21,7 +21,7 @@ function init() {
 }
 
 function saveUploadInfo(params) {
-  const sql = `INSERT INTO scan (examId, examName, subjectId, subjectName, examNumber, studentName, siteCode, roomCode, formalImgPath, sliceImgPath,isManual,imageEnc, clientUserId, clientUsername, clientUserLoginTime, isUpload,createdTime, fininshTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`;
+  const sql = `INSERT INTO scan (examId, examName, subjectId, subjectName, examNumber, studentName, siteCode, roomCode, formalImgPath, sliceImgPath,isManual,imageEncrypt,level,clientUserId, clientUsername, clientUserLoginTime, isUpload,createdTime, fininshTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`;
   const datas = [
     params.examId,
     params.examName,
@@ -34,7 +34,8 @@ function saveUploadInfo(params) {
     params.formalImgPath,
     params.sliceImgPath,
     params.isManual,
-    params.imageEnc,
+    params.imageEncrypt,
+    params.level,
     params.clientUserId,
     params.clientUsername,
     params.clientUserLoginTime,
@@ -44,10 +45,9 @@ function saveUploadInfo(params) {
   ];
   return new Promise((resolve, reject) => {
     db.serialize(() => {
-      db.run(sql, datas, err => {
-        if (err) reject("save upload info to database fail!");
-
-        resolve(this.lastId);
+      db.run(sql, datas, function(err) {
+        if (err) reject(err);
+        resolve(this.lastID);
       });
     });
   });
@@ -80,7 +80,7 @@ function countScanList(params) {
 }
 
 function getUploadCount(limitTime) {
-  const sql = `SELECT COUNT(1) AS count FROM scan WHERE strftime('%s',fininshTime) >= '${limitTime}' AND isUpload = 1`;
+  const sql = `SELECT COUNT(1) AS count FROM scan WHERE strftime('%s',fininshTime, 'utc') >= '${limitTime}' AND isUpload = 1`;
 
   return new Promise((resolve, reject) => {
     db.all(sql, (err, rows) => {
@@ -91,7 +91,7 @@ function getUploadCount(limitTime) {
   });
 }
 function getScanCount(limitTime) {
-  const sql = `SELECT COUNT(DISTINCT ticketNumber) AS count FROM scan WHERE strftime('%s',createdTime) >= '${limitTime}'`;
+  const sql = `SELECT COUNT(DISTINCT examNumber) AS count FROM scan WHERE strftime('%s',createdTime, 'utc') >= '${limitTime}'`;
 
   return new Promise((resolve, reject) => {
     db.all(sql, (err, rows) => {

+ 1 - 3
src/plugins/env.js

@@ -1,8 +1,5 @@
-import config from "../config";
-
 const path = require("path");
 const fs = require("fs");
-const { getLocalDate } = require("./utils");
 const homePath = path.dirname(process.execPath);
 const storePath = path.join(homePath, "stores");
 const extraPath =
@@ -97,6 +94,7 @@ export {
   getHomeDir,
   getExtraDir,
   getInputDir,
+  getOutputDir,
   getTmpDir,
   makeDirSync,
   getDatabaseDir,

+ 9 - 3
src/plugins/imageOcr.js

@@ -88,6 +88,7 @@ async function saveOutputImage(imgPath, paperInfo, collectConfig) {
 function saveFormalImage(imgPath, paperInfo) {
   const outputFormalPath = getOutputImagePath(paperInfo, "formal");
   fs.copyFileSync(imgPath, outputFormalPath);
+  return outputFormalPath;
 }
 
 function saveSliceImage(imgPath, paperInfo, collectConfig) {
@@ -131,10 +132,15 @@ function saveSliceImage(imgPath, paperInfo, collectConfig) {
   });
 }
 
-function getOutputImagePath({ workId, subjectId, examNumber }, type) {
-  const outputDir = path.join(getOutputDir(type), workId, subjectId);
+function getOutputImagePath(paperInfo, type) {
+  const outputDir = path.join(
+    getOutputDir(type),
+    paperInfo.examId + "",
+    paperInfo.subjectId + ""
+  );
+
   if (!fs.existsSync(outputDir)) makeDirSync(outputDir);
-  return path.join(outputDir, examNumber + ".jpg");
+  return path.join(outputDir, paperInfo.examNumber + ".jpg");
 }
 
 /**

+ 30 - 11
src/plugins/imageUpload.js

@@ -1,5 +1,6 @@
 const fs = require("fs");
 const crypto = require("crypto");
+import { formatDate } from "./utils";
 import {
   uploadSliceImage,
   uploadFormalImage,
@@ -37,10 +38,23 @@ function toUploadStudent(options) {
     subjectId: options.subjectId,
     examNumber: options.examNumber,
     absent: false,
-    manual: options.isManual
+    manual: !!options.isManual
   };
   return uploadStudent(datas);
 }
+function toSaveCollectLog(options) {
+  const datas = {
+    workId: options.examId,
+    subjectId: options.subjectId,
+    examNumber: options.examNumber,
+    clientUsername: options.clientUsername,
+    clientUserId: options.clientUserId,
+    clientUserLoginTime: options.clientUserLoginTime,
+    time: formatDate(),
+    name: options.studentName
+  };
+  return saveCollectLog(datas);
+}
 
 /**
  * 获取文件的MD5
@@ -74,7 +88,9 @@ class UploadTask {
 
   async startUploadTask() {
     this.taskRunning = true;
-    this.runUploadTask();
+    setTimeout(() => {
+      this.runUploadTask();
+    });
   }
 
   async runUploadTask() {
@@ -84,17 +100,20 @@ class UploadTask {
     }
     const curTask = this.getCurTask();
 
-    const uploadRequest = [
-      toUploadImg(curTask, "formal"),
-      toUploadImg(curTask, "slice")
-    ];
-    const uploadResult = await Promise.all(uploadRequest).catch(() => {});
+    let uploadFormalRes = true;
+    await toUploadImg(curTask, "formal").catch(() => {
+      uploadFormalRes = false;
+    });
+    let uploadSliceRes = true;
+    await toUploadImg(curTask, "slice").catch(() => {
+      uploadSliceRes = false;
+    });
 
-    if (uploadResult) {
-      const updateRequest = [toUploadStudent(curTask), saveCollectLog(curTask)];
-      const updateResult = await Promise.all(updateRequest).catch(() => {});
+    if (uploadFormalRes && uploadSliceRes) {
+      const updateStdRes = await toUploadStudent(curTask).catch(() => {});
+      const saveLogRes = await toSaveCollectLog(curTask).catch(() => {});
 
-      if (updateResult) {
+      if (updateStdRes && saveLogRes) {
         this.uploadSuccessCallback(curTask);
       }
     }

+ 2 - 1
src/plugins/utils.js

@@ -16,7 +16,8 @@ function objTypeOf(obj) {
     "[object RegExp]": "regExp",
     "[object Undefined]": "undefined",
     "[object Null]": "null",
-    "[object Object]": "object"
+    "[object Object]": "object",
+    "[object FormData]": "formData"
   };
   return map[toString.call(obj)];
 }

+ 5 - 3
src/views/Home.vue

@@ -54,11 +54,12 @@ export default {
   },
   created() {
     this.examName = this.$ls.get("user", { examName: "" }).examName;
-    const scanBackRouter = this.clientConfig.isLevelKnown
+    const scanBackRouter = this.clientConfig.paperStage
       ? "CheckInfo"
       : "ScanArea";
     this.backRouters.GroupScan = scanBackRouter;
     this.backRouters.LineScan = scanBackRouter;
+    this.initUploadTask();
   },
   methods: {
     logout() {
@@ -69,8 +70,9 @@ export default {
       const curRouteName = this.$route.name;
       const backRouter = this.backRouters[curRouteName];
       if (curRouteName === "GroupScan" || curRouteName === "LineScan") {
-        this.$confirm({
-          content: "当前正处于采集状态,确定要退出吗?",
+        this.$Modal.confirm({
+          title: "操作警告",
+          content: "当前正处于采集状态,确定要退出吗?",
           onOk: () => {
             this.$router.push({ name: backRouter });
           }

+ 7 - 4
src/views/Login.vue

@@ -49,7 +49,7 @@ export default {
   data() {
     return {
       loginModel: {
-        loginname: "test1",
+        loginname: "scan01",
         password: "111111"
       },
       loginRules: {
@@ -82,6 +82,7 @@ export default {
       if (!data) return;
 
       data.loginTime = formatDate();
+      data.name = this.loginModel.loginname;
       this.$store.commit(
         "client/setStartCountTime",
         Math.floor(Date.now() / 1000)
@@ -93,9 +94,11 @@ export default {
       this.$ls.set("user", data);
       this.$store.commit("setUser", data);
       this.$store.commit("client/setClientConfig", {
-        imageEnc: data.imageEnc,
-        isPackageMode: data.isPackageMode,
-        isLevelKnown: data.isLevelKnown
+        imageEncrypt: !data.paramSetting.imageEncrypt,
+        // imageEncrypt: data.paramSetting.imageEncrypt,
+        packageScan: !data.paramSetting.packageScan,
+        // packageScan: data.paramSetting.packageScan,
+        paperStage: data.paramSetting.paperStage
       });
       this.$router.push({
         name: "Subject"