优化样式 新增版本号

This commit is contained in:
gyq
2024-03-07 16:15:03 +08:00
parent 4a5b52fa45
commit 31ef882431
16 changed files with 291 additions and 186 deletions

View File

@@ -7,9 +7,9 @@ electron.app.whenReady().then(() => {
width: 1024,
height: 768,
fullscreenable: true,
fullscreen: false,
fullscreen: process.env.VITE_DEV_SERVER_URL ? false : true,
simpleFullscreen: true,
frame: true,
frame: process.env.VITE_DEV_SERVER_URL ? true : false,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
@@ -31,6 +31,7 @@ electron.app.whenReady().then(() => {
});
const printWin = new electron.BrowserWindow({
show: false,
width: 580,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
@@ -42,15 +43,16 @@ electron.app.whenReady().then(() => {
} else {
printWin.loadFile(path.resolve(__dirname, "../dist/print.html"));
}
printWin.webContents.openDevTools();
electron.ipcMain.on("printerInfoSync", (event, params) => {
console.log(JSON.parse(params));
printWin.webContents.send("getParams", params);
});
electron.ipcMain.on("printStart", () => {
console.log("开始打印");
printWin.webContents.print({
silent: true
printWin.webContents.printToPDF({}, (error, data) => {
if (!error && data) {
console.log("成功生成PDF");
} else {
console.error("无法生成PDF", error);
}
});
});
});