zhangjie 5 vuotta sitten
vanhempi
commit
4fbcb24c7e

+ 1 - 0
.eslintignore

@@ -1,3 +1,4 @@
 
 public
 vue.config.js
+src/plugins/env.js

+ 1 - 0
.eslintrc.js

@@ -10,6 +10,7 @@ module.exports = {
   rules: {
     "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
     "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
+    "no-undef": "warn",
     "no-unused-vars": [
       "error",
       { vars: "all", args: "none", ignoreRestSiblings: false }

+ 9 - 5
public/index.html

@@ -1,15 +1,19 @@
 <!DOCTYPE html>
 <html lang="en">
   <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+    <meta charset="utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
     <title><%= htmlWebpackPlugin.options.title %></title>
   </head>
   <body>
     <noscript>
-      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
+      <strong
+        >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
+        properly without JavaScript enabled. Please enable it to
+        continue.</strong
+      >
     </noscript>
     <div id="app"></div>
     <!-- built files will be auto injected -->

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

@@ -13,7 +13,7 @@
   right: 0;
   bottom: 0;
   overflow: auto;
-  background: var(--background);
+  background: @background;
   z-index: 98;
 }
 .home-main {
@@ -35,7 +35,7 @@
 .progress-item {
   font-size: 13px;
   line-height: 20px;
-  color: var(--color-strong);
+  color: @fontMain;
 }
 .progress-name {
   float: left;
@@ -71,10 +71,14 @@
   font-size: 20px;
   font-weight: 600;
 }
+.head-back {
+  float: right;
+  margin-top: -4px;
+}
 
 /* part */
 .part-head {
-  padding: 40px 0;
+  padding: 20px 0;
   position: relative;
 }
 .part-head .ivu-btn {
@@ -87,7 +91,7 @@
   background-image: url(../images/icon-left-act.png);
 }
 .part-head > h2 {
-  color: var(--color);
+  color: @fontMain;
   font-size: 40px;
   line-height: 56px;
   text-align: center;

+ 0 - 3
src/assets/styles/icons.less

@@ -5,9 +5,6 @@
   display: inline-block;
   vertical-align: top;
   background-size: 100% 100%;
-  &-scan {
-    background-image: url(../images/icon-scan.png);
-  }
   &-setting {
     vertical-align: middle;
     margin-right: 10px;

+ 2 - 2
src/assets/styles/iview.less

@@ -8,10 +8,10 @@
 @table-td-stripe-bg: rgba(237, 242, 250, 1);
 
 // Button
-@btn-padding-large: 10px 15px;
+// @btn-padding-large: 10px 15px;
 @btn-font-size-large: 20px;
 
-@btn-padding-base: 6px 20px;
+// @btn-padding-base: 6px 20px;
 @btn-font-size: 14px;
 
 // input

+ 29 - 24
src/assets/styles/pages.less

@@ -36,7 +36,7 @@
 .camera-form {
   padding: 80px 135px 103px;
   border-radius: 10px;
-  background: var(--background-gray);
+  background: @backgroundGray;
 }
 .camera-form .ivu-input {
   text-align: center;
@@ -51,19 +51,24 @@
   cursor: pointer;
 }
 .camera-write:hover {
-  color: var(--color-blue);
+  color: @subColor;
 }
 .camera-btn {
   width: 220px;
   margin: 80px auto 0;
 }
 
+/* setting-steps */
+.scan-area-steps .step-ctrl {
+  text-align: center;
+}
+
 /* code-area */
 .code-area {
   padding: 0 40px;
 }
 .code-area-main {
-  background: var(--background-gray);
+  background: @backgroundGray;
   position: relative;
   margin-bottom: 60px;
   min-height: 400px;
@@ -113,14 +118,14 @@
 .code-area-icon {
   width: 60px;
   height: 60px;
-  border: 1px solid var(--color-border);
+  border: 1px solid @borderGray;
   padding: 18px;
   border-radius: 50%;
   cursor: pointer;
   margin: 20px auto 0;
 }
 .code-area-icon:hover {
-  border-color: var(--color-border-act);
+  border-color: @boldBorderGray;
   background: #fff;
 }
 .code-area-btn {
@@ -138,7 +143,7 @@
   padding: 0 40px;
 }
 .image-orient-main {
-  background: var(--background-gray);
+  background: @backgroundGray;
   position: relative;
   margin-bottom: 60px;
   height: 600px;
@@ -167,7 +172,7 @@
   top: 50%;
   margin-top: -30px;
   padding: 18px;
-  border: 1px solid var(--color-border);
+  border: 1px solid @borderGray;
   cursor: pointer;
   border-radius: 50%;
 }
@@ -178,7 +183,7 @@
   right: 72px;
 }
 .image-orient-icon:hover {
-  border-color: var(--color-border-act);
+  border-color: @boldBorderGray;
   background: #fff;
 }
 .image-orient-btn {
@@ -191,7 +196,7 @@
 }
 .waiting-main {
   height: 400px;
-  background: var(--background-gray);
+  background: @backgroundGray;
   margin-bottom: 30px;
   border-radius: 10px;
   padding-top: 112px;
@@ -200,7 +205,7 @@
 .waiting-load-tips {
   font-size: 40px;
   margin-top: 40px;
-  color: var(--color);
+  color: @dark;
 }
 .waiting-icon-load {
   animation: ani-demo-spin 2s linear infinite;
@@ -225,7 +230,7 @@
   height: 474px;
   padding: 10px;
   border-radius: 10px;
-  background: var(--background-gray);
+  background: @backgroundGray;
 }
 .task-main li {
   position: relative;
@@ -240,11 +245,11 @@
 }
 .task-main li span:first-child {
   margin-left: -60px;
-  color: var(--color-subtle);
+  color: @midDark;
 }
 .task-main li span:last-child {
   margin-left: 10px;
-  color: var(--color);
+  color: @dark;
 }
 .task-btn {
   width: 300px;
@@ -252,7 +257,7 @@
 }
 /* task-infos */
 .task-infos {
-  color: var(--color-strong);
+  color: @fontMain;
   font-size: 0;
 }
 .task-infos li {
@@ -273,7 +278,7 @@
   padding-right: 10px;
 }
 .task-infos li > p {
-  background: var(--background-gray);
+  background: @backgroundGray;
   height: 48px;
   padding: 10px 25px;
   line-height: 28px;
@@ -284,7 +289,7 @@
   margin-right: 20px;
 }
 .task-infos li span:first-child {
-  color: var(--color-subtle);
+  color: @midDark;
 }
 
 /* scan */
@@ -326,7 +331,7 @@
 }
 .scan-main {
   height: 500px;
-  background: var(--background-gray);
+  background: @backgroundGray;
   margin-bottom: 30px;
   position: relative;
 }
@@ -376,7 +381,7 @@
   padding-bottom: 30px;
 }
 .scan-input-title {
-  color: var(--color-pink);
+  color: @pink;
   padding: 0 0 30px;
   font-size: 24px;
   text-align: center;
@@ -389,7 +394,7 @@
   right: 0;
 }
 .scan-input-main {
-  background: var(--background-gray);
+  background: @backgroundGray;
   position: relative;
   margin-bottom: 20px;
   min-height: 280px;
@@ -444,7 +449,7 @@
   margin: 0 auto;
 }
 .hand-input-main {
-  background: var(--background-gray);
+  background: @backgroundGray;
   position: relative;
   margin-bottom: 20px;
   min-height: 280px;
@@ -470,7 +475,7 @@
 .hand-input-form {
   padding: 20px 20px 0;
   text-align: center;
-  background: var(--background-gray);
+  background: @backgroundGray;
 }
 
 /* progress-bar */
@@ -519,13 +524,13 @@
   top: 20px;
   left: 0;
   line-height: 20px;
-  color: var(--color-subtle);
+  color: @midDark;
 }
 .scan-footer-nums span {
   margin-right: 5px;
 }
 .scan-footer-nums span i:last-child {
-  color: var(--color);
+  color: @dark;
   margin-left: 5px;
 }
 .scan-fonter-task-btn {
@@ -539,7 +544,7 @@
   border-radius: 30px;
 }
 .scan-fonter-task-btn .ivu-btn-large {
-  padding: 14px 15px;
+  padding: 0 15px;
 }
 .scan-footer-btn {
   position: absolute;

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

@@ -1,8 +1,9 @@
 @fontMain: #2c3e50;
-@background: #ededed;
+@background: #f5f7fb;
+@backgroundGray: #ebeff7;
 
 @mainColor: @primary-color;
-@subColor: #5cadff;
+@subColor: #47c3e9;
 @tinyColor: #e3fdfc;
 
 @pink: #ed4014;
@@ -15,8 +16,8 @@
 @tipsGray: #bfc1c4;
 @unactBtn: #d7d9df;
 @shadowGray: #e0e0e0;
-@borderGray: #e6e6e6;
-@boldBorderGray: #ddd;
+@borderGray: #dde2ed;
+@boldBorderGray: #d2d3d6;
 
 // size
 @fontSize: 14px;

+ 2 - 1
src/background.js

@@ -25,7 +25,8 @@ function createWindow() {
     minWidth: 800,
     minHeight: 600,
     webPreferences: {
-      nodeIntegration: true
+      nodeIntegration: true,
+      webSecurity: false
     }
   });
 

+ 2 - 7
src/main.js

@@ -12,14 +12,9 @@ import VueLocalStorage from "vue-ls";
 import ViewUI from "view-design";
 // import "view-design/dist/styles/iview.css";
 import "./assets/styles/index.less";
+import "cropperjs/dist/cropper.min.css";
 
-Vue.use(ViewUI, { size: "large" });
-ViewUI.Message.config({
-  duration: 3
-});
-ViewUI.Notice.config({
-  duration: 3
-});
+Vue.use(ViewUI);
 Vue.use(VueLocalStorage, { storage: "session" });
 Vue.use(globalVuePlugins);
 

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

@@ -83,7 +83,7 @@ export default {
       if (!valid) return;
 
       this.$store.commit("setCamera", this.modalForm.camera);
-      this.$router.push({ name: "Setting" });
+      this.$router.push({ name: "ScanArea" });
     }
   }
 };

+ 46 - 6
src/modules/client/views/GroupScan.vue

@@ -110,7 +110,7 @@ export default {
       return this.$store.state.curSubject;
     },
     studentSerialList() {
-      return this.students.sort((a, b) => {
+      return [...this.students].sort((a, b) => {
         if (a.isClient) return -1;
         if (b.isClient) return 1;
         if (a.isCurrent) return -1;
@@ -129,13 +129,53 @@ export default {
     }
   },
   mounted() {
-    this.getInitFile();
-    // this.curImage = {
-    //   name: "1901130043.jpg",
-    //   url: "E:\\newspace\\msyj-client\\in\\1901130043.jpg"
-    // };
+    // this.getInitFile();
+    this.test();
   },
   methods: {
+    async test() {
+      this.curImage = getEarliestFile();
+      const codeAreas = {
+        codeArea: {
+          x: 0,
+          y: 0,
+          width: 717.12,
+          height: 673.92,
+          rotate: 0,
+          scaleX: 1,
+          scaleY: 1,
+          codeRotate: 90
+        },
+        coverArea: {
+          x: 518.4,
+          y: 345.6,
+          width: 4147.2,
+          height: 2764.8,
+          rotate: 0,
+          scaleX: 1,
+          scaleY: 1
+        },
+        tailorArea: {
+          x: 518.4,
+          y: 345.6,
+          width: 4147.2,
+          height: 2764.8,
+          rotate: 0,
+          scaleX: 1,
+          scaleY: 1
+        },
+        imageRotate: 0
+      };
+      const examNumber = await decodeImageCode(
+        this.curImage.url,
+        codeAreas.codeArea
+      ).catch(error => {
+        const content = `图像:${this.curImage.name},解析错误,错误信息:${error}`;
+
+        this.$Notice.error({ title: "错误提示", desc: content, duration: 0 });
+      });
+      console.log(examNumber);
+    },
     getInitFile() {
       if (this.isFinished) {
         this.isWaiting = true;

+ 3 - 6
src/modules/client/views/Subject.vue

@@ -45,13 +45,10 @@ export default {
   methods: {
     ...mapMutations("client", ["setCurSubject"]),
     selectSubject(subject) {
-      const curSuject = this.scanArea[subject.id] || subject;
-      this.$ls.set("curSuject", curSuject);
-      this.setCurSubject(curSuject);
+      // const curSuject = this.scanArea[subject.id] || subject;
+      // this.$ls.set("curSuject", curSuject);
+      // this.setCurSubject(curSuject);
 
-      // this.$router.push({
-      //   name: "Entrance"
-      // });
       this.$router.push({
         name: "Camera"
       });

+ 1 - 1
src/plugins/env.js

@@ -3,8 +3,8 @@ const fs = require("fs");
 const { getLocalDate } = require("./utils");
 
 const homePath = path.join(__dirname, "../../");
-const __static = "";
 
+initPath();
 function initPath() {
   const paths = [
     getInImgPath(),

+ 3 - 2
src/plugins/imageOcr.js

@@ -21,6 +21,7 @@ const gm = require("gm").subClass({
  */
 function decodeImageCode(imgPath, codeArea) {
   const tmpFile = path.join(getTmpImgPath(), randomCode() + ".jpg");
+
   const imgObj = gm(imgPath);
 
   // 裁剪条形码区域
@@ -58,8 +59,8 @@ function decodeImageCode(imgPath, codeArea) {
         reject("error:decode exception");
         return;
       }
-
-      fs.unlink(tmpFile, () => {});
+      // 测试时暂时不删除临时文件
+      // fs.unlink(tmpFile, () => {});
 
       resolve(code);
     });

+ 6 - 1
src/views/Login.vue

@@ -64,7 +64,12 @@ export default {
     this.$ls.clear();
   },
   methods: {
-    async submit(name) {
+    submit() {
+      this.$router.push({
+        name: "Subject"
+      });
+    },
+    async submit1(name) {
       const valid = await this.$refs[name].validate();
       if (!valid) return;