重新打开应用是否自动登录判断优化 #18

Merged
yangqiang merged 14 commits from yangjie into master 2024-10-11 14:15:18 +08:00
4 changed files with 131 additions and 121 deletions
Showing only changes of commit 4026b79deb - Show all commits

15
main.js
View File

@ -17,7 +17,7 @@ const { autoUpdater, CancellationToken } = require('electron-updater');
const cancellationToken = new CancellationToken() const cancellationToken = new CancellationToken()
app.allowRendererProcessReuse = false; app.allowRendererProcessReuse = false;
let mainWindow = null; let mainWindow = null;
let childWindow = [] let childWindow = {}
let isMaximized = false; let isMaximized = false;
let env; let env;
let regKey; let regKey;
@ -310,18 +310,17 @@ app.on('ready', () => {
enableRemoteModule: true, enableRemoteModule: true,
nodeIntegrationInWorker: true, nodeIntegrationInWorker: true,
allowMediaDevices: true, allowMediaDevices: true,
// preload: path.join(__dirname, 'preload.js') preload: path.join(__dirname, 'preload.js')
}, },
// show: false, show: false,
// frame: false, frame: false,
// backgroundColor: '#00000000', backgroundColor: '#00000000',
// transparent: true, transparent: true,
}) })
child.loadURL(config.url) child.loadURL(config.url)
childWindow.push(child) childWindow[key] = child
child.once('ready-to-show', () => { child.once('ready-to-show', () => {
child.show() child.show()
console.log(config);
child.setSize(config.width, config.height) child.setSize(config.width, config.height)
}) })
}); });

View File

@ -18,6 +18,7 @@ import { agora } from "@/utils/package/agora";
import QuitTips from "@/components/QuitTips"; import QuitTips from "@/components/QuitTips";
import { GetLeave } from "@/api/Meeting"; import { GetLeave } from "@/api/Meeting";
import path from "path"; import path from "path";
import ShareScreenWindow from "./page/ShareScreenWindow";
const fs = require('fs').promises; const fs = require('fs').promises;
const { exec } = require('child_process'); const { exec } = require('child_process');
const App: React.FC = () => { const App: React.FC = () => {
@ -32,6 +33,7 @@ const App: React.FC = () => {
}); });
const [spinning, setSpinning] = useState(false); const [spinning, setSpinning] = useState(false);
const [isState, setIsState] = useState(true); const [isState, setIsState] = useState(true);
if (location.hash.indexOf('shareScreenWindow') == -1) {
useEffect(() => { useEffect(() => {
let userInfo = JSON.parse(storage.getItem('user') as string) let userInfo = JSON.parse(storage.getItem('user') as string)
let loginInfo = JSON.parse(storage.getItem('login') as string) let loginInfo = JSON.parse(storage.getItem('login') as string)
@ -148,6 +150,7 @@ const App: React.FC = () => {
onStop() onStop()
} }
}, [navigate]) }, [navigate])
}
useEffect(() => { useEffect(() => {
document.addEventListener('keydown', (event) => { document.addEventListener('keydown', (event) => {
if (event.key === 'F11') { if (event.key === 'F11') {
@ -239,6 +242,7 @@ const App: React.FC = () => {
</Route> </Route>
<Route path='/login' element={<Login />} /> <Route path='/login' element={<Login />} />
<Route path='/meeting' element={<Meeting />} /> <Route path='/meeting' element={<Meeting />} />
<Route path='/shareScreenWindow' element={<ShareScreenWindow />} />
<Route path='*' element={<NotFound />} /> <Route path='*' element={<NotFound />} />
</Routes> </Routes>
<Spin spinning={spinning} fullscreen /> <Spin spinning={spinning} fullscreen />

View File

@ -1,5 +1,7 @@
.shareScreenWindow { .shareScreenWindow {
background-color: red; background-color: red;
color: red; color: black;
height: 100%;
width: 100%;
font-size: 30px; font-size: 30px;
} }

View File

@ -6,7 +6,12 @@ const ShareScreenWindow: React.FC = () => {
}, []); }, []);
// window.electron.createChildWindow({
// url: location.origin + `/#/shareScreenWindow`,
// width: 600,
// height: 40,
// key: 'shareScreenWindow',
// })
return ( return (
<> <>
<div className={styles.shareScreenWindow}> <div className={styles.shareScreenWindow}>