From 6629496569777a756f452dacd37c619140cca1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Wed, 8 Jan 2025 16:35:03 +0800 Subject: [PATCH 1/2] test --- src/main/index.js | 7 +++++++ .../classTask/newClassTaskAssign/index.vue | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/main/index.js b/src/main/index.js index f43c571..a430510 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -244,6 +244,13 @@ app.on('ready', () => { loginWindow.show() loginWindow.focus() }) + // 打印窗口 + ipcMain.on('printPage', (event, printOptions) => { + //console.log("ipcMain-print-page") + mainWindow.webContents.print(printOptions, (success, failureReason) => { + if (!success) console.error(failureReason); + }); + }); //打开作业窗口 ipcMain.on('openWindow', (e, data) => { diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/index.vue index 03bb2e6..fac6342 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/index.vue @@ -161,6 +161,7 @@ const route = useRoute(); const router = useRouter() const { proxy } = getCurrentInstance() const useClassTaskStores = useClassTaskStore(); +const { ipcRenderer } = require('electron') const props = defineProps({ currentCourse: Object, @@ -841,6 +842,22 @@ const editWork = async (cform) =>{ } } + +// 测试, 未实装 +const handlePrint = () => { + const printOptions = { + silent: false, // 是否静默打印 + printBackground: true, // 是否打印背景颜色和图像 + color: false, // 是否打印为黑白 + marginsType: 0, // 边距类型,0: 默认边距,1: 无边距,2: 最小边距 + pageSize: 'A4', // 纸张大小 + // 其他选项可以根据需要配置 + }; + + console.log("print-page-click"); + ipcRenderer.send('printPage', printOptions); +}; + //---- -- 2.44.0.windows.1 From 8185cc458d09d6aa3f7cc5fa9e12888e4579f169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Mon, 13 Jan 2025 14:49:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E4=BD=9C=E4=B8=9A=E8=AE=BE=E8=AE=A1]=20-?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/classTask/newClassTaskAssign/index.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/index.vue index fac6342..a8ab3c4 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/index.vue @@ -78,7 +78,7 @@
- +
@@ -994,5 +994,8 @@ const handlePrint = () => { } } } +::v-deep img { + display: inline-block !important; +} -- 2.44.0.windows.1