zhangjie 2 éve
szülő
commit
43104ef918

+ 3 - 0
.browserslistrc

@@ -0,0 +1,3 @@
+> 1%
+last 2 versions
+not dead

+ 4 - 0
.eslintignore

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

+ 26 - 0
.eslintrc.js

@@ -0,0 +1,26 @@
+module.exports = {
+  root: true,
+  env: {
+    node: true
+  },
+  extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
+  parserOptions: {
+    parser: "babel-eslint"
+  },
+  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 }
+    ],
+    "vue/no-parsing-error": [2, { "x-invalid-end-tag": false }],
+    "vue/no-use-v-if-with-v-for": [
+      "error",
+      {
+        allowUsingIterationVar: true
+      }
+    ]
+  }
+};

+ 5 - 0
.prettierrc

@@ -0,0 +1,5 @@
+{
+  "semi": true,
+  "singleQuote": false,
+  "jsxBracketSameLine": false
+}

+ 1 - 1
package.json

@@ -35,7 +35,7 @@
     "@vue/cli-service": "~4.3.0",
     "@vue/eslint-config-prettier": "^6.0.0",
     "babel-eslint": "^10.1.0",
-    "electron": "^9.3.0",
+    "electron": "^9.4.4",
     "eslint": "^6.7.2",
     "eslint-plugin-prettier": "^3.1.1",
     "eslint-plugin-vue": "^6.2.2",

+ 15 - 99
src/assets/styles/home.scss

@@ -9,126 +9,42 @@
 .home-body {
   position: absolute;
   left: 0;
-  top: 50px;
+  top: 0;
   right: 0;
   bottom: 0;
   overflow: auto;
   background: $--color-background;
   z-index: 98;
+  padding-top: 30px;
 }
 
 /* head */
-.home-header {
+.home-head {
   position: absolute;
   width: 100%;
-  height: 50px;
+  height: 30px;
   top: 0;
   left: 0;
   z-index: 99;
   color: #fff;
-  padding-left: 220px;
-  background-color: $--color-text-dark;
+  background-color: rgba($color: #fff, $alpha: 0.5);
 
   display: flex;
   align-items: stretch;
   justify-content: space-between;
   -webkit-app-region: drag;
 
-  .menu-list {
-    li {
-      position: relative;
-      display: inline-block;
-      vertical-align: top;
-      padding: 10px;
-      height: 50px;
-      line-height: 30px;
-      opacity: 0.4;
-      font-size: 16px;
-      position: relative;
-      text-align: center;
-      cursor: pointer;
-
-      &:hover {
-        opacity: 1;
-      }
-
-      &.menu-item-act {
-        opacity: 1;
-
-        &::after {
-          content: "";
-          display: block;
-          position: absolute;
-          left: 5px;
-          right: 5px;
-          bottom: 0;
-          border-top: 5px solid #fff;
-          border-radius: 5px;
-          z-index: 8;
-        }
-      }
-
-      span {
-        display: inline-block;
-        vertical-align: top;
-      }
-
-      .icon {
-        margin-top: -3px;
-        margin-right: 6px;
-      }
-
-      > i {
-        margin-right: 6px;
-      }
-    }
+  .head-actions {
+    -webkit-app-region: no-drag;
+    padding: 5px 10px;
+    line-height: 20px;
+    font-size: 0;
   }
-
-  .head-menu {
-    flex-grow: 1;
-    overflow-y: hidden;
-    overflow-x: auto;
-
-    ul {
-      white-space: nowrap;
-    }
-  }
-
-  .head-user {
-    flex-grow: 0;
-    flex-shrink: 0;
-
-    .menu-item-account {
-      white-space: nowrap;
-      padding: 10px;
-
-      span {
-        max-width: 156px;
-        overflow: hidden;
-        text-overflow: ellipsis;
-      }
-    }
-  }
-
-  // .head-menu-btn
-  .head-menu-btn {
-    display: none;
-    float: right;
-    line-height: 36px;
-    padding: 12px 15px;
+  .action-icon {
+    display: inline-block;
+    vertical-align: top;
+    font-size: 14px;
+    width: 20px;
     text-align: center;
-
-    > span {
-      display: block;
-      height: 36px;
-      width: 36px;
-      border-radius: 5px;
-      background-color: rgba($color: #fff, $alpha: 0.3);
-    }
-
-    i {
-      font-size: 22px;
-      vertical-align: middle;
-    }
   }
 }

+ 1 - 1
src/config.js

@@ -1,4 +1,4 @@
 export default {
   domain: process.env.VUE_APP_DOMAIN,
-  input: "",
+  input: ""
 };

+ 5 - 3
src/main.js

@@ -10,7 +10,7 @@ import CONFIG from "./config";
 
 // https://github.com/RobinCK/vue-ls
 import VueLocalStorage from "vue-ls";
-import ElementUI from "element-ui";
+import ElementUI, { Message } from "element-ui";
 import "element-ui/lib/theme-chalk/index.css";
 import "./assets/styles/index.scss";
 
@@ -50,8 +50,10 @@ axios.interceptors.request.use(
   config => {
     // 显示loading提示
     if (!queue.length && !config["showTinyTips"] && !config["silentRequest"]) {
-      load = ViewUI.Message.loading({
-        content: "Loading...",
+      load = Message({
+        customClass: "el-message-loading",
+        iconClass: "el-message__icon el-icon-loading",
+        message: "加载中...",
         duration: 0
       });
     }

+ 1 - 2
src/modules/client/router.js

@@ -1,10 +1,9 @@
 import TaskManage from "./views/TaskManage.vue";
 
-
 export default [
   {
     path: "/task-manage",
     name: "TaskManage",
     component: TaskManage
-  },
+  }
 ];

+ 2 - 2
src/modules/client/store.js

@@ -4,7 +4,7 @@ const state = {
   scanNo: 0, // 已采集数量(从当前设置的计数时间算起)
   unuploadNo: 0, // 未上传数量(从当前设置的计数时间算起),
   startCountTime: null, // 计数时间,默认:当前登录时间
-  showToLoginModel: false,
+  showToLoginModel: false
 };
 
 const mutations = {
@@ -27,7 +27,7 @@ const actions = {
     const startCountTime = Object.assign({}, state.startCountTime, data);
     commit("setStartCountTime", startCountTime);
     await db.setDict("startCountTime", JSON.stringify(startCountTime));
-  },
+  }
 };
 
 export default {

+ 5 - 6
src/modules/client/views/TaskManage.vue

@@ -6,11 +6,10 @@
 
 <script>
 export default {
-  name:"task-manage",
-  data () {
-    return {
-    }
+  name: "task-manage",
+  data() {
+    return {};
   },
-  methods:{}
-}
+  methods: {}
+};
 </script>

+ 10 - 8
src/modules/login/views/LoginHome.vue

@@ -1,16 +1,18 @@
 <template>
-  <div class="login-home">
+  <layout class="login-home">
     login-home
-  </div>
+  </layout>
 </template>
 
 <script>
+import Layout from "../../../views/Layout.vue";
+
 export default {
-  name:"login-home",
-  data () {
-    return {
-    }
+  name: "login-home",
+  components: { Layout },
+  data() {
+    return {};
   },
-  methods:{}
-}
+  methods: {}
+};
 </script>

+ 3 - 26
src/plugins/imageOcr.js

@@ -1,13 +1,8 @@
-import {
-  getInputDir,
-  getOutputDir,
-  makeDirSync
-} from "./env";
+import { getInputDir, getOutputDir, makeDirSync } from "./env";
 import { randomCode } from "./utils";
 const fs = require("fs");
 const path = require("path");
 
-
 /**
  * 旋转图片,并保存为正式文件
  * @param {*} imgPath 图片路径
@@ -17,20 +12,8 @@ const path = require("path");
 async function saveOutputImage(imgPath, paperInfo, collectConfig) {
   // console.log(collectConfig);
   const outputOriginPath = saveOriginImage(imgPath, paperInfo);
-  const outputFormalPath = await saveFormalImage(
-    imgPath,
-    paperInfo,
-    collectConfig
-  );
-  const outputSlicelPath = await saveSliceImage(
-    imgPath,
-    paperInfo,
-    collectConfig
-  ).catch(() => {});
 
-  if (outputSlicelPath && outputFormalPath)
-    return { outputSlicelPath, outputFormalPath, outputOriginPath };
-  return Promise.reject("试卷保存失败");
+  return outputOriginPath;
 }
 
 function saveOriginImage(imgPath, paperInfo) {
@@ -41,9 +24,6 @@ function saveOriginImage(imgPath, paperInfo) {
   return outputOriginPath;
 }
 
-
-
-
 function getOutputImagePath(paperInfo, type) {
   const outputDir = path.join(
     getOutputDir(type),
@@ -80,7 +60,4 @@ function getEarliestFile(dir) {
   };
 }
 
-export {
-  saveOutputImage,
-  getEarliestFile,
-};
+export { saveOutputImage, getEarliestFile };

+ 1 - 1
src/plugins/imageUpload.js

@@ -38,7 +38,7 @@ function toUploadImg(options, type) {
 function toUploadStudent(options) {
   const datas = {
     subjectId: options.subjectId,
-    examNumber: options.examNumber,
+    examNumber: options.examNumber
   };
   return uploadStudent(datas);
 }

+ 2 - 3
src/store.js

@@ -15,10 +15,9 @@ export default new Vuex.Store({
   mutations: {
     setUser(state, user) {
       state.user = user;
-    },
-  },
-  actions: {
+    }
   },
+  actions: {},
   modules: {
     client
   }

+ 2 - 3
src/views/Home.vue

@@ -1,6 +1,5 @@
 <template>
-  <Layout :back-handle="toBack">
-  </Layout>
+  <layout :back-handle="toBack"> </layout>
 </template>
 
 <script>
@@ -18,7 +17,7 @@ export default {
   components: { Layout },
   data() {
     return {
-      showProgress: false,
+      showProgress: false
     };
   },
   computed: {

+ 16 - 9
src/views/Layout.vue

@@ -1,8 +1,7 @@
 <template>
   <div class="home">
-    <div class="home-header">
-      <div class="head-title">
-      </div>
+    <div class="home-head">
+      <div class="head-title"></div>
       <div class="head-actions">
         <span class="action-icon" title="返回" @click="toBack">
           <i class="el-icon-arrow-left"></i>
@@ -25,27 +24,35 @@
           <i class="el-icon-switch-button"></i>
         </span>
       </div>
- 
     </div>
     <div class="home-body">
       <router-view />
     </div>
+    <div class="home-footer">
+      <div class="home-footer-ip">
+        <i class="el-icon-link"></i><span>{{ domain }}</span>
+      </div>
+      <div class="home-footer-version">版本号:{{ version }}</div>
+    </div>
   </div>
 </template>
 
 <script>
 const { ipcRenderer } = require("electron");
+const pkInfo = require("./package.json");
 
 export default {
   name: "layout",
   props: {
     backHandle: {
-      type: Function,
-    },
+      type: Function
+    }
   },
   data() {
     return {
       isDev: process.env.NODE_ENV === "development",
+      domain: "",
+      version: pkInfo.version
     };
   },
   methods: {
@@ -71,9 +78,9 @@ export default {
         content: "请确保当前窗口没有任务正在进行,确认要关闭当前窗口吗?",
         onOk: () => {
           ipcRenderer.send("close-window");
-        },
+        }
       });
-    },
-  },
+    }
+  }
 };
 </script>

+ 8 - 49
vue.config.js

@@ -1,67 +1,26 @@
-var TerserPlugin = require("terser-webpack-plugin");
-var devProxy = {};
-try {
-  devProxy = require("./dev-proxy");
-} catch (error) {}
-
-var proxy = process.env.NODE_ENV === "production" ? {} : devProxy;
-
 // 配置手册: https://cli.vuejs.org/zh/config/#vue-config-js
 // electron-bulder配置:https://www.electron.build/configuration/contents#extrafiles
 var config = {
   // publicPath: './',
   devServer: {
-    port: 8066
+    port: 8066,
   },
   pluginOptions: {
     electronBuilder: {
-      externals: ["node-xlsx"],
+      externals: [],
       builderOptions: {
         extraFiles: [
-          "extra/encrypt/**",
-          "extra/font/**",
-          "extra/imagemagick/**",
-          "extra/zxing/**",
-          "extra/zxingA/**",
-          "extra/artControl/**",
+          "extra/gather/**",
           "extra/database/org.rdb",
           "config.sample.json",
-          "sense_shield_installer_pub_2.2.0.46331.exe"
         ],
         win: {
           target: "portable",
-          signAndEditExecutable: false
-        }
-      }
-    }
-  }
-};
-
-// compress配置手册:https://github.com/mishoo/UglifyJS2/tree/harmony#compress-options
-if (process.env.NODE_ENV === "production") {
-  config.configureWebpack = {
-    plugins: [],
-    optimization: {
-      minimizer: [
-        new TerserPlugin({
-          terserOptions: { compress: { drop_console: true } }
-        })
-      ]
-    }
-  };
-}
-
-if (proxy && Object.keys(proxy).length) {
-  config.devServer.proxy = proxy;
-}
-
-// 解决iview自定义主题导入less报错
-config.css = {
-  loaderOptions: {
-    less: {
-      javascriptEnabled: true
-    }
-  }
+          signAndEditExecutable: false,
+        },
+      },
+    },
+  },
 };
 
 module.exports = config;