From ce274237dcf8a52c1127153b0f1384630f392d2c Mon Sep 17 00:00:00 2001 From: lyc Date: Mon, 5 Aug 2024 16:24:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/index.js | 27 +++-- src/renderer/src/api/teaching/classwork.js | 9 ++ .../src/components/choose-textbook/index.vue | 61 +++++++--- .../src/components/move-file/index.vue | 14 ++- src/renderer/src/views/prepare/index.vue | 106 ++++++++++-------- 5 files changed, 138 insertions(+), 79 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 673da1f..6064613 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -103,11 +103,12 @@ function createMainWindow() { remote.enable(mainWindow.webContents) } -// 作业窗口相关-开发中 -let linkWindow +// 打开外部链接窗口 +let linkWin = {} async function createLinkWin(data) { - if (linkWindow) return - linkWindow = new BrowserWindow({ + if (linkWin[data.key]) return + + linkWin[data.key] = new BrowserWindow({ show: false, frame: true, maximizable: true, @@ -120,9 +121,10 @@ async function createLinkWin(data) { contextIsolation: true } }) - linkWindow.type = 'link' // 唯一标识 + linkWin[data.key].type = 'link' // 唯一标识 + let cookieDetails = { ...data.cookieData } - await linkWindow.webContents.session.cookies + await linkWin[data.key].webContents.session.cookies .set(cookieDetails) .then(() => { console.log('Cookie is successful') @@ -131,14 +133,15 @@ async function createLinkWin(data) { console.error('Cookie is error', error) }) data.fullPath = data.fullPath.replaceAll('//', '/') - linkWindow.loadURL(data.fullPath) + linkWin[data.key].loadURL(data.fullPath) - linkWindow.once('ready-to-show', () => { - linkWindow.show() - linkWindow.maximize() + linkWin[data.key].once('ready-to-show', () => { + linkWin[data.key].show() + linkWin[data.key].maximize() }) - linkWindow.on('closed', () => { - linkWindow = null + linkWin[data.key].on('closed', () => { + linkWin[data.key] = null + delete linkWin[data.key] }) } diff --git a/src/renderer/src/api/teaching/classwork.js b/src/renderer/src/api/teaching/classwork.js index 9412901..57da30d 100644 --- a/src/renderer/src/api/teaching/classwork.js +++ b/src/renderer/src/api/teaching/classwork.js @@ -18,6 +18,15 @@ export function listEntpcourse(query) { }) } +// 新增entpcourse +export function addEntpcourse(data) { + return request({ + url: '/education/entpcourse', + method: 'post', + data: data + }) +} + // 布置作业 export function saveByClassWorkArray(data) { return request({ diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue index d208553..2a45170 100644 --- a/src/renderer/src/components/choose-textbook/index.vue +++ b/src/renderer/src/components/choose-textbook/index.vue @@ -7,7 +7,7 @@