lyc-dev #59

Merged
lyc merged 6 commits from lyc-dev into main 2024-07-24 15:27:58 +08:00
1 changed files with 11 additions and 7 deletions
Showing only changes of commit 0086ce4236 - Show all commits

View File

@ -41,7 +41,7 @@ function createMainWindow() {
width: 1200, width: 1200,
height: 700, height: 700,
show: false, show: false,
frame: false,// 无边框 frame: false, // 无边框
autoHideMenuBar: true, autoHideMenuBar: true,
...(process.platform === 'linux' ? { icon } : {}), ...(process.platform === 'linux' ? { icon } : {}),
webPreferences: { webPreferences: {
@ -84,13 +84,16 @@ function createOpenWin(data) {
nodeIntegration: true nodeIntegration: true
} }
}) })
let cookieDetails = {...data.cookieData} let cookieDetails = { ...data.cookieData }
openWindow.webContents.session.cookies.set(cookieDetails).then(()=>{ console.log(cookieDetails)
console.log('Cookie set successfully.') openWindow.webContents.session.cookies.set(cookieDetails, (error) => {
}).catch(err =>{ if (error) {
console.error('Set cookie failed:', error) console.error('设置cookie出错:', error)
} else {
console.log('设置cookie成功')
}
}) })
openWindow.loadURL(data.fullPath) openWindow.loadURL(data.fullPath)
openWindow.once('ready-to-show', () => { openWindow.once('ready-to-show', () => {
@ -149,6 +152,7 @@ app.on('ready', () => {
createLoginWindow() createLoginWindow()
} }
mainWindow.destroy() mainWindow.destroy()
mainWindow = null
loginWindow.show() loginWindow.show()
loginWindow.focus() loginWindow.focus()
}) })