From f8d5105ce059cc10fe13b43c98eeb93145c0b530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Mon, 28 Nov 2022 20:53:41 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=97=A8=E7=A6=81=E7=AB=AF]=20Electron?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=AE=8C=E6=88=90=EF=BC=9B=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E5=8F=AF=E8=87=AA=E5=AE=9A=E4=B9=89=E7=94=9F=E6=88=90=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=A0=81width?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 29 +++++++++++++ .../controller/WeChatTokenController.java | 2 + client-entrance-guard/.gitignore | 1 + client-entrance-guard/html/renderer.js | 3 +- client-entrance-guard/package.json | 41 ++++++++++++++++++- 5 files changed, 74 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa0bd9c..01d7aa7 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,16 @@ npm install -g @tarojs/cli +##### Electron + +```bash +cd client-entrance-guard +cnpm install --save-dev electron +cnpm install --save-dev @electron-forge/cli +``` + + + #### 2.克隆项目代码到本地 ```bash @@ -395,6 +405,21 @@ cnpm install +#### 10.门禁端打包 + +> 参考文档:https://www.electronjs.org/docs/latest/tutorial/tutorial-packaging + +使用**管理员身份**打开命令行,然后运行以下命令: + +```bash +npm run package +npm run make +``` + + + + + ### Step1. 启动项目后端 #### 1.启动nacos @@ -563,6 +588,10 @@ Taro:https://docs.taro.zone/docs 开发文档:https://www.electronjs.org/docs/latest/tutorial/quick-start +Electron Forge打包时的一些常见问题:https://blog.csdn.net/qq_49700358/article/details/126531158 + +打包:https://www.electronjs.org/docs/latest/tutorial/tutorial-packaging + #### cnpm npmmirror 中国镜像站:https://npmmirror.com/ diff --git a/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/WeChatTokenController.java b/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/WeChatTokenController.java index 872e8e4..f9dd251 100644 --- a/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/WeChatTokenController.java +++ b/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/WeChatTokenController.java @@ -31,6 +31,7 @@ public class WeChatTokenController { @SneakyThrows public byte[] getUnlimitedQRCode(@RequestParam(value = "envVersion", required = false, defaultValue = "develop") String envVersion, @RequestParam(value = "page", required = false, defaultValue = "pages/index/index") String page, + @RequestParam(value = "width", required = false, defaultValue = "430") Integer width, @RequestParam(value = "autoColor", required = false, defaultValue = "false") Boolean autoColor, @RequestParam(value = "isHyaline", required = false, defaultValue = "false") Boolean isHyaline, @RequestParam(value = "scene", required = true) String scene) { @@ -39,6 +40,7 @@ public class WeChatTokenController { unlimitedQRCodeParam.setScene(scene); unlimitedQRCodeParam.setPage(page); unlimitedQRCodeParam.setEnvVersion(envVersion); + unlimitedQRCodeParam.setWidth(width); unlimitedQRCodeParam.setAutoColor(autoColor); unlimitedQRCodeParam.setIsHyaline(isHyaline); okhttp3.ResponseBody responseBody = weChatTokenService.getUnlimitedQRCodeFromApi(accessToken, unlimitedQRCodeParam); diff --git a/client-entrance-guard/.gitignore b/client-entrance-guard/.gitignore index 2752eb9..70549ed 100644 --- a/client-entrance-guard/.gitignore +++ b/client-entrance-guard/.gitignore @@ -1,2 +1,3 @@ node_modules/ .DS_Store +out diff --git a/client-entrance-guard/html/renderer.js b/client-entrance-guard/html/renderer.js index 981ec32..3b1719c 100644 --- a/client-entrance-guard/html/renderer.js +++ b/client-entrance-guard/html/renderer.js @@ -3,6 +3,7 @@ const page = "pages/index/index"; // "pages/scan/entrance"; const envVersion = "develop"; // 正式版为 "release",体验版为 "trial",开发版为 "develop" const autoColor = true; const isHyaline = false; +const width = 500; const image = document.getElementById('qrcode'); const refreshTimeCountDown = document.getElementById('refreshTimeCountDown'); @@ -11,7 +12,7 @@ let i = 0, refreshTime = 10 + 1; function updateQRCode() { if (i % refreshTime == 0) { let scene = encodeURIComponent(`guard&${Date.now()}`); - image.src = `${url}?page=${page}&scene=${scene}&envVersion=${envVersion}&autoColor=${autoColor}&isHyaline=${isHyaline}`; + image.src = `${url}?page=${page}&scene=${scene}&envVersion=${envVersion}&width=${width}&autoColor=${autoColor}&isHyaline=${isHyaline}`; console.log(image.src); refreshTimeCountDown.innerHTML = ` ` } else { diff --git a/client-entrance-guard/package.json b/client-entrance-guard/package.json index 953447e..74cc0ee 100644 --- a/client-entrance-guard/package.json +++ b/client-entrance-guard/package.json @@ -5,11 +5,50 @@ "description": "社区疫情防控系统 - 门禁端", "main": "main.js", "scripts": { - "start": "electron ." + "start": "electron-forge start", + "package": "electron-forge package", + "make": "electron-forge make", + "e-start": "electron ." }, "license": "MIT", "devDependencies": { "@electron-forge/cli": "^6.0.3", + "@electron-forge/maker-deb": "^6.0.3", + "@electron-forge/maker-rpm": "^6.0.3", + "@electron-forge/maker-squirrel": "^6.0.3", + "@electron-forge/maker-zip": "^6.0.3", "electron": "^21.3.1" + }, + "dependencies": { + "electron-squirrel-startup": "^1.0.0", + "listr2": "^5.0.5", + "rxjs": "^7.5.7" + }, + "config": { + "forge": { + "packagerConfig": {}, + "makers": [ + { + "name": "@electron-forge/maker-squirrel", + "config": { + "name": "electron_demo" + } + }, + { + "name": "@electron-forge/maker-zip", + "platforms": [ + "darwin" + ] + }, + { + "name": "@electron-forge/maker-deb", + "config": {} + }, + { + "name": "@electron-forge/maker-rpm", + "config": {} + } + ] + } } }