1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

[门禁端] Electron打包完成;后端可自定义生成小程序码width

This commit is contained in:
程序员小墨 2022-11-28 20:53:41 +08:00
parent 63568f8433
commit f8d5105ce0
5 changed files with 74 additions and 2 deletions

View File

@ -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.克隆项目代码到本地 #### 2.克隆项目代码到本地
```bash ```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. 启动项目后端 ### Step1. 启动项目后端
#### 1.启动nacos #### 1.启动nacos
@ -563,6 +588,10 @@ Tarohttps://docs.taro.zone/docs
开发文档https://www.electronjs.org/docs/latest/tutorial/quick-start 开发文档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 #### cnpm
npmmirror 中国镜像站https://npmmirror.com/ npmmirror 中国镜像站https://npmmirror.com/

View File

@ -31,6 +31,7 @@ public class WeChatTokenController {
@SneakyThrows @SneakyThrows
public byte[] getUnlimitedQRCode(@RequestParam(value = "envVersion", required = false, defaultValue = "develop") String envVersion, 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 = "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 = "autoColor", required = false, defaultValue = "false") Boolean autoColor,
@RequestParam(value = "isHyaline", required = false, defaultValue = "false") Boolean isHyaline, @RequestParam(value = "isHyaline", required = false, defaultValue = "false") Boolean isHyaline,
@RequestParam(value = "scene", required = true) String scene) { @RequestParam(value = "scene", required = true) String scene) {
@ -39,6 +40,7 @@ public class WeChatTokenController {
unlimitedQRCodeParam.setScene(scene); unlimitedQRCodeParam.setScene(scene);
unlimitedQRCodeParam.setPage(page); unlimitedQRCodeParam.setPage(page);
unlimitedQRCodeParam.setEnvVersion(envVersion); unlimitedQRCodeParam.setEnvVersion(envVersion);
unlimitedQRCodeParam.setWidth(width);
unlimitedQRCodeParam.setAutoColor(autoColor); unlimitedQRCodeParam.setAutoColor(autoColor);
unlimitedQRCodeParam.setIsHyaline(isHyaline); unlimitedQRCodeParam.setIsHyaline(isHyaline);
okhttp3.ResponseBody responseBody = weChatTokenService.getUnlimitedQRCodeFromApi(accessToken, unlimitedQRCodeParam); okhttp3.ResponseBody responseBody = weChatTokenService.getUnlimitedQRCodeFromApi(accessToken, unlimitedQRCodeParam);

View File

@ -1,2 +1,3 @@
node_modules/ node_modules/
.DS_Store .DS_Store
out

View File

@ -3,6 +3,7 @@ const page = "pages/index/index"; // "pages/scan/entrance";
const envVersion = "develop"; // 正式版为 "release",体验版为 "trial",开发版为 "develop" const envVersion = "develop"; // 正式版为 "release",体验版为 "trial",开发版为 "develop"
const autoColor = true; const autoColor = true;
const isHyaline = false; const isHyaline = false;
const width = 500;
const image = document.getElementById('qrcode'); const image = document.getElementById('qrcode');
const refreshTimeCountDown = document.getElementById('refreshTimeCountDown'); const refreshTimeCountDown = document.getElementById('refreshTimeCountDown');
@ -11,7 +12,7 @@ let i = 0, refreshTime = 10 + 1;
function updateQRCode() { function updateQRCode() {
if (i % refreshTime == 0) { if (i % refreshTime == 0) {
let scene = encodeURIComponent(`guard&${Date.now()}`); 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); console.log(image.src);
refreshTimeCountDown.innerHTML = ` ` refreshTimeCountDown.innerHTML = ` `
} else { } else {

View File

@ -5,11 +5,50 @@
"description": "社区疫情防控系统 - 门禁端", "description": "社区疫情防控系统 - 门禁端",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
"start": "electron ." "start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"e-start": "electron ."
}, },
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@electron-forge/cli": "^6.0.3", "@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" "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": {}
}
]
}
} }
} }