[门禁端] Electron打包完成;后端可自定义生成小程序码width
This commit is contained in:
		
							
								
								
									
										29
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								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/
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								client-entrance-guard/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								client-entrance-guard/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,2 +1,3 @@
 | 
			
		||||
node_modules/
 | 
			
		||||
.DS_Store
 | 
			
		||||
out
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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": {}
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user