Browse Source

encrypt md

zhangjie 4 years ago
parent
commit
cb6988f101

+ 42 - 0
README.md

@@ -69,3 +69,45 @@ const extraPath =
     ? path.join(homePath, "extra")
     : path.join(__static, "../extra");
 ```
+
+## 配置打包参数(可选)
+
+```json
+{
+  "pluginOptions": {
+    "electronBuilder": {
+      "builderOptions": {
+        "appId": "com.example.app",
+        "productName": "aDemo", // 项目名,也是生成的安装文件名,即aDemo.exe
+        "copyright": "Copyright © 2020", //版权信息
+        "directories": {
+          "output": "./dist" //输出文件路径
+        },
+        "win": {
+          // win相关配置
+          "icon": "./shanqis.ico", // 图标,当前图标在根目录下,注意这里有两个坑
+          "target": [
+            {
+              "target": "nsis", // 利用nsis制作安装程序
+              "arch": [
+                "x64" // 64位
+              ]
+            }
+          ]
+        },
+        "nsis": {
+          "oneClick": false, // 是否一键安装
+          "allowElevation": true, // 允许请求提升。 如果为false,则用户必须使用提升的权限重新启动安装程序。
+          "allowToChangeInstallationDirectory": true, // 允许修改安装目录
+          "installerIcon": "./shanqis.ico", // 安装图标
+          "uninstallerIcon": "./shanqis.ico", //卸载图标
+          "installerHeaderIcon": "./shanqis.ico", // 安装时头部图标
+          "createDesktopShortcut": true, // 创建桌面图标
+          "createStartMenuShortcut": true, // 创建开始菜单图标
+          "shortcutName": "demo" // 图标名称
+        }
+      }
+    }
+  }
+}
+```

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
   "private": true,
   "scripts": {
     "start": "yarn run electron:serve",
-    "e:build": "yarn run electron:build",
+    "e:build": "vue-cli-service electron:build",
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
     "lint": "vue-cli-service lint",

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

@@ -497,6 +497,10 @@ export default {
       if (this.isWaiting) {
         this.restartInitFile();
       }
+      this.$Message.success({
+        content: "加密狗检测成功!",
+        duration: 3
+      });
     },
     encryptError(error) {
       if (!this.exceptionIsConfirm) return;

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

@@ -399,6 +399,10 @@ export default {
       if (this.isWaiting) {
         this.restartInitFile();
       }
+      this.$Message.success({
+        content: "加密狗检测成功!",
+        duration: 3
+      });
     },
     encryptError(error) {
       // 只要异常没有被手动确认,则不会再次弹窗。

+ 12 - 1
src/plugins/encryptProcess.js

@@ -60,11 +60,22 @@ const checkToolIsStart = () => {
   });
 };
 
+const startEncryptProcess = () => {
+  return new Promise(resolve => {
+    childProcess.exec(`${encryptTool} ${PORT}`);
+    // 检测工具是个持续进程,调用时无法获取进程开启成功信息。
+    // 目前延时2000ms处理。
+    setTimeout(() => {
+      resolve();
+    }, 2000);
+  });
+};
+
 const startEncryptTool = async () => {
   const res = await checkToolIsStart().catch(error => {
     console.log(error);
   });
-  if (!res) childProcess.exec(`${encryptTool} ${PORT}`);
+  if (!res) await startEncryptProcess();
 };
 
 const checkStatus = (datas, types) => {