lrf 1 年之前
父节点
当前提交
8ebb71721d
共有 8 个文件被更改,包括 269 次插入30 次删除
  1. 1 1
      .env
  2. 195 8
      package-lock.json
  3. 1 0
      package.json
  4. 4 4
      src/background.js
  5. 4 0
      src/store/index.js
  6. 17 0
      src/views/exam.vue
  7. 46 16
      src/views/login.vue
  8. 1 1
      vue.config.js

+ 1 - 1
.env

@@ -1,4 +1,4 @@
-VUE_APP_AXIOS_BASE_URL = 'http://127.0.0.1'
+VUE_APP_AXIOS_BASE_URL = ''
 VUE_APP_ROUTER="exam"
 VUE_APP_VIEW_LEAVE_MAIN_EVENT="leaveMainEvent"
 VUE_APP_VIEW_LEAVE_VIEW_EVENT="leaveViewEvent"

+ 195 - 8
package-lock.json

@@ -12,6 +12,7 @@
         "axios": "^0.25.0",
         "core-js": "^3.6.5",
         "element-ui": "^2.15.6",
+        "jsonwebtoken": "^9.0.2",
         "lodash": "^4.17.21",
         "moment": "^2.29.1",
         "naf-core": "^0.1.2",
@@ -4532,6 +4533,11 @@
         "node": ">=0.4.0"
       }
     },
+    "node_modules/buffer-equal-constant-time": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+      "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
+    },
     "node_modules/buffer-fill": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
@@ -7280,6 +7286,14 @@
         "safer-buffer": "^2.1.0"
       }
     },
+    "node_modules/ecdsa-sig-formatter": {
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+      "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+      "dependencies": {
+        "safe-buffer": "^5.0.1"
+      }
+    },
     "node_modules/ee-first": {
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@@ -11439,6 +11453,38 @@
         "graceful-fs": "^4.1.6"
       }
     },
+    "node_modules/jsonwebtoken": {
+      "version": "9.0.2",
+      "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
+      "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
+      "dependencies": {
+        "jws": "^3.2.2",
+        "lodash.includes": "^4.3.0",
+        "lodash.isboolean": "^3.0.3",
+        "lodash.isinteger": "^4.0.4",
+        "lodash.isnumber": "^3.0.3",
+        "lodash.isplainobject": "^4.0.6",
+        "lodash.isstring": "^4.0.1",
+        "lodash.once": "^4.0.0",
+        "ms": "^2.1.1",
+        "semver": "^7.5.4"
+      },
+      "engines": {
+        "node": ">=12",
+        "npm": ">=6"
+      }
+    },
+    "node_modules/jsonwebtoken/node_modules/semver": {
+      "version": "7.6.2",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
+      "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
+      "bin": {
+        "semver": "bin/semver.js"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
     "node_modules/jsprim": {
       "version": "1.4.2",
       "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
@@ -11466,6 +11512,25 @@
         "set-immediate-shim": "~1.0.1"
       }
     },
+    "node_modules/jwa": {
+      "version": "1.4.1",
+      "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
+      "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
+      "dependencies": {
+        "buffer-equal-constant-time": "1.0.1",
+        "ecdsa-sig-formatter": "1.0.11",
+        "safe-buffer": "^5.0.1"
+      }
+    },
+    "node_modules/jws": {
+      "version": "3.2.2",
+      "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
+      "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
+      "dependencies": {
+        "jwa": "^1.4.1",
+        "safe-buffer": "^5.0.1"
+      }
+    },
     "node_modules/keyv": {
       "version": "3.1.0",
       "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
@@ -11785,6 +11850,36 @@
       "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==",
       "dev": true
     },
+    "node_modules/lodash.includes": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
+      "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
+    },
+    "node_modules/lodash.isboolean": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
+      "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
+    },
+    "node_modules/lodash.isinteger": {
+      "version": "4.0.4",
+      "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
+      "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
+    },
+    "node_modules/lodash.isnumber": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
+      "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
+    },
+    "node_modules/lodash.isplainobject": {
+      "version": "4.0.6",
+      "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+      "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
+    },
+    "node_modules/lodash.isstring": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
+      "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
+    },
     "node_modules/lodash.kebabcase": {
       "version": "4.1.1",
       "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz",
@@ -11809,6 +11904,11 @@
       "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
       "dev": true
     },
+    "node_modules/lodash.once": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
+      "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
+    },
     "node_modules/lodash.transform": {
       "version": "4.6.0",
       "resolved": "https://registry.npmjs.org/lodash.transform/-/lodash.transform-4.6.0.tgz",
@@ -12316,8 +12416,7 @@
     "node_modules/ms": {
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
-      "dev": true
+      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
     },
     "node_modules/multicast-dns": {
       "version": "6.2.3",
@@ -15040,8 +15139,7 @@
     "node_modules/safe-buffer": {
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
-      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
-      "dev": true
+      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
     },
     "node_modules/safe-regex": {
       "version": "1.1.0",
@@ -23075,6 +23173,11 @@
       "integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=",
       "dev": true
     },
+    "buffer-equal-constant-time": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+      "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
+    },
     "buffer-fill": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
@@ -25257,6 +25360,14 @@
         "safer-buffer": "^2.1.0"
       }
     },
+    "ecdsa-sig-formatter": {
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+      "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+      "requires": {
+        "safe-buffer": "^5.0.1"
+      }
+    },
     "ee-first": {
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@@ -28447,6 +28558,30 @@
         "graceful-fs": "^4.1.6"
       }
     },
+    "jsonwebtoken": {
+      "version": "9.0.2",
+      "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
+      "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
+      "requires": {
+        "jws": "^3.2.2",
+        "lodash.includes": "^4.3.0",
+        "lodash.isboolean": "^3.0.3",
+        "lodash.isinteger": "^4.0.4",
+        "lodash.isnumber": "^3.0.3",
+        "lodash.isplainobject": "^4.0.6",
+        "lodash.isstring": "^4.0.1",
+        "lodash.once": "^4.0.0",
+        "ms": "^2.1.1",
+        "semver": "^7.5.4"
+      },
+      "dependencies": {
+        "semver": {
+          "version": "7.6.2",
+          "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
+          "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w=="
+        }
+      }
+    },
     "jsprim": {
       "version": "1.4.2",
       "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
@@ -28471,6 +28606,25 @@
         "set-immediate-shim": "~1.0.1"
       }
     },
+    "jwa": {
+      "version": "1.4.1",
+      "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
+      "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
+      "requires": {
+        "buffer-equal-constant-time": "1.0.1",
+        "ecdsa-sig-formatter": "1.0.11",
+        "safe-buffer": "^5.0.1"
+      }
+    },
+    "jws": {
+      "version": "3.2.2",
+      "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
+      "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
+      "requires": {
+        "jwa": "^1.4.1",
+        "safe-buffer": "^5.0.1"
+      }
+    },
     "keyv": {
       "version": "3.1.0",
       "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
@@ -28734,6 +28888,36 @@
       "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==",
       "dev": true
     },
+    "lodash.includes": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
+      "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
+    },
+    "lodash.isboolean": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
+      "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
+    },
+    "lodash.isinteger": {
+      "version": "4.0.4",
+      "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
+      "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
+    },
+    "lodash.isnumber": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
+      "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
+    },
+    "lodash.isplainobject": {
+      "version": "4.0.6",
+      "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+      "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
+    },
+    "lodash.isstring": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
+      "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
+    },
     "lodash.kebabcase": {
       "version": "4.1.1",
       "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz",
@@ -28758,6 +28942,11 @@
       "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
       "dev": true
     },
+    "lodash.once": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
+      "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
+    },
     "lodash.transform": {
       "version": "4.6.0",
       "resolved": "https://registry.npmjs.org/lodash.transform/-/lodash.transform-4.6.0.tgz",
@@ -29168,8 +29357,7 @@
     "ms": {
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
-      "dev": true
+      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
     },
     "multicast-dns": {
       "version": "6.2.3",
@@ -31430,8 +31618,7 @@
     "safe-buffer": {
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
-      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
-      "dev": true
+      "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
     },
     "safe-regex": {
       "version": "1.1.0",

+ 1 - 0
package.json

@@ -16,6 +16,7 @@
     "axios": "^0.25.0",
     "core-js": "^3.6.5",
     "element-ui": "^2.15.6",
+    "jsonwebtoken": "^9.0.2",
     "lodash": "^4.17.21",
     "moment": "^2.29.1",
     "naf-core": "^0.1.2",

+ 4 - 4
src/background.js

@@ -10,10 +10,10 @@ let mainWindow;
 async function createWindow() {
   // Create the browser window.
   const win = new BrowserWindow({
-    alwaysOnTop: true,
+    alwaysOnTop: false,
     frame: false,
-    titleBarStyle: 'hidden',
-    fullscreen: true,
+    // titleBarStyle: 'hidden',
+    // fullscreen: true,
     width: 1440,
     height: 920,
     webPreferences: {
@@ -74,7 +74,7 @@ app.on('ready', async () => {
 app.on('browser-window-blur', () => {
   console.log('焦点离开窗口');
   mainWindow.webContents.send(process.env.VUE_APP_VIEW_LEAVE_VIEW_EVENT, true);
-  app.focus();
+  // app.focus();
 });
 
 // Exit cleanly on request from parent process in development mode.

+ 4 - 0
src/store/index.js

@@ -5,6 +5,8 @@ Vue.use(Vuex);
 import exam_answer from '@common/src/store/exam/answer';
 import examination_examinee from '@common/src/store/examination_examinee';
 import security_guard_collect from '@common/src/store/security_guard_collect';
+import login from '@common/src/store/login';
+import examinee from '@common/src/store/exam/examinee';
 export default new Vuex.Store({
   state: {
     checkResult: false,
@@ -38,5 +40,7 @@ export default new Vuex.Store({
     exam_answer,
     examination_examinee,
     security_guard_collect,
+    login,
+    examinee,
   },
 });

+ 17 - 0
src/views/exam.vue

@@ -36,6 +36,7 @@
             </el-col>
             <el-col :span="24" class="two_2">
               <el-button @click="computedScore" type="primary">提交</el-button>
+              <el-button @click="mockAnswer" type="primary">模拟答案</el-button>
             </el-col>
           </el-col>
         </el-col>
@@ -96,6 +97,22 @@ export default {
         this.setExaming(true);
       }
     },
+    mockAnswer() {
+      const question = this.question;
+      for (const q of question.questions) {
+        const { selects, type } = q;
+        console.log(q);
+        const aval = _.get(_.head(selects), 'title');
+        const t = _.get(type, 'type', 'radio');
+        let answer;
+        if (t === 'checkbox') {
+          answer = [aval];
+        } else {
+          answer = aval;
+        }
+        q.answer = answer;
+      }
+    },
     getQuestType(quest) {
       return _.get(quest.type, 'type');
     },

+ 46 - 16
src/views/login.vue

@@ -4,7 +4,7 @@
       <el-col :span="24" class="main">
         <el-col :span="24" class="one" v-if="view !== 'isLogin'">
           <el-col :span="24" class="one_1">长春市保安服务监管系统-考试系统</el-col>
-          <el-col :span="24" class="one_2">
+          <!-- <el-col :span="24" class="one_2">
             <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="80px" style="padding: 20px" v-if="view !== 'isLogin'">
               <el-form-item label="身份证号" prop="card" :required="true">
                 <el-input v-model="form.card" :readonly="true" placeholder="请扫描身份证号">
@@ -23,6 +23,19 @@
                 <el-button type="primary" size="small" @click="toSave()">登陆</el-button>
               </el-form-item>
             </el-form>
+          </el-col> -->
+          <el-col :span="24" class="one_2">
+            <el-form ref="form" :model="form" label-position="left" label-width="80px" style="padding: 20px" v-if="view !== 'isLogin'">
+              <el-form-item label="账号" prop="phone">
+                <el-input v-model="form.phone" placeholder="请输入账号"></el-input>
+              </el-form-item>
+              <el-form-item label="密码" prop="password">
+                <el-input v-model="form.password" placeholder="请输入密码" type="password"></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button type="primary" size="small" @click="toSave()">登陆</el-button>
+              </el-form-item>
+            </el-form>
           </el-col>
         </el-col>
         <el-col :span="24" class="two" v-else>
@@ -47,7 +60,8 @@
             </el-descriptions>
             <el-row type="flex" justify="space-around" style="padding: 20px">
               <el-col :span="4">
-                <el-button type="primary" @click="toStart" :disabled="!checkResult">开始考试</el-button>
+                <!-- <el-button type="primary" @click="toStart" :disabled="!checkResult">开始考试</el-button> -->
+                <el-button type="primary" @click="toStart">开始考试</el-button>
               </el-col>
             </el-row>
           </el-col>
@@ -58,8 +72,11 @@
 </template>
 
 <script>
+import jwt from 'jsonwebtoken';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('examination_examinee');
+const { mapActions: loginActions } = createNamespacedHelpers('login');
+const { mapActions: examineeActions } = createNamespacedHelpers('examinee');
 const { mapActions: security_guard_collect } = createNamespacedHelpers('security_guard_collect');
 export default {
   name: 'login',
@@ -69,9 +86,11 @@ export default {
     return {
       view: 'login',
       form: {
-        card: '22010319950601161X',
-        exam_num: '2201002022001001',
-        testsite_num: '2201002022001',
+        phone: 'user',
+        password: '1qaz2wsx',
+        // card: '22010319950601161X',
+        // exam_num: '2201002022001001',
+        // testsite_num: '2201002022001',
       },
       rules: {
         card: [{ required: true, message: '请扫描身份证号', trigger: 'blur' }],
@@ -84,7 +103,9 @@ export default {
   created() {},
   mounted() {},
   methods: {
-    ...mapActions(['fetch']),
+    ...examineeActions({ getUser: 'fetch' }),
+    ...loginActions(['login']),
+    // ...mapActions(['fetch']),
     ...security_guard_collect(['query']),
     toSave() {
       this.$refs.form.validate((valid) => {
@@ -98,24 +119,33 @@ export default {
     async save() {
       // 查询出这个人的信息;以及考点信息,后三位是座位号.剩下的就是考点号
       let dup = _.cloneDeep(this.form);
-      const res = await this.fetch({ ...dup, status: '2' });
+      // const res = await this.fetch({ ...dup, status: '2' });
+      const res = await this.login({ ...dup, type: 'examinee' });
       if (this.$checkRes(res, null, '查询失败,请稍后尝试!')) {
         if (!res.data) {
           this.$message.error('未找到考生信息,请重新核对信息!');
           return;
         }
-        this.$set(this, `info`, res.data);
-        const binfo = await this.query({ security_guard_id: res.data.security_guard_id, type: '人像' });
-        if (this.$checkRes(binfo)) {
-          if (_.isArray(binfo.data)) {
-            const head = _.head(binfo.data);
-            if (head) {
-              this.info.img = `${process.env.VUE_APP_AXIOS_BASE_URL}${head.data}`;
-            }
-          }
+        let user = res.data;
+        if (user) user = jwt.decode(user);
+        const userRes = await this.getUser(user._id);
+        if (userRes.data) {
+          this.$set(this, `info`, userRes.data);
           this.view = 'isLogin';
           sessionStorage.setItem('user', JSON.stringify(_.cloneDeep(this.info)));
         }
+
+        // const binfo = await this.query({ security_guard_id: res.data.security_guard_id, type: '人像' });
+        // if (this.$checkRes(binfo)) {
+        //   if (_.isArray(binfo.data)) {
+        //     const head = _.head(binfo.data);
+        //     if (head) {
+        //       this.info.img = `${process.env.VUE_APP_AXIOS_BASE_URL}${head.data}`;
+        //     }
+        //   }
+        //   this.view = 'isLogin';
+        //   sessionStorage.setItem('user', JSON.stringify(_.cloneDeep(this.info)));
+        // }
       }
     },
 

+ 1 - 1
vue.config.js

@@ -49,7 +49,7 @@ module.exports = {
         changeOrigin: true,
         ws: false,
       },
-      '/api/exam': {
+      '/api/exam/': {
         target: 'http://127.0.0.1:6104',
         changeOrigin: true,
         ws: false,