zhangjie 2 rokov pred
rodič
commit
562aa77133

+ 1 - 1
package.json

@@ -8,7 +8,7 @@
     "build": "vue-cli-service build",
     "lint": "vue-cli-service lint",
     "win:build": "vue-cli-service electron:build",
-    "e:build": "vue-cli-service electron:build --win --x64 --ia32",
+    "e:build": "vue-cli-service electron:build --win --x64",
     "e:serve": "vue-cli-service electron:serve",
     "postinstall": "electron-builder install-app-deps --arch=x64",
     "postuninstall": "electron-builder install-app-deps"

+ 0 - 3
public/index.html

@@ -12,9 +12,6 @@
   <script type="text/javascript">
     if (typeof require != "undefined") {
       window.nodeRequire = require;
-      delete window.require;
-      delete window.exports;
-      delete window.module;
     }
   </script>
   <script>

+ 3 - 2
src/background.js

@@ -5,7 +5,7 @@ import {
   createProtocol
   /* installVueDevtools */
 } from "vue-cli-plugin-electron-builder/lib";
-const isDevelopment = process.env.NODE_ENV !== "production";
+const isDevelopment = process.env.NODE_ENV === "development";
 
 // Keep a global reference of the window object, if you don't, the window will
 // be closed automatically when the JavaScript object is garbage collected.
@@ -34,7 +34,8 @@ function createWindow() {
     webPreferences: {
       nodeIntegration: true,
       webSecurity: false,
-      enableRemoteModule: true
+      enableRemoteModule: true,
+      contextIsolation: false
     }
   });
 

+ 1 - 1
src/plugins/crypto.js

@@ -1,4 +1,4 @@
-const CryptoJS = window.nodeRequire("crypto-js");
+const CryptoJS = window.require("crypto-js");
 
 export const Base64 = content => {
   const words = CryptoJS.enc.Utf8.parse(content);

+ 1 - 1
src/plugins/env.js

@@ -4,7 +4,7 @@ const process = window.nodeRequire('process')
 const homePath = path.dirname(process.execPath);
 const storePath = path.join(homePath, "stores");
 const extraPath =
-  process.env.NODE_ENV === "production"
+  process.env.NODE_ENV !== "development"
     ? path.join(homePath, "extra")
     : path.join(__static, "../extra");
 

+ 2 - 2
src/plugins/imageUpload.js

@@ -1,6 +1,6 @@
 const fs = window.nodeRequire("fs");
 const path = window.nodeRequire("path");
-const crypto = window.nodeRequire("crypto");
+const crypto = window.require("crypto");
 import { uploadFormalImage } from "../modules/client/api";
 import { Message } from "element-ui";
 
@@ -10,7 +10,7 @@ import { Message } from "element-ui";
  */
 function toUploadImg(options) {
   const formData = new FormData();
-  // frontFile,frontMd5,versoFile,versoMd5,taskId
+  // frontFile,frontMd5,versoFile,vers5,taskId
 
   const { file: frontFile, md5: frontMd5 } = getFileAdnMd5(
     options.frontOriginImgPath

+ 6 - 6
src/plugins/utils.js

@@ -1,4 +1,4 @@
-const deepmerge = window.nodeRequire("deepmerge");
+// const deepmerge = window.nodeRequire("deepmerge");
 
 /**
  * 判断对象类型
@@ -26,10 +26,10 @@ function objTypeOf(obj) {
  * 深拷贝
  * @param {Object/Array} data 需要拷贝的数据
  */
-function deepCopy(data, options) {
-  const defObj = objTypeOf(data) === "array" ? [] : {};
-  return deepmerge(defObj, data, options || {});
-}
+// function deepCopy(data, options) {
+//   const defObj = objTypeOf(data) === "array" ? [] : {};
+//   return deepmerge(defObj, data, options || {});
+// }
 
 /**
  * 将目标对象中有的属性值与源对象中的属性值合并
@@ -152,7 +152,7 @@ function timeNumberToText(timeNumber) {
 
 export {
   objTypeOf,
-  deepCopy,
+  // deepCopy,
   objAssign,
   randomCode,
   qsParams,

+ 2 - 2
vue.config.js

@@ -7,7 +7,7 @@ var config = {
   },
   pluginOptions: {
     electronBuilder: {
-      externals: [],
+      externals: ["crypto-js", "log4js", "gm", "cropperjs"],
       builderOptions: {
         extraFiles: [
           "extra/scan/**",
@@ -15,7 +15,7 @@ var config = {
           "config.sample.json",
           "extra/imagemagick/**",
           "extra/zxing/**",
-          "extra/zxingA/**",
+          "extra/zxingA/**"
         ],
         win: {
           target: "portable",