From 58d109069c2d795344df2f88aeba751553b8590a Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Thu, 11 Jul 2024 09:30:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96pc=E5=8F=AF=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +++--- src/App.tsx | 26 +++++++++++++++++--------- src/page/Home/index.tsx | 14 +++++++++----- src/page/Login/index.tsx | 26 +++++++++++++++++--------- 4 files changed, 46 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 32ce17f..f6f60e2 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,9 @@ "preview": "vite preview", "start": "electron-forge start", "package": "electron-forge package", - "make": "vite build --mode development & electron-forge make", - "make:test": "vite build --mode test & electron-forge make", - "make:prod": "vite build --mode production & electron-forge make" + "make": "vite build --mode development & electron-forge make --platform=win32 --arch=ia32 ", + "make:test": "vite build --mode test & electron-forge make --platform=win32 --arch=ia32 ", + "make:prod": "vite build --mode production & electron-forge make --platform=win32 --arch=ia32 " }, "agora_electron": { "platform": "win32", diff --git a/src/App.tsx b/src/App.tsx index 8ff7f24..1030b05 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -20,17 +20,25 @@ const App: React.FC = () => { const [spinning, setSpinning] = useState(false); useEffect(() => { if (storage.getItem('TOKEN')) { - window.electron.setMainWindowSize({ - width: 1200, - height: 800, - }) + try { + window.electron.setMainWindowSize({ + width: 1200, + height: 800, + }) + } catch { + + } navigate('/home') } else { - window.electron.setMainWindowSize({ - width: 752, - height: 520, - key: 'login' - }) + try { + window.electron.setMainWindowSize({ + width: 752, + height: 520, + key: 'login' + }) + } catch { + + } navigate('/login') } window.addEventListener('resize', handleResize); diff --git a/src/page/Home/index.tsx b/src/page/Home/index.tsx index 74a693b..a6076f8 100644 --- a/src/page/Home/index.tsx +++ b/src/page/Home/index.tsx @@ -123,11 +123,15 @@ const Home: React.FC = () => { title="提示" description="确认退出吗?" onConfirm={() => { - window.electron.setMainWindowSize({ - width: 752, - height: 520, - key: 'login' - }) + try { + window.electron.setMainWindowSize({ + width: 752, + height: 520, + key: 'login' + }) + } catch { + + } navigate('/login') }} onCancel={() => { diff --git a/src/page/Login/index.tsx b/src/page/Login/index.tsx index 96131b9..2e65331 100644 --- a/src/page/Login/index.tsx +++ b/src/page/Login/index.tsx @@ -31,11 +31,15 @@ const Login: React.FC = () => { }); useEffect(() => { - window.electron.setMainWindowSize({ - width: 752, - height: 520, - key: 'login' - }) + try { + window.electron.setMainWindowSize({ + width: 752, + height: 520, + key: 'login' + }) + } catch { + + } if (storage.getItem('login')) { const login = JSON.parse(storage.getItem('login') as string); const data = { @@ -114,10 +118,14 @@ const Login: React.FC = () => { optionsValue: operation.optionsValue, })) storage.setItem('user', JSON.stringify(res.data)) - window.electron.setMainWindowSize({ - width: 1200, - height: 800, - }) + try { + window.electron.setMainWindowSize({ + width: 1200, + height: 800, + }) + } catch { + + } navigate('/home') startSignalr() }