新窗口
This commit is contained in:
parent
d25a6f7d88
commit
05330d2af3
26
main.js
26
main.js
|
|
@ -261,6 +261,32 @@ app.on('ready', () => {
|
||||||
const y = Math.round((display.workArea.height - mainWindow.getSize()[1]) / 2);
|
const y = Math.round((display.workArea.height - mainWindow.getSize()[1]) / 2);
|
||||||
mainWindow.setPosition(x, y);
|
mainWindow.setPosition(x, y);
|
||||||
});
|
});
|
||||||
|
// 打开新窗口
|
||||||
|
ipcMain.handle('oepnWindow', (event, data) => {
|
||||||
|
const newWindow = new BrowserWindow({
|
||||||
|
width: 1200,
|
||||||
|
height: 800,
|
||||||
|
maxWidth: 1200,
|
||||||
|
minHeight: 800,
|
||||||
|
webPreferences: {
|
||||||
|
contextIsolation: false,
|
||||||
|
nodeIntegration: true,
|
||||||
|
enableRemoteModule: true,
|
||||||
|
nodeIntegrationInWorker: true,
|
||||||
|
allowMediaDevices: true,
|
||||||
|
preload: path.join(__dirname, 'preload.js')
|
||||||
|
},
|
||||||
|
frame: false,
|
||||||
|
backgroundColor: '#00000000',
|
||||||
|
transparent: true,
|
||||||
|
});
|
||||||
|
newWindow.loadURL(data.url);
|
||||||
|
newWindow.webContents.on('before-input-event', (event, input) => {
|
||||||
|
if (input.key === 'F12') {
|
||||||
|
newWindow.webContents.openDevTools()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检测更新,在你想要检查更新的时候执行,renderer事件触发后的操作自行编写
|
// 检测更新,在你想要检查更新的时候执行,renderer事件触发后的操作自行编写
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,8 @@ window.electron = {
|
||||||
downFile: (callback) => {
|
downFile: (callback) => {
|
||||||
ipcRenderer.on('downFile', callback)
|
ipcRenderer.on('downFile', callback)
|
||||||
},
|
},
|
||||||
|
// 打开新窗口
|
||||||
|
oepnWindow: (data) => {
|
||||||
|
ipcRenderer.invoke('oepnWindow', data)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
27
src/App.tsx
27
src/App.tsx
|
|
@ -17,6 +17,7 @@ import { PostLogin } from "@/api/Login";
|
||||||
import agora from "@/utils/package/agora";
|
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 UserVideo from "./page/UserVideo";
|
||||||
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 = () => {
|
||||||
|
|
@ -31,6 +32,8 @@ const App: React.FC = () => {
|
||||||
});
|
});
|
||||||
const [spinning, setSpinning] = useState(false);
|
const [spinning, setSpinning] = useState(false);
|
||||||
const [isState, setIsState] = useState(true);
|
const [isState, setIsState] = useState(true);
|
||||||
|
const urlWindow = ['#/userVideo']
|
||||||
|
if (urlWindow.indexOf(location.hash) === -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)
|
||||||
|
|
@ -54,16 +57,6 @@ const App: React.FC = () => {
|
||||||
} else {
|
} else {
|
||||||
toSrc('/login')
|
toSrc('/login')
|
||||||
}
|
}
|
||||||
if (import.meta.env.VITE_ENV !== 'development') {
|
|
||||||
document.addEventListener('keydown', (event) => {
|
|
||||||
if ((event.ctrlKey || event.metaKey) && event.key === 'r') {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
if (event.key === 'F11') {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
window.addEventListener('resize', handleResize);
|
window.addEventListener('resize', handleResize);
|
||||||
window.addEventListener('online', handleNetworkChange);
|
window.addEventListener('online', handleNetworkChange);
|
||||||
window.addEventListener('offline', handleNetworkChange);
|
window.addEventListener('offline', handleNetworkChange);
|
||||||
|
|
@ -158,6 +151,19 @@ const App: React.FC = () => {
|
||||||
onStop()
|
onStop()
|
||||||
}
|
}
|
||||||
}, [navigate])
|
}, [navigate])
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (import.meta.env.VITE_ENV !== 'development') {
|
||||||
|
document.addEventListener('keydown', (event) => {
|
||||||
|
if ((event.ctrlKey || event.metaKey) && event.key === 'r') {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
if (event.key === 'F11') {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
const handleResize = (): void => {
|
const handleResize = (): void => {
|
||||||
setWindowSize({
|
setWindowSize({
|
||||||
width: window.innerWidth,
|
width: window.innerWidth,
|
||||||
|
|
@ -260,6 +266,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='/userVideo' element={<UserVideo />} />
|
||||||
<Route path='*' element={<NotFound />} />
|
<Route path='*' element={<NotFound />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
<Spin spinning={spinning} fullscreen />
|
<Spin spinning={spinning} fullscreen />
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,9 @@ const Index: React.FC = () => {
|
||||||
<Button type="primary"
|
<Button type="primary"
|
||||||
iconPosition={'end'}
|
iconPosition={'end'}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
// window.electron.oepnWindow({
|
||||||
|
// url: location.origin + '/#/userVideo'
|
||||||
|
// })
|
||||||
joinSettingRef.current.changeModal(item.roomNum)
|
joinSettingRef.current.changeModal(item.roomNum)
|
||||||
}}
|
}}
|
||||||
icon={<img src={ImageUrl.icon9} alt="" />}
|
icon={<img src={ImageUrl.icon9} alt="" />}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { useEffect } from "react";
|
||||||
const NotFound: React.FC = () => {
|
const NotFound: React.FC = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
});
|
}, []);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="notfound"></div>
|
<div className="notfound"></div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
.userVideo {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #1F2022;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
import styles from '@/page/UserVideo/index.module.scss'
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
const UserVideo: React.FC = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className={styles.userVideo}>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UserVideo
|
||||||
|
|
@ -14,6 +14,7 @@ export interface IElectronAPI {
|
||||||
quit: () => any;
|
quit: () => any;
|
||||||
downFile: (callBack: Function) => void;
|
downFile: (callBack: Function) => void;
|
||||||
quitAndInstall: (callBack: Function) => void;
|
quitAndInstall: (callBack: Function) => void;
|
||||||
|
oepnWindow: (data: any) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue