优化样式 新增版本号

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 @@ 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,
@@ -41,6 +41,7 @@ app.whenReady().then(() => {
// 创建打印小票子窗口
const printWin = new BrowserWindow({
show: false,
width: 580,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
@@ -55,19 +56,26 @@ app.whenReady().then(() => {
printWin.loadFile(path.resolve(__dirname, '../dist/print.html')); // 打包后使用文件路径访问应用
}
printWin.webContents.openDevTools()
ipcMain.on('printerInfoSync', (event, params) => {
console.log(JSON.parse(params))
// console.log(JSON.parse(params))
printWin.webContents.send('getParams', params)
})
// 执行打印操作
ipcMain.on('printStart', () => {
console.log('开始打印')
printWin.webContents.print({
silent: true
// console.log('开始打印')
printWin.webContents.printToPDF({}, (error, data) => {
if (!error && data) {
console.log("成功生成PDF")
} else {
console.error("无法生成PDF", error)
}
})
// printWin.webContents.print({
// silent: true
// })
})
});