This commit is contained in:
parent
e285e9f22c
commit
06b624e170
13
main.js
13
main.js
|
|
@ -9,7 +9,7 @@ const {
|
||||||
clipboard,
|
clipboard,
|
||||||
dialog,
|
dialog,
|
||||||
webFrame,
|
webFrame,
|
||||||
Notification
|
Notification,
|
||||||
} = require('electron');
|
} = require('electron');
|
||||||
const path = require('node:path')
|
const path = require('node:path')
|
||||||
const { autoUpdater, CancellationToken } = require('electron-updater');
|
const { autoUpdater, CancellationToken } = require('electron-updater');
|
||||||
|
|
@ -192,6 +192,17 @@ app.on('ready', () => {
|
||||||
quitAndInstall()
|
quitAndInstall()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// 选择文件夹
|
||||||
|
ipcMain.handle('selectFilePath', async (event) => {
|
||||||
|
const result = await dialog.showOpenDialog({
|
||||||
|
properties: ['openDirectory']
|
||||||
|
});
|
||||||
|
if (result.canceled) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mainWindow.webContents.send('onFilePath', result.filePaths[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
// 设置桌面应用基础属性
|
// 设置桌面应用基础属性
|
||||||
ipcMain.handle('setMainWindowSize', (event, config) => {
|
ipcMain.handle('setMainWindowSize', (event, config) => {
|
||||||
// 设置最小窗口尺寸
|
// 设置最小窗口尺寸
|
||||||
|
|
|
||||||
17
preload.js
17
preload.js
|
|
@ -1,14 +1,9 @@
|
||||||
// // 在 preload 脚本中。
|
// // 在 preload 脚本中。
|
||||||
const {ipcRenderer, contextBridge} = require('electron')
|
const { ipcRenderer } = require('electron')
|
||||||
|
|
||||||
// contextBridge.exposeInMainWorld("elecAPI", {
|
|
||||||
// onUpdate: (callback) => ipcRenderer.on("update", callback),
|
|
||||||
// checkForUpdate: () => ipcRenderer.send("checkForUpdate"),
|
|
||||||
// });
|
|
||||||
window.electron = {
|
window.electron = {
|
||||||
// 设置窗口大小
|
// 设置窗口大小
|
||||||
setMainWindowSize: (config) => {
|
setMainWindowSize: (config) => {
|
||||||
ipcRenderer.invoke('setMainWindowSize', {...config})
|
ipcRenderer.invoke('setMainWindowSize', { ...config })
|
||||||
},
|
},
|
||||||
// 设置窗口状态
|
// 设置窗口状态
|
||||||
setViewStatus: (status) => {
|
setViewStatus: (status) => {
|
||||||
|
|
@ -38,4 +33,12 @@ window.electron = {
|
||||||
onDownload: (type) => {
|
onDownload: (type) => {
|
||||||
ipcRenderer.invoke('updateDownload', type)
|
ipcRenderer.invoke('updateDownload', type)
|
||||||
},
|
},
|
||||||
|
// 选择文件夹
|
||||||
|
selectFilePath: () => {
|
||||||
|
ipcRenderer.invoke('selectFilePath')
|
||||||
|
},
|
||||||
|
// 发送文件夹路径
|
||||||
|
onFilePath: (callback) => {
|
||||||
|
ipcRenderer.on('onFilePath', callback)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
import styles from '@/components/StupWizard/index.module.scss'
|
import styles from '@/components/StupWizard/index.module.scss'
|
||||||
import ImageUrl from '@/utils/package/ImageUrl';
|
import ImageUrl from '@/utils/package/ImageUrl';
|
||||||
import { Button, Checkbox, Empty, Input, Modal, Select, Slider } from 'antd';
|
import { Button, Checkbox, Empty, Input, Modal, Select, Slider, message } from 'antd';
|
||||||
import { useState, useImperativeHandle, forwardRef, useEffect } from "react";
|
import { useState, useImperativeHandle, forwardRef, useEffect } from "react";
|
||||||
import agora from '@/utils/package/agora'
|
import agora from '@/utils/package/agora'
|
||||||
import { CloseOutlined, LoadingOutlined } from '@ant-design/icons';
|
import { CloseOutlined, LoadingOutlined } from '@ant-design/icons';
|
||||||
import { storage } from '@/utils';
|
import { storage } from '@/utils';
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
const fs = require('fs').promises;
|
||||||
|
const { exec } = require('child_process');
|
||||||
let userInfo = JSON.parse(storage.getItem('user') as string)
|
let userInfo = JSON.parse(storage.getItem('user') as string)
|
||||||
const StupWizard = forwardRef((props: any, ref: any) => {
|
const StupWizard = forwardRef((props: any, ref: any) => {
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
|
|
@ -383,6 +385,12 @@ const RecordingComponents = () => {
|
||||||
} else {
|
} else {
|
||||||
setFilePath(setting.recordingFilesPath);
|
setFilePath(setting.recordingFilesPath);
|
||||||
}
|
}
|
||||||
|
window.electron.onFilePath(async (_e: any, filePath: string) => {
|
||||||
|
setFilePath(filePath)
|
||||||
|
const setting = await JSON.parse(storage.getItem('setting') as string)
|
||||||
|
setting.recordingFilesPath = filePath
|
||||||
|
storage.setItem('setting', JSON.stringify(setting))
|
||||||
|
})
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -403,7 +411,25 @@ const RecordingComponents = () => {
|
||||||
setFilePath(e.target.value)
|
setFilePath(e.target.value)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button type="primary" onClick={() => { }} style={{ backgroundColor: '#31353A' }}>打开</Button>
|
<Button type="primary" onClick={() => {
|
||||||
|
window.electron.selectFilePath()
|
||||||
|
}} style={{ backgroundColor: '#31353A', marginRight: '10px' }}>选择保存目录</Button>
|
||||||
|
<Button type="primary" onClick={async () => {
|
||||||
|
try {
|
||||||
|
await fs.access(filePath, fs.constants.F_OK);
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
exec(`explorer "${filePath}"`);
|
||||||
|
} else if (process.platform === 'darwin') {
|
||||||
|
exec(`open "${filePath}"`);
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error.code === 'ENOENT') {
|
||||||
|
message.error('文件夹不存在!')
|
||||||
|
} else {
|
||||||
|
message.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}} style={{ backgroundColor: '#31353A' }}>打开</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -423,6 +449,12 @@ const FileComponents = () => {
|
||||||
setFilePath(setting.shareFilesPath);
|
setFilePath(setting.shareFilesPath);
|
||||||
}
|
}
|
||||||
setIsShareSavePath(setting.isShareSavePath)
|
setIsShareSavePath(setting.isShareSavePath)
|
||||||
|
window.electron.onFilePath(async (_e: any, filePath: string) => {
|
||||||
|
setFilePath(filePath)
|
||||||
|
const setting = await JSON.parse(storage.getItem('setting') as string)
|
||||||
|
setting.shareFilesPath = filePath
|
||||||
|
storage.setItem('setting', JSON.stringify(setting))
|
||||||
|
})
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -443,7 +475,25 @@ const FileComponents = () => {
|
||||||
setFilePath(e.target.value)
|
setFilePath(e.target.value)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button type="primary" onClick={() => { }} style={{ backgroundColor: '#31353A' }}>选择保存目录</Button>
|
<Button type="primary" onClick={() => {
|
||||||
|
window.electron.selectFilePath()
|
||||||
|
}} style={{ backgroundColor: '#31353A', marginRight: '10px' }}>选择保存目录</Button>
|
||||||
|
<Button type="primary" onClick={async () => {
|
||||||
|
try {
|
||||||
|
await fs.access(filePath, fs.constants.F_OK);
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
exec(`explorer "${filePath}"`);
|
||||||
|
} else if (process.platform === 'darwin') {
|
||||||
|
exec(`open "${filePath}"`);
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error.code === 'ENOENT') {
|
||||||
|
message.error('文件夹不存在!')
|
||||||
|
} else {
|
||||||
|
message.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}} style={{ backgroundColor: '#31353A' }}>打开</Button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Checkbox onChange={async (e) => {
|
<Checkbox onChange={async (e) => {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import { VideoSourceType } from 'agora-electron-sdk';
|
||||||
import { GetUserList } from '@/api/Home/User';
|
import { GetUserList } from '@/api/Home/User';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
import SharedFilesModel from '@/components/SharedFilesModel';
|
import SharedFilesModel from '@/components/SharedFilesModel';
|
||||||
|
const fs = require('fs').promises;
|
||||||
dayjs.extend(durationPlugin);
|
dayjs.extend(durationPlugin);
|
||||||
const Meeting: React.FC = () => {
|
const Meeting: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
@ -333,13 +334,24 @@ const Meeting: React.FC = () => {
|
||||||
invitingPersonnelRef.current.changeInvitingPersonnelModal()
|
invitingPersonnelRef.current.changeInvitingPersonnelModal()
|
||||||
break;
|
break;
|
||||||
case '录制':
|
case '录制':
|
||||||
|
const setting = await JSON.parse(storage.getItem('setting') as string)
|
||||||
if (currentVideoId === user.account) {
|
if (currentVideoId === user.account) {
|
||||||
message.error('请勿自己录制自己!')
|
message.error('请勿自己录制自己!')
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
|
await fs.access(setting.recordingFilesPath, fs.constants.F_OK)
|
||||||
footerListTemplate[itemIndex][rowIndex].title = '录制中'
|
footerListTemplate[itemIndex][rowIndex].title = '录制中'
|
||||||
footerListTemplate[itemIndex][rowIndex].active = true
|
footerListTemplate[itemIndex][rowIndex].active = true
|
||||||
setFooterList(footerListTemplate)
|
setFooterList(footerListTemplate)
|
||||||
agora.startRecording(Number(currentVideoId))
|
agora.startRecording(Number(currentVideoId))
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error.code === 'ENOENT') {
|
||||||
|
message.error('文件夹不存在!')
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
message.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '录制中':
|
case '录制中':
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ export interface IElectronAPI {
|
||||||
onUpdate: (callBack: Function) => void;
|
onUpdate: (callBack: Function) => void;
|
||||||
joinNotification: (data: { name: string, body: string }) => void;
|
joinNotification: (data: { name: string, body: string }) => void;
|
||||||
onDownload: (data: string) => void
|
onDownload: (data: string) => void
|
||||||
|
selectFilePath: () => void
|
||||||
|
onFilePath: (callBack: Function) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ const agora = {
|
||||||
rtcEngine.initialize({
|
rtcEngine.initialize({
|
||||||
appId: option.appId,
|
appId: option.appId,
|
||||||
});
|
});
|
||||||
// console.log(rtcEngine.getAudioDeviceManager().enumeratePlaybackDevices());
|
|
||||||
},
|
},
|
||||||
// 事件回调
|
// 事件回调
|
||||||
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication }: any) => {
|
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication }: any) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue