From 887dce0a36b08b122ce72b0d3ccd7cba1378d357 Mon Sep 17 00:00:00 2001 From: myllxy <2720190431@qq.com> Date: Mon, 14 Nov 2022 10:00:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E8=A1=A8=E6=A1=8C=E9=9D=A2?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=AD=E6=96=87=E4=B9=B1=E7=A0=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 18 ++++++++++-------- src/js/main.js | 4 ++-- src/views/setting.html | 7 +++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 863328c..36dc7b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "JUSTAR", - "version": "2.2.0", + "version": "2.2.1", "description": "钜星科技便民问诊系统", "main": "src/index.js", "scripts": { @@ -18,8 +18,7 @@ "directories": { "output": "build" }, - - "extraResources":[ + "extraResources": [ { "from": "./static", "to": "../static" @@ -62,10 +61,12 @@ ] } ], - "publish": [{ - "provider": "generic", - "url": "http://192.168.1.158:8889/file" - }] + "publish": [ + { + "provider": "generic", + "url": "http://192.168.1.158:8889/file" + } + ] }, "linux": { "icon": "./static/images/justar.ico" @@ -79,7 +80,7 @@ "createDesktopShortcut": false, "installerIcon": "./static/images/justar.ico", "uninstallerIcon": "./static/images/justar.ico", - "include":"./installer.nsh" + "include": "./installer.nsh" } }, "dependencies": { @@ -89,6 +90,7 @@ "electron-log": "^4.4.1", "electron-updater": "^4.3.9", "fs": "^0.0.1-security", + "iconv-lite": "^0.6.3", "jquery": "^3.6.0", "node-fetch": "2.6.1", "popper.js": "^1.16.1", diff --git a/src/js/main.js b/src/js/main.js index a3d4562..bfa942b 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -159,7 +159,7 @@ let main ={ } }, { - label:'版本号:2.2.0', + label:'版本号:2.2.1', icon: respath + path.sep+ "static"+ path.sep+"images"+ path.sep+"paste.png", },] }); @@ -167,4 +167,4 @@ let main ={ } -module.exports=main \ No newline at end of file +module.exports=main diff --git a/src/views/setting.html b/src/views/setting.html index 3c80093..6a46dab 100644 --- a/src/views/setting.html +++ b/src/views/setting.html @@ -95,17 +95,20 @@ const ws = require('windows-shortcuts'); const os=require('os'); const process = require('child_process'); + const iconv = require('iconv-lite'); + const encoding = 'cp936'; + const binaryEncoding = 'binary'; const keyPath = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders';//选择要修改或者保存或者删除的路径(操作路径) let desktop; let ele = require('electron'); let ipcRenderer = ele.ipcRenderer; window.$ = window.jquery = require('jquery'); let update_info = {}; - process.exec(`REG QUERY "${keyPath}" /v Desktop`, function (error, stdout, stderr) { + process.exec(`REG QUERY "${keyPath}" /v Desktop`, {encoding: binaryEncoding}, function (error, stdout, stderr) { if (error != null) { console.log('获取注册表桌面路径失败,异常如下:' + error); } else { - let value = stdout.split(" "); + let value = iconv.decode(new Buffer(stdout, binaryEncoding), encoding).split(" "); desktop = value[value.length - 1].replace(/^\s*|\s*$/g, ""); //获取注册表实际值并去除首尾空格 } });