zhangjie преди 4 години
родител
ревизия
5020c8fe3f

BIN
extra/database/client.rdb


+ 5 - 4
src/assets/styles/home.less

@@ -32,6 +32,7 @@
   top: 0;
   top: 0;
   left: 0;
   left: 0;
   z-index: 100;
   z-index: 100;
+
   .head-back {
   .head-back {
     float: left;
     float: left;
   }
   }
@@ -103,11 +104,11 @@
 .move-bar {
 .move-bar {
   position: fixed;
   position: fixed;
   top: 0;
   top: 0;
-  right: 150px;
-  left: 80px;
-  height: 50px;
-  cursor: move;
+  right: 0;
+  left: 0;
+  height: 20px;
   z-index: 9999;
   z-index: 9999;
+  -webkit-app-region: drag;
 }
 }
 
 
 /* other */
 /* other */

+ 0 - 5
src/assets/styles/login.less

@@ -8,11 +8,6 @@
   background-color: @background;
   background-color: @background;
   min-height: 483px;
   min-height: 483px;
   overflow: auto;
   overflow: auto;
-  &-header {
-    width: auto;
-    right: 0;
-    left: auto;
-  }
   &-body {
   &-body {
     width: 600px;
     width: 600px;
     height: 483px;
     height: 483px;

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

@@ -628,6 +628,23 @@
       margin-right: 10px;
       margin-right: 10px;
     }
     }
   }
   }
+  .exception-back {
+    position: absolute;
+    width: 30px;
+    height: 30px;
+    color: #929396;
+    font-size: 30px;
+    top: 20px;
+    right: 20px;
+    z-index: 99;
+    cursor: pointer;
+    > i {
+      vertical-align: top;
+    }
+    &:hover {
+      color: @pink;
+    }
+  }
   .exception-code-area {
   .exception-code-area {
     margin-bottom: 32px;
     margin-bottom: 32px;
   }
   }
@@ -637,6 +654,16 @@
   .exception-form {
   .exception-form {
     float: left;
     float: left;
   }
   }
+  .exception-search {
+    width: 30px;
+    font-size: 20px;
+    color: @fontSub;
+    vertical-align: middle;
+    cursor: pointer;
+    &:hover {
+      color: @fontMain;
+    }
+  }
   .exception-actions {
   .exception-actions {
     float: right;
     float: right;
     > button {
     > button {

+ 2 - 39
src/components/MoveBar.vue

@@ -3,47 +3,10 @@
 </template>
 </template>
 
 
 <script>
 <script>
-const { BrowserWindow } = require("electron").remote;
-
 export default {
 export default {
   name: "move-bar",
   name: "move-bar",
   data() {
   data() {
-    return {
-      iniPos: [],
-      win: null
-    };
-  },
-  mounted() {
-    const _this = this;
-    let [_x, _y] = [0, 0];
-    let isMoving = false;
-
-    const moveHandle = function(e) {
-      if (!isMoving) return;
-      const left = Math.floor(_this.iniPos[0] + e.screenX - _x);
-      const top = Math.floor(_this.iniPos[1] + e.screenY - _y);
-      _this.win.setPosition(left, top);
-    };
-
-    const upHandle = function(e) {
-      isMoving = false;
-      document.removeEventListener("mousemove", moveHandle);
-      document.removeEventListener("mouseup", upHandle);
-    };
-
-    document.addEventListener("mousedown", function(e) {
-      if (_this.$el !== e.target) return;
-      isMoving = true;
-
-      _x = e.screenX;
-      _y = e.screenY;
-      _this.win = BrowserWindow.getFocusedWindow();
-      _this.iniPos = _this.win.getPosition();
-
-      document.addEventListener("mousemove", moveHandle);
-      document.addEventListener("mouseup", upHandle);
-    });
-  },
-  methods: {}
+    return {};
+  }
 };
 };
 </script>
 </script>

+ 8 - 5
src/main.js

@@ -18,6 +18,9 @@ import "./assets/styles/index.less";
 import { initConfigData } from "@/plugins/env";
 import { initConfigData } from "@/plugins/env";
 
 
 Vue.use(ViewUI);
 Vue.use(ViewUI);
+ViewUI.Message.config({
+  top: 10
+});
 Vue.use(VueLocalStorage);
 Vue.use(VueLocalStorage);
 Vue.use(globalVuePlugins);
 Vue.use(globalVuePlugins);
 
 
@@ -60,7 +63,7 @@ var queue = [];
 axios.interceptors.request.use(
 axios.interceptors.request.use(
   config => {
   config => {
     // 显示loading提示
     // 显示loading提示
-    if (!queue.length && !config.url.includes("api/file")) {
+    if (!queue.length && !config["showTinyTips"]) {
       load = ViewUI.Message.loading({
       load = ViewUI.Message.loading({
         content: "Loading...",
         content: "Loading...",
         duration: 0
         duration: 0
@@ -75,10 +78,10 @@ axios.interceptors.request.use(
     }
     }
 
 
     // 为请求头添加token信息
     // 为请求头添加token信息
-    let token = Vue.ls.get("token");
-    if (token) {
-      config.headers["Authorization"] = token;
-    }
+    // let token = Vue.ls.get("token");
+    // if (token) {
+    //   config.headers["Authorization"] = token;
+    // }
 
 
     // 设置延迟时效
     // 设置延迟时效
     config.timeout = 10 * 60 * 1000;
     config.timeout = 10 * 60 * 1000;

+ 22 - 17
src/mixins/initStoreMixin.js

@@ -3,16 +3,6 @@ import db from "../plugins/db";
 export default {
 export default {
   methods: {
   methods: {
     async initScanArea(subjects) {
     async initScanArea(subjects) {
-      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 storeScanArea = await db.getDict("scanArea", "");
       const scanArea = storeScanArea ? JSON.parse(storeScanArea) : {};
       const scanArea = storeScanArea ? JSON.parse(storeScanArea) : {};
 
 
@@ -27,14 +17,29 @@ export default {
 
 
       this.$store.commit("client/setScanArea", newScanArea);
       this.$store.commit("client/setScanArea", newScanArea);
     },
     },
-    async initStore() {
-      const curDate = this.$store.state.client.startCountTime;
-
-      const scanNo = await db.getScanCount(curDate);
-      const uploadNo = await db.getUploadCount(curDate);
+    async initStartCountTime(subjects) {
+      const storeStartCountTime = await db.getDict("startCountTime", "");
 
 
-      this.$store.commit("client/setScanNo", scanNo);
-      this.$store.commit("client/setUploadNo", uploadNo);
+      let startCountTime = {};
+      if (storeStartCountTime) {
+        startCountTime = JSON.parse(storeStartCountTime);
+      } else {
+        subjects.map(subject => {
+          startCountTime[subject.id] = 0;
+        });
+      }
+      this.$store.commit("client/setStartCountTime", startCountTime);
+    },
+    async initStore() {
+      const storeDict = await db.getAllDict();
+      const needInitDict = ["scanArea", "startCountTime"];
+      for (let key in needInitDict) {
+        if (
+          !Object.prototype.hasOwnProperty.call(storeDict, needInitDict[key])
+        ) {
+          await db.initDict(needInitDict[key]);
+        }
+      }
     }
     }
   }
   }
 };
 };

+ 0 - 5
src/mixins/uploadTaskMixin.js

@@ -16,11 +16,6 @@ export default {
       setT: ""
       setT: ""
     };
     };
   },
   },
-  computed: {
-    uploadNo() {
-      return this.$store.state.uploadNo;
-    }
-  },
   methods: {
   methods: {
     async addUploadTask(task) {
     async addUploadTask(task) {
       const id = await db.saveUploadInfo(task).catch(err => {
       const id = await db.saveUploadInfo(task).catch(err => {

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

@@ -5,7 +5,7 @@ export const uploadFormalImage = (options, datas, config) => {
   return $post(
   return $post(
     `/api/file/${pathInfo}/${options.examId}/${options.subjectId}/${options.examNumber}`,
     `/api/file/${pathInfo}/${options.examId}/${options.subjectId}/${options.examNumber}`,
     datas,
     datas,
-    config
+    { ...config, showTinyTips: true }
   );
   );
 };
 };
 export const uploadSliceImage = (options, datas, config) => {
 export const uploadSliceImage = (options, datas, config) => {
@@ -13,7 +13,7 @@ export const uploadSliceImage = (options, datas, config) => {
   return $post(
   return $post(
     `/api/file/${pathInfo}/${options.examId}/${options.subjectId}/${options.examNumber}`,
     `/api/file/${pathInfo}/${options.examId}/${options.subjectId}/${options.examNumber}`,
     datas,
     datas,
-    config
+    { ...config, showTinyTips: true }
   );
   );
 };
 };
 export const getStudentGroupByExamNumber = examNumber => {
 export const getStudentGroupByExamNumber = examNumber => {
@@ -23,10 +23,12 @@ export const getStudentByExamNumber = examNumber => {
   return $get(`/api/exam/getStudent/${examNumber}`);
   return $get(`/api/exam/getStudent/${examNumber}`);
 };
 };
 export const uploadStudent = datas => {
 export const uploadStudent = datas => {
-  return $post(`/api/upload/student/${datas.subjectId}`, datas);
+  return $post(`/api/upload/student/${datas.subjectId}`, datas, {
+    showTinyTips: true
+  });
 };
 };
 export const saveCollectLog = datas => {
 export const saveCollectLog = datas => {
-  return $post(`/api/marklog/saveCollectLog`, datas);
+  return $post(`/api/marklog/saveCollectLog`, datas, { showTinyTips: true });
 };
 };
 export const getLevelList = examId => {
 export const getLevelList = examId => {
   return $get(`/api/level/${examId}`);
   return $get(`/api/level/${examId}`);

+ 19 - 0
src/modules/client/components/ScanExceptionDialog.vue

@@ -11,6 +11,13 @@
     <div slot="header"></div>
     <div slot="header"></div>
 
 
     <div class="exception-body">
     <div class="exception-body">
+      <div
+        class="exception-back"
+        @click="toScanInput"
+        v-if="scanType !== 'SCAN'"
+      >
+        <Icon type="ios-close-circle-outline" />
+      </div>
       <h2 class="exception-title" v-if="scanType === 'SCAN'">
       <h2 class="exception-title" v-if="scanType === 'SCAN'">
         <i class="icon ivu-icon-error-hollow"></i>
         <i class="icon ivu-icon-error-hollow"></i>
         <span>{{ curException.message }}</span>
         <span>{{ curException.message }}</span>
@@ -61,10 +68,16 @@
               placeholder="请在此输入考号"
               placeholder="请在此输入考号"
               style="width: 200px;"
               style="width: 200px;"
               @on-blur="checkStudent"
               @on-blur="checkStudent"
+              @on-change="examNumberChange"
               autofocus
               autofocus
               v-else
               v-else
             >
             >
             </Input>
             </Input>
+            <Icon
+              class="exception-search"
+              type="md-search"
+              @click="checkStudent"
+            />
           </FormItem>
           </FormItem>
           <FormItem>
           <FormItem>
             <Input
             <Input
@@ -185,6 +198,9 @@ export default {
       const data = await getStudentByExamNumber(this.modalForm.examNumber);
       const data = await getStudentByExamNumber(this.modalForm.examNumber);
       this.modalForm.studentName = data.name;
       this.modalForm.studentName = data.name;
     },
     },
+    examNumberChange() {
+      this.modalForm.studentName = null;
+    },
     cancel() {
     cancel() {
       this.modalIsShow = false;
       this.modalIsShow = false;
     },
     },
@@ -203,6 +219,9 @@ export default {
     toHandInput() {
     toHandInput() {
       this.scanType = "MANUAL";
       this.scanType = "MANUAL";
     },
     },
+    toScanInput() {
+      this.scanType = "SCAN";
+    },
     async confirm() {
     async confirm() {
       const valid = await this.$refs.modalFormComp.validate();
       const valid = await this.$refs.modalFormComp.validate();
       if (!valid) return;
       if (!valid) return;

+ 7 - 8
src/modules/client/store.js

@@ -7,7 +7,6 @@ const state = {
   curSubject: {},
   curSubject: {},
   scanArea: {},
   scanArea: {},
   scanNo: 0, // 已采集数量(从当前设置的计数时间算起)
   scanNo: 0, // 已采集数量(从当前设置的计数时间算起)
-  uploadNo: 0, // 已上传数量(从当前设置的计数时间算起),
   unuploadNo: 0, // 未上传数量(从当前设置的计数时间算起),
   unuploadNo: 0, // 未上传数量(从当前设置的计数时间算起),
   startCountTime: null, // 计数时间,默认:当前登录时间
   startCountTime: null, // 计数时间,默认:当前登录时间
   showToLoginModel: false
   showToLoginModel: false
@@ -38,24 +37,24 @@ const mutations = {
   setScanNo(state, scanNo) {
   setScanNo(state, scanNo) {
     state.scanNo = scanNo;
     state.scanNo = scanNo;
   },
   },
-  setUploadNo(state, uploadNo) {
-    state.uploadNo = uploadNo;
-  },
   setUnuploadNo(state, unuploadNo) {
   setUnuploadNo(state, unuploadNo) {
     state.unuploadNo = unuploadNo;
     state.unuploadNo = unuploadNo;
   }
   }
 };
 };
 
 
 const actions = {
 const actions = {
-  updateCurSubject({ state, commit }, curSubject) {
+  async updateCurSubject({ state, commit }, curSubject) {
     const scanArea = Object.assign({}, state.scanArea, {
     const scanArea = Object.assign({}, state.scanArea, {
       [curSubject.id]: curSubject
       [curSubject.id]: curSubject
     });
     });
-    console.log(scanArea);
-
     commit("setCurSubject", curSubject);
     commit("setCurSubject", curSubject);
     commit("setScanArea", scanArea);
     commit("setScanArea", scanArea);
-    db.setDict("scanArea", JSON.stringify(scanArea));
+    await db.setDict("scanArea", JSON.stringify(scanArea));
+  },
+  async updateStartCountTime({ commit }, data) {
+    const startCountTime = Object.assign({}, state.startCountTime, data);
+    commit("setStartCountTime", startCountTime);
+    await db.setDict("startCountTime", JSON.stringify(startCountTime));
   }
   }
 };
 };
 
 

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

@@ -3,7 +3,7 @@
     <div class="part-head">
     <div class="part-head">
       <h2>获取相机编号</h2>
       <h2>获取相机编号</h2>
     </div>
     </div>
-    <div class="camera-form" @keyup.enter="submit">
+    <div class="camera-form">
       <Form
       <Form
         ref="modalFormComp"
         ref="modalFormComp"
         :model="modalForm"
         :model="modalForm"

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

@@ -103,7 +103,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 } from "vuex";
+import { mapState, mapMutations, mapActions } from "vuex";
 
 
 export default {
 export default {
   name: "group-scan",
   name: "group-scan",
@@ -157,6 +157,9 @@ export default {
     },
     },
     isFinished() {
     isFinished() {
       return this.taskCount && this.curTaskScanCount === this.taskCount;
       return this.taskCount && this.curTaskScanCount === this.taskCount;
+    },
+    curSubjectStartCountTime() {
+      return this.startCountTime[this.curSubject.id];
     }
     }
   },
   },
   mounted() {
   mounted() {
@@ -164,11 +167,11 @@ export default {
       this.$Message.error("请先完成采集设置!");
       this.$Message.error("请先完成采集设置!");
       return;
       return;
     }
     }
-
     this.getInitFile();
     this.getInitFile();
   },
   },
   methods: {
   methods: {
     ...mapMutations("client", ["setScanNo", "setStartCountTime"]),
     ...mapMutations("client", ["setScanNo", "setStartCountTime"]),
+    ...mapActions("client", ["updateStartCountTime"]),
     async test() {
     async test() {
       this.curImage = getEarliestFile();
       this.curImage = getEarliestFile();
       const codeAreas = {
       const codeAreas = {
@@ -414,15 +417,25 @@ export default {
       const scanNo = await db.getScanCount(this.startCountTime);
       const scanNo = await db.getScanCount(this.startCountTime);
       this.setScanNo(scanNo);
       this.setScanNo(scanNo);
     },
     },
-    resetStartCountTime() {
-      this.setStartCountTime(Math.floor(Date.now() / 1000));
-      this.updateScanNo();
+    async resetStartCountTime() {
+      await this.updateStartCountTime({
+        [this.curSubject.id]: Math.floor(Date.now() / 1000)
+      });
+      await this.updateScanNo();
+      this.historyList = [];
     },
     },
     // history
     // history
     updateHistory(curStudent) {
     updateHistory(curStudent) {
       const student = deepCopy(curStudent);
       const student = deepCopy(curStudent);
-      if (this.historyList.length >= this.students.length) {
-        this.historyList.pop();
+      const historyIndex = this.historyList.findIndex(
+        item => item.examNumber === student.examNumber
+      );
+      if (historyIndex === -1) {
+        if (this.historyList.length >= this.historyLimit) {
+          this.historyList.pop();
+        }
+      } else {
+        this.historyList.splice(historyIndex, 1);
       }
       }
       this.historyList.unshift(student);
       this.historyList.unshift(student);
     },
     },

+ 34 - 15
src/modules/client/views/LineScan.vue

@@ -29,11 +29,7 @@
       </div>
       </div>
     </div>
     </div>
     <div class="scan-history">
     <div class="scan-history">
-      <div
-        class="history-item"
-        v-for="(task, tindex) in historyList"
-        :key="tindex"
-      >
+      <div class="history-item" v-for="task in historyList" :key="task.id">
         <div class="history-item-body">
         <div class="history-item-body">
           <img :src="task.formalImgPath" :alt="task.name" />
           <img :src="task.formalImgPath" :alt="task.name" />
         </div>
         </div>
@@ -75,7 +71,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 } from "vuex";
+import { mapState, mapMutations, mapActions } from "vuex";
 
 
 export default {
 export default {
   name: "line-scan",
   name: "line-scan",
@@ -111,6 +107,9 @@ export default {
     ]),
     ]),
     user() {
     user() {
       return this.$store.state.user;
       return this.$store.state.user;
+    },
+    curSubjectStartCountTime() {
+      return this.startCountTime[this.curSubject.id];
     }
     }
   },
   },
   mounted() {
   mounted() {
@@ -118,11 +117,13 @@ export default {
       this.$Message.error("请先完成采集设置!");
       this.$Message.error("请先完成采集设置!");
       return;
       return;
     }
     }
+    this.initHistory();
     this.getInitFile();
     this.getInitFile();
     // this.test();
     // this.test();
   },
   },
   methods: {
   methods: {
-    ...mapMutations("client", ["setScanNo", "setStartCountTime"]),
+    ...mapMutations("client", ["setScanNo"]),
+    ...mapActions("client", ["updateStartCountTime"]),
     async test() {
     async test() {
       this.curImage = getEarliestFile();
       this.curImage = getEarliestFile();
       const codeAreas = {
       const codeAreas = {
@@ -166,6 +167,14 @@ export default {
       });
       });
       console.log(examNumber);
       console.log(examNumber);
     },
     },
+    async initHistory() {
+      const dataList = await db.getHistory(
+        this.curSubjectStartCountTime,
+        this.curSubject.id
+      );
+      this.historyList = dataList;
+      console.log(dataList);
+    },
     getInitFile() {
     getInitFile() {
       this.curImage = getEarliestFile(this.GLOBAL.input);
       this.curImage = getEarliestFile(this.GLOBAL.input);
 
 
@@ -273,7 +282,7 @@ export default {
         });
         });
         await this.appendUploadTask();
         await this.appendUploadTask();
         await this.updateScanNo();
         await this.updateScanNo();
-        this.updateHistory(this.curStudent);
+        this.initHistory();
       }
       }
       // 删除扫描文件,继续开始下一个任务
       // 删除扫描文件,继续开始下一个任务
       fs.unlinkSync(this.curImage.url);
       fs.unlinkSync(this.curImage.url);
@@ -305,18 +314,28 @@ export default {
     },
     },
     // count
     // count
     async updateScanNo() {
     async updateScanNo() {
-      const scanNo = await db.getScanCount(this.startCountTime);
+      const scanNo = await db.getScanCount(this.curSubjectStartCountTime);
       this.setScanNo(scanNo);
       this.setScanNo(scanNo);
     },
     },
-    resetStartCountTime() {
-      this.setStartCountTime(Math.floor(Date.now() / 1000));
-      this.updateScanNo();
+    async resetStartCountTime() {
+      await this.updateStartCountTime({
+        [this.curSubject.id]: Math.floor(Date.now() / 1000)
+      });
+      await this.updateScanNo();
+      this.historyList = [];
     },
     },
-    // history
+    // history 暂时不用
     updateHistory(curStudent) {
     updateHistory(curStudent) {
       const student = deepCopy(curStudent);
       const student = deepCopy(curStudent);
-      if (this.historyList.length >= this.historyLimit) {
-        this.historyList.pop();
+      const historyIndex = this.historyList.findIndex(
+        item => item.examNumber === student.examNumber
+      );
+      if (historyIndex === -1) {
+        if (this.historyList.length >= this.historyLimit) {
+          this.historyList.pop();
+        }
+      } else {
+        this.historyList.splice(historyIndex, 1);
       }
       }
       this.historyList.unshift(student);
       this.historyList.unshift(student);
     },
     },

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

@@ -20,6 +20,7 @@
 
 
 <script>
 <script>
 import { mapState, mapMutations } from "vuex";
 import { mapState, mapMutations } from "vuex";
+import db from "../../../plugins/db";
 
 
 export default {
 export default {
   name: "subject",
   name: "subject",
@@ -29,7 +30,7 @@ export default {
     };
     };
   },
   },
   computed: {
   computed: {
-    ...mapState("client", ["scanArea"])
+    ...mapState("client", ["scanArea", "startCountTime"])
   },
   },
   mounted() {
   mounted() {
     const user = this.$ls.get("user");
     const user = this.$ls.get("user");
@@ -39,11 +40,16 @@ export default {
   },
   },
   methods: {
   methods: {
     ...mapMutations("client", ["setCurSubject"]),
     ...mapMutations("client", ["setCurSubject"]),
-    selectSubject(subject) {
+    async selectSubject(subject) {
       const curSuject = this.scanArea[subject.id] || subject;
       const curSuject = this.scanArea[subject.id] || subject;
       this.$ls.set("curSuject", curSuject);
       this.$ls.set("curSuject", curSuject);
       this.setCurSubject(curSuject);
       this.setCurSubject(curSuject);
 
 
+      // calc scanNo
+      const curDate = this.startCountTime[subject.id];
+      const scanNo = await db.getScanCount(curDate, subject.id);
+      this.$store.commit("client/setScanNo", scanNo);
+
       this.$router.push({
       this.$router.push({
         name: "Camera"
         name: "Camera"
       });
       });

+ 19 - 5
src/plugins/axios.js

@@ -4,12 +4,14 @@ import ViewUI from "view-design";
 import { objTypeOf } from "./utils";
 import { objTypeOf } from "./utils";
 // import router from "../router";
 // import router from "../router";
 // import Vue from "vue";
 // import Vue from "vue";
+let tinyTipsIsShow = false;
 
 
 /**
 /**
  * errorCallback 请求失败的回调
  * errorCallback 请求失败的回调
  * @param {Object} error 请求失败时的错误信息
  * @param {Object} error 请求失败时的错误信息
  */
  */
-const errorCallback = error => {
+const errorCallback = (error, config = {}) => {
+  const showTinyTips = config && config["showTinyTips"];
   let content = "";
   let content = "";
   if (error.response) {
   if (error.response) {
     content =
     content =
@@ -22,9 +24,21 @@ const errorCallback = error => {
   } else {
   } else {
     return error;
     return error;
   }
   }
-
-  content = content.indexOf("###") !== -1 ? "参数错误" : content;
-  ViewUI.Notice.error({ title: "错误提示", desc: content });
+  if (showTinyTips) {
+    if (!tinyTipsIsShow) {
+      ViewUI.Message.error({
+        content: "上传异常",
+        duration: 5,
+        onClose() {
+          tinyTipsIsShow = false;
+        }
+      });
+      tinyTipsIsShow = true;
+    }
+  } else {
+    content = content.indexOf("###") !== -1 ? "参数错误" : content;
+    ViewUI.Notice.error({ title: "错误提示", desc: content });
+  }
   return error;
   return error;
 };
 };
 
 
@@ -115,7 +129,7 @@ const $post = (url, datas, config = {}) => {
       return successCallback(rep.data);
       return successCallback(rep.data);
     })
     })
     .catch(error => {
     .catch(error => {
-      throw new Error(errorCallback(error));
+      throw new Error(errorCallback(error, config));
     });
     });
 };
 };
 
 

+ 17 - 4
src/plugins/db.js

@@ -90,8 +90,8 @@ function getUploadCount(limitTime) {
     });
     });
   });
   });
 }
 }
-function getScanCount(limitTime) {
-  const sql = `SELECT COUNT(DISTINCT examNumber) AS count FROM scan WHERE strftime('%s',createdTime, 'utc') >= '${limitTime}'`;
+function getScanCount(limitTime, subjectId) {
+  const sql = `SELECT COUNT(DISTINCT examNumber) AS count FROM scan WHERE strftime('%s',createdTime, 'utc') >= '${limitTime}' AND subjectId = '${subjectId}'`;
 
 
   return new Promise((resolve, reject) => {
   return new Promise((resolve, reject) => {
     db.all(sql, (err, rows) => {
     db.all(sql, (err, rows) => {
@@ -102,6 +102,18 @@ function getScanCount(limitTime) {
   });
   });
 }
 }
 
 
+function getHistory(limitTime, subjectId) {
+  const sql = `SELECT max(id) id, examNumber,studentName name,formalImgPath  FROM scan WHERE strftime('%s',createdTime, 'utc') >= '${limitTime}' AND subjectId = '${subjectId}' GROUP BY examNumber ORDER BY id DESC LIMIT 30`;
+
+  return new Promise((resolve, reject) => {
+    db.all(sql, (err, rows) => {
+      if (err) reject("get list fail!");
+
+      resolve(rows);
+    });
+  });
+}
+
 function updateUploadState(id) {
 function updateUploadState(id) {
   const sql = `UPDATE scan SET isUpload=$isUpload,fininshTime=$fininshTime WHERE id=$id`;
   const sql = `UPDATE scan SET isUpload=$isUpload,fininshTime=$fininshTime WHERE id=$id`;
   const datas = {
   const datas = {
@@ -134,9 +146,9 @@ function getAllDict() {
   });
   });
 }
 }
 
 
-function initDict(key) {
+function initDict(key, val = "") {
   const sql = `INSERT INTO dict (key, val) VALUES (?,?)`;
   const sql = `INSERT INTO dict (key, val) VALUES (?,?)`;
-  const datas = [key, null];
+  const datas = [key, val];
 
 
   return new Promise((resolve, reject) => {
   return new Promise((resolve, reject) => {
     db.run(sql, datas, err => {
     db.run(sql, datas, err => {
@@ -196,6 +208,7 @@ export default {
   countScanList,
   countScanList,
   getUploadCount,
   getUploadCount,
   getScanCount,
   getScanCount,
+  getHistory,
   updateUploadState,
   updateUploadState,
   getDict,
   getDict,
   setDict,
   setDict,

+ 2 - 5
src/views/Login.vue

@@ -105,13 +105,10 @@ export default {
 
 
       data.loginTime = formatDate();
       data.loginTime = formatDate();
       data.name = this.loginModel.loginname;
       data.name = this.loginModel.loginname;
-      this.$store.commit(
-        "client/setStartCountTime",
-        Math.floor(Date.now() / 1000)
-      );
 
 
-      await this.initScanArea(data.subjects);
       await this.initStore();
       await this.initStore();
+      await this.initScanArea(data.subjects);
+      await this.initStartCountTime(data.subjects);
 
 
       this.$ls.set("user", data);
       this.$ls.set("user", data);
       this.$store.commit("setUser", data);
       this.$store.commit("setUser", data);