zhangjie 4 年之前
父节点
当前提交
ecaabbc8df
共有 5 个文件被更改,包括 33 次插入25 次删除
  1. 4 0
      config.sample.json
  2. 3 3
      src/modules/client/views/CheckInfo.vue
  3. 19 20
      src/modules/client/views/GroupScan.vue
  4. 1 1
      src/plugins/imageUpload.js
  5. 6 1
      vue.config.js

+ 4 - 0
config.sample.json

@@ -0,0 +1,4 @@
+{
+  "domain": "http://localhost:9000",
+  "input": ""
+}

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

@@ -84,7 +84,7 @@ export default {
     };
     };
   },
   },
   computed: {
   computed: {
-    ...mapState("client", ["curSubject", "curLevel"]),
+    ...mapState("client", ["curSubject", "curLevel", "clientConfig"]),
     user() {
     user() {
       return this.$store.state.user;
       return this.$store.state.user;
     }
     }
@@ -105,8 +105,8 @@ export default {
     },
     },
     confirm() {
     confirm() {
       this.modalIsShow = false;
       this.modalIsShow = false;
-      this.setCurLevel(this.modalFsorm.level);
-      const scanName = this.config.packageScan ? "GroupScan" : "LineScan";
+      this.setCurLevel(this.modalForm.level);
+      const scanName = this.clientConfig.packageScan ? "GroupScan" : "LineScan";
       this.$router.push({ name: scanName });
       this.$router.push({ name: scanName });
     }
     }
   }
   }

+ 19 - 20
src/modules/client/views/GroupScan.vue

@@ -93,7 +93,6 @@
 
 
 <script>
 <script>
 const fs = require("fs");
 const fs = require("fs");
-import db from "../../../plugins/db";
 import { getStudentGroupByExamNumber } from "../api";
 import { getStudentGroupByExamNumber } from "../api";
 import {
 import {
   decodeImageCode,
   decodeImageCode,
@@ -103,7 +102,7 @@ import {
 import { deepCopy } from "../../../plugins/utils";
 import { deepCopy } from "../../../plugins/utils";
 import ScanAreaDialog from "../components/ScanAreaDialog";
 import ScanAreaDialog from "../components/ScanAreaDialog";
 import ScanExceptionDialog from "../components/ScanExceptionDialog";
 import ScanExceptionDialog from "../components/ScanExceptionDialog";
-import { mapState, mapMutations, mapActions } from "vuex";
+import { mapState } from "vuex";
 
 
 export default {
 export default {
   name: "group-scan",
   name: "group-scan",
@@ -118,6 +117,7 @@ export default {
         showAction: true,
         showAction: true,
         message: ""
         message: ""
       },
       },
+      scanList: [],
       historyLimit: 30,
       historyLimit: 30,
       historyList: [],
       historyList: [],
       setT: "",
       setT: "",
@@ -130,7 +130,6 @@ export default {
   },
   },
   computed: {
   computed: {
     ...mapState("client", [
     ...mapState("client", [
-      "scanNo",
       "unuploadNo",
       "unuploadNo",
       "curSubject",
       "curSubject",
       "clientConfig",
       "clientConfig",
@@ -160,6 +159,9 @@ export default {
     },
     },
     curSubjectStartCountTime() {
     curSubjectStartCountTime() {
       return this.startCountTime[this.curSubject.id];
       return this.startCountTime[this.curSubject.id];
+    },
+    scanNo() {
+      return this.scanList.length;
     }
     }
   },
   },
   mounted() {
   mounted() {
@@ -170,8 +172,6 @@ export default {
     this.getInitFile();
     this.getInitFile();
   },
   },
   methods: {
   methods: {
-    ...mapMutations("client", ["setScanNo", "setStartCountTime"]),
-    ...mapActions("client", ["updateStartCountTime"]),
     async test() {
     async test() {
       this.curImage = getEarliestFile();
       this.curImage = getEarliestFile();
       const codeAreas = {
       const codeAreas = {
@@ -348,6 +348,9 @@ export default {
           isManual: type === "MANUAL"
           isManual: type === "MANUAL"
         });
         });
         this.updateHistory(this.curStudent);
         this.updateHistory(this.curStudent);
+
+        // 更新采集数
+        this.updateScanList(this.curStudent.examNumber);
       }
       }
       // 删除扫描文件,继续开始下一个任务
       // 删除扫描文件,继续开始下一个任务
       fs.unlinkSync(this.curImage.url);
       fs.unlinkSync(this.curImage.url);
@@ -389,15 +392,16 @@ export default {
         });
         });
       }
       }
 
 
-      // 更新采集数
-      this.updateScanNo();
-
-      this.allReScan();
+      this.scanList = [];
+      this.students = [];
+      this.historyList = [];
+      this.restartInitFile();
     },
     },
     allReScan() {
     allReScan() {
       this.$Modal.confirm({
       this.$Modal.confirm({
         content: "确定要整包重扫吗?",
         content: "确定要整包重扫吗?",
         onOk: () => {
         onOk: () => {
+          this.scanList = [];
           this.students = [];
           this.students = [];
           this.historyList = [];
           this.historyList = [];
           this.restartInitFile();
           this.restartInitFile();
@@ -413,18 +417,13 @@ export default {
         (this.curTaskScanCount - 6) * 71;
         (this.curTaskScanCount - 6) * 71;
     },
     },
     // count
     // count
-    async updateScanNo() {
-      const scanNo = await db.getScanCount(
-        this.curSubjectStartCountTime,
-        this.curSubject.id
-      );
-      this.setScanNo(scanNo);
+    updateScanList(examNumber) {
+      if (this.scanList.indexOf(examNumber) === -1) {
+        this.scanList.push(examNumber);
+      }
     },
     },
-    async resetStartCountTime() {
-      await this.updateStartCountTime({
-        [this.curSubject.id]: Math.floor(Date.now() / 1000)
-      });
-      await this.updateScanNo();
+    resetStartCountTime() {
+      this.scanList = [];
       this.historyList = [];
       this.historyList = [];
     },
     },
     // history
     // history

+ 1 - 1
src/plugins/imageUpload.js

@@ -91,7 +91,7 @@ class UploadTask {
     this.taskRunning = true;
     this.taskRunning = true;
     setTimeout(() => {
     setTimeout(() => {
       this.runUploadTask();
       this.runUploadTask();
-    });
+    }, 100);
   }
   }
 
 
   async runUploadTask() {
   async runUploadTask() {

+ 6 - 1
vue.config.js

@@ -16,7 +16,12 @@ var config = {
   pluginOptions: {
   pluginOptions: {
     electronBuilder: {
     electronBuilder: {
       builderOptions: {
       builderOptions: {
-        extraFiles: ["extra/**"]
+        extraFiles: [
+          "extra/imagemagick/**",
+          "extra/zxing/**",
+          "extra/database/org.rdb",
+          "config.sample.json"
+        ]
       }
       }
     }
     }
   }
   }