客户端打印设置与打包设置

This commit is contained in:
2022-08-11 11:25:49 +08:00
parent ba7af97d7c
commit 76c2834633
11 changed files with 89 additions and 54 deletions

View File

@ -1,35 +1,30 @@
############################################## ##############################################
# dscription \u77E9\u661F\u5BA2\u6237\u7AEF\u914D\u7F6E\u6587\u4EF6(\u6CE8\u610F\u7B49\u53F7\u4E24\u8FB9\u4E0D\u80FD\u6709\u7A7A\u683C) # dscription 矩星客户端配置文件(注意等号两边不能有空格)
# @auth \u58A8\u8863 # @auth 墨衣
# @time 2021-10-09 # @time 2021-10-09
############################################## ##############################################
#\u5BA2\u6237\u7AEF\u66F4\u65B0\u5730\u5740 #客户端更新地址
update_url=http://192.168.1.158:8889/file update_url=http://192.168.1.158:8889/file
#\u5BA2\u6237\u7AEF\u5730\u5740\u914D\u7F6E #客户端地址配置
pharmacy=https://tests.yunclinic.cn/pharmacy pharmacy=https://pharmacy.yunclinic.cn/
#doctor=localhost:8080/doctor doctor=https://doctor.yunclinic.cn/doctor
#pharmacist=localhost:8080/pharmacist pharmacist=https://pharmacist.yunclinic.cn/pharmacist
#pharmacy=https://pharmacy.yunclinic.cn/pharmacy
doctor=https://tests.yunclinic.cn/doctor
pharmacist=https://tests.yunclinic.cn/pharmacist
#windows\u7684C:/Users/\u7528\u6237/\u76EE\u5F55\u4E0B\u7684\u5185\u5BB9(\u5982\u679C\u662Fmac\u4E0B\u7684\u6CE8\u610F\u4FEE\u6539\u8FD9\u4E24\u4E2A\u76EE\u5F55) #windowsC:/Users/用户/目录下的内容(如果是mac下的注意修改这两个目录)
#\u5BA2\u6237\u7AEF\u7528\u6237\u521B\u5EFA\u5FEB\u6377\u65B9\u5F0F\u5B58\u653E\u76EE\u5F55->lnks.json(window) #客户端用户创建快捷方式存放目录->lnks.json(window)
lnks_url=AppData/Local/justarData lnks_url=AppData/Local/justarData
#\u5BA2\u6237\u7AEF\u7528\u6237\u7F13\u5B58\u76EE\u5F55\u4FDD\u5B58(windows) #客户端用户缓存目录保存(windows)
cache_url=AppData/Local/justarData/cache cache_url=AppData/Local/justarData/cache
#\u65E5\u5FD7\u914D\u7F6E #日志配置
#\u65E5\u5FD7\u7EA7\u522B error->warn->info->verbose->debug->silly #日志级别 error->warn->info->verbose->debug->silly
log_file_level=info log_file_level=info
log_console_level=debug log_console_level=debug
#\u65E5\u5FD7\u6587\u4EF6\u540D\uFF0C\u9ED8\u8BA4\uFF1Amain.log #日志文件名,默认:main.log
log_fileName=justar_client.log log_fileName=justar_client.log
#\u65E5\u5FD7\u683C\u5F0F\uFF0C\u9ED8\u8BA4\uFF1A[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text} #日志格式,默认:[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}
log_date_format=[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text} log_date_format=[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}
#\u65E5\u5FD7\u5927\u5C0F\uFF0C\u9ED8\u8BA4\uFF1A1048576\uFF081M\uFF09\uFF0C\u8FBE\u5230\u6700\u5927\u4E0A\u9650\u540E\uFF0C\u5907\u4EFD\u6587\u4EF6\u5E76\u91CD\u547D\u540D\u4E3A\uFF1Amain.old.log\uFF0C\u6709\u4E14\u4EC5\u6709\u4E00\u4E2A\u5907\u4EFD\u6587\u4EF6 #日志大小默认10485761M达到最大上限后备份文件并重命名为main.old.log有且仅有一个备份文件
log_maxSize=1048576 log_maxSize=1048576
#\u4FEE\u6539\u65E5\u5FD7\u6587\u4EF6\u7684\u65E5\u5FD7\u8F93\u51FA\u4F4D\u7F6E\uFF0C\u9ED8\u8BA4\u4F4D\u7F6E\u4E3A\uFF1AC:\Users\%USERPROFILE%\AppData\Roaming\Electron\logs #修改日志文件的日志输出位置,默认位置为:C:\Users\%USERPROFILE%\AppData\Roaming\Electron\logs
log_resolvePath=appData/logs/justar_client.log log_resolvePath=appData/logs/justar_client.log

View File

@ -1,6 +1,6 @@
{ {
"name": "JUSTAR", "name": "JUSTAR",
"version": "2.1.3", "version": "2.1.5",
"description": "钜星科技便民问诊系统", "description": "钜星科技便民问诊系统",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
@ -75,8 +75,8 @@
"perMachine": false, "perMachine": false,
"allowElevation": true, "allowElevation": true,
"allowToChangeInstallationDirectory": true, "allowToChangeInstallationDirectory": true,
"createDesktopShortcut": false,
"runAfterFinish": true, "runAfterFinish": true,
"createDesktopShortcut": false,
"installerIcon": "./static/images/justar.ico", "installerIcon": "./static/images/justar.ico",
"uninstallerIcon": "./static/images/justar.ico", "uninstallerIcon": "./static/images/justar.ico",
"include":"./installer.nsh" "include":"./installer.nsh"

View File

@ -157,7 +157,11 @@ let main ={
click: () => { click: () => {
this.exitSoft(respath); this.exitSoft(respath);
} }
}] },
{
label:'版本号:2.1.5',
icon: respath + path.sep+ "static"+ path.sep+"images"+ path.sep+"paste.png",
},]
}); });
} }
} }

View File

@ -1,4 +1,4 @@
# For documentation, see https://www.sumatrapdfreader.org/settings/settings3.2.html # For documentation, see https://www.sumatrapdfreader.org/settings/settings3-3-1.html
MainWindowBackground = #80fff200 MainWindowBackground = #80fff200
EscToExit = false EscToExit = false
@ -13,6 +13,7 @@ FixedPageUI [
SelectionColor = #f5fc0c SelectionColor = #f5fc0c
WindowMargin = 2 4 2 4 WindowMargin = 2 4 2 4
PageSpacing = 4 4 PageSpacing = 4 4
HideScrollbars = false
] ]
EbookUI [ EbookUI [
FontName = Georgia FontName = Georgia
@ -46,6 +47,9 @@ ForwardSearch [
HighlightColor = #6581ff HighlightColor = #6581ff
HighlightPermanent = false HighlightPermanent = false
] ]
Annotations [
HighlightColor = #ffff00
]
CustomScreenDPI = 0 CustomScreenDPI = 0
RememberStatePerDocument = true RememberStatePerDocument = true
@ -63,6 +67,7 @@ WindowPos = 0 0 0 0
ShowToc = true ShowToc = true
SidebarDx = 0 SidebarDx = 0
TocDy = 0 TocDy = 0
TreeFontSize = 0
ShowStartPage = true ShowStartPage = true
UseTabs = true UseTabs = true
@ -71,6 +76,6 @@ FileStates [
SessionData [ SessionData [
] ]
TimeOfLastUpdateCheck = 0 0 TimeOfLastUpdateCheck = 0 0
OpenCountWeek = 523 OpenCountWeek = 604
# Settings after this line have not been recognized by the current version # Settings after this line have not been recognized by the current version

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,11 +0,0 @@
export interface Options {
printer?: string;
unix?: string[];
win32?: string[];
}
export function print(path: string, options?: any): Promise<void>;
export function getPrinters(): Promise<string[]>;
export function getDefaultPrinter(): Promise<string>;

View File

@ -8,6 +8,8 @@ const screen = electron.screen;
const BrowserWindow = electron.BrowserWindow; const BrowserWindow = electron.BrowserWindow;
const ipcMain = electron.ipcMain; const ipcMain = electron.ipcMain;
const print_operation=require("."+path.sep+"print_operation"); const print_operation=require("."+path.sep+"print_operation");
const os = require('os');
const fs = require("fs");
let print_monitor={ let print_monitor={
printerList_win:null, printerList_win:null,
@ -62,15 +64,40 @@ let print_monitor={
return listPrinter return listPrinter
}).then(listPrinter => { }).then(listPrinter => {
print_operation.getDefaultPrinter().then(defaultPrinter => { print_operation.getDefaultPrinter().then(defaultPrinter => {
let data = { let data ={}
listPrinter: listPrinter, //获取打印缓存
defaultPrinter: defaultPrinter, print_url = os.homedir()+path.sep+"AppData/Local/justarData/print/print.json"
pdf_url: pdf_url log.info("打印机缓存文件:"+print_url);
if(fs.existsSync(print_url)){
fs.readFile(print_url,'utf8',(err,data) =>{
if(err){
log.error("获取打印机缓存失败");
}else {
let printer_json = JSON.parse(data);
defaultPrinter = printer_json.printer_name;
data = {
listPrinter: listPrinter,
defaultPrinter: defaultPrinter,
pdf_url: pdf_url
}
win.show();
let json_data = JSON.stringify(data);
log.info("打印机列表数据【"+json_data+"】")
win.webContents.send('printerData', json_data);
}
})
}else{
data = {
listPrinter: listPrinter,
defaultPrinter: defaultPrinter.name,
pdf_url: pdf_url
}
win.show();
let json_data = JSON.stringify(data)
log.info("打印机列表数据【"+json_data+"】")
win.webContents.send('printerData', json_data);
} }
win.show();
let json_data = JSON.stringify(data)
log.info("打印机列表数据【"+json_data+"】")
win.webContents.send('printerData', json_data);
}); });
}); });
}) })

View File

@ -25,8 +25,22 @@ let printOperation={
const pdfPath = this.saveTemporaryFolder(buffer); const pdfPath = this.saveTemporaryFolder(buffer);
log.info("pdf下载完毕, 准备开始打印, 路径:【"+pdfPath+"】") log.info("pdf下载完毕, 准备开始打印, 路径:【"+pdfPath+"】")
//获取打印缓存
print_url = os.homedir()+path.sep+"AppData/Local/justarData/print/"
log.info("打印机缓存目录:"+print_url);
if(!fs.existsSync(print_url)){
fs.mkdirSync(print_url);
}
fs.writeFileSync(print_url+path.sep+"print.json", JSON.stringify({}), function (err) {
});
let thisItem = {};
thisItem.printer_name = printer_name;
let jsonstr = JSON.stringify(thisItem);
fs.writeFileSync(print_url+path.sep+"print.json", jsonstr, function (err) {
log.error("存入打印机失败:" + err);
});
pdf_printer pdf_printer
.print(pdfPath, printer_name) .print(pdfPath, {"printer":printer_name})
.then(this.onSuccess(win)) .then(this.onSuccess(win))
.catch(this.onError()) .catch(this.onError())
.finally(() => this.removePdf(pdfPath)); .finally(() => this.removePdf(pdfPath));

View File

@ -99,15 +99,15 @@
// 绘制页面 // 绘制页面
let html = []; let html = [];
for (const printer of data.listPrinter) { for (const printer of data.listPrinter) {
if (printer === defaultPrinter) { if (printer.name === defaultPrinter) {
html.push(`<a href="#" class="list-group-item list-group-item-action active" data-name="${printer}"> html.push(`<a href="#" class="list-group-item list-group-item-action active" data-name="${printer.name}">
<i class="bi bi-printer-fill"></i> &nbsp;${printer} <i class="bi bi-printer-fill"></i> &nbsp;${printer.name}
</a> </a>
`) `)
continue; continue;
} }
html.push(`<a href="#" class="list-group-item list-group-item-action" data-name="${printer}"> html.push(`<a href="#" class="list-group-item list-group-item-action" data-name="${printer.name}">
<i class="bi bi-printer-fill"></i> &nbsp;${printer} <i class="bi bi-printer-fill"></i> &nbsp;${printer.name}
</a> </a>
`) `)
} }

View File

@ -106,7 +106,7 @@
//程序更新信息监听 //程序更新信息监听
ipcRenderer.on("message", (event, args) => { ipcRenderer.on("message", (event, args) => {
if (args[0] == -1) { if (args[0] == -1) {
$("#update_label").html("<span style='color:red'>" + args[1] + "</span>"); $("#update_label").html("<span style='color:#ff0000'>" + args[1] + "</span>");
setTimeout(function () { setTimeout(function () {
$("#box2").hide(); $("#box2").hide();
if (!$("#box1").is(":visible") && !$("#box").is(":visible") && !$("#box3").is(":visible")) { if (!$("#box1").is(":visible") && !$("#box").is(":visible") && !$("#box3").is(":visible")) {