diff --git a/playwright.config.ts b/playwright.config.ts index bbd7b4c..e87144a 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -34,7 +34,7 @@ export default defineConfig({ projects: [ { name: 'chromium', - use: { + use: { ...devices['Desktop Chrome'], /* Enable headless mode */ headless: true diff --git a/src/main/index.ts b/src/main/index.ts index 06e06b4..f96d110 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -3,13 +3,18 @@ import { join } from 'path' import { electronApp, optimizer, is } from '@electron-toolkit/utils' import icon from '../../resources/icon.png?asset' +let mainWindow: BrowserWindow | null = null + function createWindow(): void { // Create the browser window. - const mainWindow = new BrowserWindow({ + mainWindow = new BrowserWindow({ width: 900, height: 670, show: false, autoHideMenuBar: true, + resizable: false, // 禁止拖拽放大缩小 + maximizable: false, // 禁止最大化 + minimizable: true, // 允许最小化 ...(process.platform === 'linux' ? { icon } : {}), webPreferences: { preload: join(__dirname, '../preload/index.js'), @@ -18,7 +23,7 @@ function createWindow(): void { }) mainWindow.on('ready-to-show', () => { - mainWindow.show() + mainWindow?.show() }) mainWindow.webContents.setWindowOpenHandler((details) => { @@ -52,6 +57,15 @@ app.whenReady().then(() => { // IPC test ipcMain.on('ping', () => console.log('pong')) + // 监听登录成功事件,恢复窗口拖拽功能 + ipcMain.on('login-success', () => { + if (mainWindow) { + mainWindow.setResizable(true) + mainWindow.setMaximizable(true) + console.log('窗口拖拽功能已恢复') + } + }) + createWindow() app.on('activate', function () { diff --git a/src/renderer/src/views/login/index.vue b/src/renderer/src/views/login/index.vue index 9ebd713..1a1eb95 100644 --- a/src/renderer/src/views/login/index.vue +++ b/src/renderer/src/views/login/index.vue @@ -20,7 +20,7 @@
手机扫码登录
- +
@@ -140,12 +140,16 @@
-