zhangjie 4 年之前
父节点
当前提交
6376541caa

+ 7 - 1
src/mixins/initStoreMixin.js

@@ -2,6 +2,12 @@ import db from "../plugins/db";
 
 export default {
   methods: {
+    getLastLoginUser() {
+      return db.getDict("lastLoginUser", "");
+    },
+    async setLastLoginUser(user) {
+      await db.setDict("lastLoginUser", JSON.stringify(user));
+    },
     async initScanArea(subjects) {
       const storeScanArea = await db.getDict("scanArea", "");
       const scanArea = storeScanArea ? JSON.parse(storeScanArea) : {};
@@ -32,7 +38,7 @@ export default {
     },
     async initStore() {
       const storeDict = await db.getAllDict();
-      const needInitDict = ["scanArea", "startCountTime"];
+      const needInitDict = ["scanArea", "startCountTime", "lastLoginUser"];
       for (let key in needInitDict) {
         if (
           !Object.prototype.hasOwnProperty.call(storeDict, needInitDict[key])

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

@@ -157,7 +157,10 @@ export default {
   },
   methods: {
     initData() {
+      this.spinStyle = {};
+      this.scanType = "SCAN";
       this.modalForm.examNumber = "";
+      this.modalForm.studentName = "";
     },
     visibleChange(visible) {
       if (visible) {

+ 4 - 1
src/modules/client/views/GroupScan.vue

@@ -414,7 +414,10 @@ export default {
     },
     // count
     async updateScanNo() {
-      const scanNo = await db.getScanCount(this.startCountTime);
+      const scanNo = await db.getScanCount(
+        this.curSubjectStartCountTime,
+        this.curSubject.id
+      );
       this.setScanNo(scanNo);
     },
     async resetStartCountTime() {

+ 4 - 2
src/modules/client/views/LineScan.vue

@@ -173,7 +173,6 @@ export default {
         this.curSubject.id
       );
       this.historyList = dataList;
-      console.log(dataList);
     },
     getInitFile() {
       this.curImage = getEarliestFile(this.GLOBAL.input);
@@ -314,7 +313,10 @@ export default {
     },
     // count
     async updateScanNo() {
-      const scanNo = await db.getScanCount(this.curSubjectStartCountTime);
+      const scanNo = await db.getScanCount(
+        this.curSubjectStartCountTime,
+        this.curSubject.id
+      );
       this.setScanNo(scanNo);
     },
     async resetStartCountTime() {

+ 1 - 1
src/plugins/db.js

@@ -103,7 +103,7 @@ function getScanCount(limitTime, subjectId) {
 }
 
 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`;
+  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) => {

+ 10 - 1
src/views/Login.vue

@@ -79,6 +79,7 @@ export default {
   },
   mounted() {
     this.$ls.clear();
+    this.initData();
   },
   methods: {
     minWin() {
@@ -90,6 +91,14 @@ export default {
     close() {
       ipcRenderer.send("close-window");
     },
+    async initData() {
+      await this.initStore();
+      const lastLoginUser = await this.getLastLoginUser();
+
+      if (lastLoginUser) {
+        this.loginModel = { ...JSON.parse(lastLoginUser) };
+      }
+    },
     async submit(name) {
       const valid = await this.$refs.loginForm.validate();
       if (!valid) return;
@@ -106,7 +115,7 @@ export default {
       data.loginTime = formatDate();
       data.name = this.loginModel.loginname;
 
-      await this.initStore();
+      await this.setLastLoginUser(this.loginModel);
       await this.initScanArea(data.subjects);
       await this.initStartCountTime(data.subjects);