代码格式化

This commit is contained in:
yj 2024-09-24 09:22:07 +08:00
parent 2777fad3ee
commit d0c41df970
4 changed files with 97 additions and 118 deletions

View File

@ -153,7 +153,7 @@ const Index: React.FC = () => {
<Operation></Operation> <Operation></Operation>
</div> </div>
<div className={styles.indexBtns}> <div className={styles.indexBtns}>
{user.roleId === '1' ? <Button type="primary" {user?.roleId === '1' ? <Button type="primary"
icon={<img src={ImageUrl.icon8} alt="" />} icon={<img src={ImageUrl.icon8} alt="" />}
className='m-ant-btn drag' className='m-ant-btn drag'
onClick={() => { onClick={() => {

View File

@ -91,9 +91,9 @@ const Home: React.FC = () => {
<div className={styles.homeLeft}> <div className={styles.homeLeft}>
<div className='drag'> <div className='drag'>
<div> <div>
<Avatar name={userInfo.userName} /> <Avatar name={userInfo?.userName} />
</div> </div>
<span>{userInfo.userName}</span> <span>{userInfo?.userName}</span>
</div> </div>
<div> <div>
<img src={ImageUrl.icon14} alt="" /> <img src={ImageUrl.icon14} alt="" />

View File

@ -550,7 +550,6 @@ const Meeting: React.FC = () => {
reader.onload = async () => { reader.onload = async () => {
try { try {
const userDataPath = await ipcRenderer.invoke('get-user-data-path'); const userDataPath = await ipcRenderer.invoke('get-user-data-path');
// 获取当前日期并格式化 // 获取当前日期并格式化
const date = new Date(); const date = new Date();
const year = date.getFullYear(); const year = date.getFullYear();
@ -559,36 +558,21 @@ const Meeting: React.FC = () => {
const hours = date.getHours(); const hours = date.getHours();
const minutes = date.getMinutes(); const minutes = date.getMinutes();
const formattedDate = `${year}${month}${day}${hours}${minutes}`; const formattedDate = `${year}${month}${day}${hours}${minutes}`;
const setting = await JSON.parse(storage.getItem('setting') as string) const setting = await JSON.parse(storage.getItem('setting') as string)
const buffer = Buffer.from(reader.result); const buffer = Buffer.from(reader.result);
const mp4Path = `${setting.recordingFilesPath}会议录制_${state.roomName}_${state.channelId}_${formattedDate}_beforehanlder.mp4`; const mp4Path = `${setting.recordingFilesPath}会议录制_${state.roomName}_${state.channelId}_${formattedDate}_beforehanlder.mp4`;
await fs.writeFile(mp4Path, buffer); await fs.writeFile(mp4Path, buffer);
// 获取应用程序安装路径 // 获取应用程序安装路径
const ffmpegPath = path.join(userDataPath, "ffmpeg.exe"); const ffmpegPath = path.join(userDataPath, "ffmpeg.exe");
const inputFilePath = mp4Path; // 输入文件路径 const inputFilePath = mp4Path; // 输入文件路径
const outputFilePath = mp4Path.replace('_beforehanlder', ''); // 输出文件路径 const outputFilePath = mp4Path.replace('_beforehanlder', ''); // 输出文件路径
const command = `${ffmpegPath} -i "${inputFilePath}" -vcodec copy -acodec copy "${outputFilePath}"`; const command = `${ffmpegPath} -i "${inputFilePath}" -vcodec copy -acodec copy "${outputFilePath}"`;
exec(command, (error: any, _stdout: any, _stderr: any) => {
exec(command, (error:any, stdout:any, stderr:any) => {
if (error) { if (error) {
console.error('Error executing ffmpeg command:', error);
return; return;
} }
// 删除输入文件 // 删除输入文件
fs.unlink(inputFilePath, (err:any) => { fs.unlink(inputFilePath);
if (err) {
console.error('Error deleting input file:', err);
} else {
console.log('Input file deleted successfully.');
}
});
confirm({ confirm({
title: '提示', title: '提示',
icon: <ExclamationCircleFilled />, icon: <ExclamationCircleFilled />,
@ -607,14 +591,11 @@ const Meeting: React.FC = () => {
onCancel() { onCancel() {
} }
}) })
}); });
} catch (err) { } catch (err) {
console.error('处理录制时出错:', err);
}
} }
}
reader.readAsArrayBuffer(blob); reader.readAsArrayBuffer(blob);
} }
}; };
@ -640,8 +621,6 @@ const Meeting: React.FC = () => {
}); });
const observerObject = new IntersectionObserver(async (entries: IntersectionObserverEntry[], _observer: IntersectionObserver) => { const observerObject = new IntersectionObserver(async (entries: IntersectionObserverEntry[], _observer: IntersectionObserver) => {
entries.forEach(async (entry) => { entries.forEach(async (entry) => {
console.log(entry.isIntersecting,entry.target.id);
if (entry.target.id !== user.uid) { if (entry.target.id !== user.uid) {
await agora.muteRemoteVideoStreamEx(Number(entry.target.id), !entry.isIntersecting) await agora.muteRemoteVideoStreamEx(Number(entry.target.id), !entry.isIntersecting)
} }