yangjie #22

Merged
yangqiang merged 99 commits from yangjie into master 2024-10-22 16:11:46 +08:00
6 changed files with 66 additions and 12 deletions
Showing only changes of commit c76808939a - Show all commits

15
main.js
View File

@ -92,7 +92,15 @@ function createTray() {
}, },
{ {
label: '退出', click: async () => { label: '退出', click: async () => {
const url = mainWindow.webContents.getURL();
const hash = new URL(url).hash;
if (hash.indexOf('/meeting') === -1) {
quit() quit()
} else {
await mainWindow.webContents.send('quitAndInstall');
mainWindow.show()
mainWindow.focus()
}
}, },
// icon: iconPath, // icon: iconPath,
}, },
@ -205,9 +213,12 @@ app.on('ready', () => {
clipboard.writeText(text) clipboard.writeText(text)
}); });
// 退出 // 退出
ipcMain.handle('quit', async (event) => { ipcMain.handle('quit', async (event, bool) => {
await mainWindow.webContents.send('quitAndInstall'); if (bool) {
quit() quit()
} else {
await mainWindow.webContents.send('quitAndInstall');
}
}); });
// 加入房间通知 // 加入房间通知
ipcMain.handle('joinNotification', (event, user) => { ipcMain.handle('joinNotification', (event, user) => {

View File

@ -38,8 +38,8 @@ window.electron = {
ipcRenderer.on('onQuit', callback) ipcRenderer.on('onQuit', callback)
}, },
// 退出房间 // 退出房间
quit: () => { quit: (bool) => {
return ipcRenderer.invoke('quit') return ipcRenderer.invoke('quit', bool)
}, },
// 监听更新 // 监听更新
onUpdate: (callback) => { onUpdate: (callback) => {

View File

@ -103,7 +103,7 @@ const App: React.FC = () => {
storage.setItem('setting', JSON.stringify(setting)) storage.setItem('setting', JSON.stringify(setting))
}) })
window.electron.quitAndInstall(async (_e: any) => { window.electron.quitAndInstall(async (_e: any) => {
leaveChannel() storage.setItem('quitMeeting', true)
}) })
}, []) }, [])
useEffect(() => { useEffect(() => {
@ -138,14 +138,14 @@ const App: React.FC = () => {
setIsState(false) setIsState(false)
window.electron.onQuit(async () => { window.electron.onQuit(async () => {
if (location.hash.indexOf('/login') === 1) { if (location.hash.indexOf('/login') === 1) {
window.electron.quit() window.electron.quit(location.hash.indexOf('/meeting') === -1)
} else { } else {
if (storage.getItem('isTips') === 'true') { if (storage.getItem('isTips') === 'true') {
const setting = JSON.parse(storage.getItem('setting') as string) const setting = JSON.parse(storage.getItem('setting') as string)
if (setting.closeSetting === 'hide') { if (setting.closeSetting === 'hide') {
window.electron.setViewStatus(setting.closeSetting) window.electron.setViewStatus(setting.closeSetting)
} else { } else {
window.electron.quit() window.electron.quit(location.hash.indexOf('/meeting') === -1)
} }
} else { } else {
quitTipsRef.current.changeModal() quitTipsRef.current.changeModal()

View File

@ -52,7 +52,7 @@ const QuitTips = forwardRef((props: any, ref: any) => {
<Button type="primary" className='m-ant-btn' onClick={() => { <Button type="primary" className='m-ant-btn' onClick={() => {
setIsCloseModal(false) setIsCloseModal(false)
if (optionsValue === 'quit') { if (optionsValue === 'quit') {
window.electron.quit() window.electron.quit(location.hash.indexOf('/meeting') === -1)
} else { } else {
window.electron.setViewStatus(optionsValue) window.electron.setViewStatus(optionsValue)
} }

View File

@ -42,6 +42,7 @@ const Meeting: React.FC = () => {
userVideo: false, userVideo: false,
}) })
const [isSharedScreenModal, setIsSharedScreenModal] = useState(false); const [isSharedScreenModal, setIsSharedScreenModal] = useState(false);
const [quitMeetingModal, setQuitMeetingModal] = useState(false);
const [user, setUser] = useState<any>({}); const [user, setUser] = useState<any>({});
const [sharedScreenList, setSharedScreenList] = useState<any>([]); const [sharedScreenList, setSharedScreenList] = useState<any>([]);
const [sharedScreenItem, setSharedScreenItem] = useState<any>(''); const [sharedScreenItem, setSharedScreenItem] = useState<any>('');
@ -152,7 +153,7 @@ const Meeting: React.FC = () => {
text: '网络质量极好。' text: '网络质量极好。'
}) })
const [networkOther, setNetworkOther] = useState<RtcStats>({}) const [networkOther, setNetworkOther] = useState<RtcStats>({})
const [isComputerAudio, setIsComputerAudio] = useState(true) const [isComputerAudio, setIsComputerAudio] = useState(false)
const [_isScreenCapture, setIsScreenCapture] = useState(false) const [_isScreenCapture, setIsScreenCapture] = useState(false)
const [isFluencyPriority, setIsFluencyPriority] = useState(false) const [isFluencyPriority, setIsFluencyPriority] = useState(false)
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
@ -1634,6 +1635,11 @@ const Meeting: React.FC = () => {
case 'meetingMode': case 'meetingMode':
setMeetingMode(e.value) setMeetingMode(e.value)
break; break;
case 'quitMeeting':
if (e.value) {
setQuitMeetingModal(true)
}
break;
case 'reconnect': case 'reconnect':
if (e.value == true) { if (e.value == true) {
await onInvoke('joinChannel', { await onInvoke('joinChannel', {
@ -2724,6 +2730,43 @@ const Meeting: React.FC = () => {
</div> </div>
</div> </div>
</Modal> </Modal>
<Modal
title=""
open={quitMeetingModal}
footer={null}
closable={false}
centered
width={'190px'}
>
<div>
<div className='meetingContentFooterPopover'>
{role.ID.includes(user.roleId) ?
<Popconfirm
title="提示"
description={`结束会议后,所有人将退出,是否结束?`}
onConfirm={async () => {
await GetLeaveAll({
roomNum: state.channelId,
})
window.electron.quit(true)
}}
onCancel={() => {
}}
okText="结束"
cancelText="取消"
>
<div className='meetingContentFooterPopoverDel'></div>
</Popconfirm>
: null}
<div className='meetingContentFooterPopoverDefault' onClick={async () => {
await leaveChannel()
window.electron.quit(true)
}}></div>
<div className='meetingContentFooterPopoverCancel' onClick={() => { setQuitMeetingModal(false) }}></div>
</div>
</div>
</Modal>
<SharedFilesModel ref={sharedFilesModelRef} /> <SharedFilesModel ref={sharedFilesModelRef} />
<SpeakerModeModal ref={speakerModeModalRef} /> <SpeakerModeModal ref={speakerModeModalRef} />
<InvitingPersonnelModal ref={invitingPersonnelRef} /> <InvitingPersonnelModal ref={invitingPersonnelRef} />

2
src/render.d.ts vendored
View File

@ -12,7 +12,7 @@ export interface IElectronAPI {
selectFilePath: (data?: any) => void selectFilePath: (data?: any) => void
onFilePath: (callBack: Function) => void; onFilePath: (callBack: Function) => void;
getSources: () => any; getSources: () => any;
quit: () => any; quit: (bool) => any;
downFile: (callBack: Function) => void; downFile: (callBack: Function) => void;
quitAndInstall: (callBack: Function) => void; quitAndInstall: (callBack: Function) => void;
getVersion: () => Promise<string>; getVersion: () => Promise<string>;