import styles from '@/page/Meeting/index.module.scss' import { useEffect, useState } from "react"; import Operation from '@/components/Operation'; import { Navigation, Pagination } from 'swiper/modules'; import { Swiper, SwiperSlide } from 'swiper/react'; import 'swiper/css'; import 'swiper/css/navigation'; import 'swiper/css/pagination'; import { Button, Input, Popover, Modal, Checkbox, message, Select, Slider, Table, Pagination as AntdPagination } from "antd"; import { DeleteOutlined, FolderOutlined, ProfileOutlined, ReloadOutlined, SearchOutlined, VerticalAlignBottomOutlined } from '@ant-design/icons'; import { useLocation, useNavigate } from 'react-router-dom'; import { thumbImageBufferToBase64 } from '@/utils/package/base64' import { storage } from '@/utils'; import { GetRoomFile, PostRoomFile, DeleteRoomFile, GetRoomUpFileurl, GetRoomFileDwUrl } from '@/api/Meeting'; import axios from 'axios'; const { Column } = Table const Meeting: React.FC = () => { const navigate = useNavigate(); const { state } = useLocation(); const [statusList, setStatusList] = useState({ userList: false, userChatList: false, }) const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [isSharedScreenModal, setIsSharedScreenModal] = useState(false); const [isInit, setIsInit] = useState(true); const [user, setUser] = useState({}); const [isStupWizard, setIsStupWizard] = useState(false); const [showRowSelection, setShowRowSelection] = useState(false); const [isSharedFilesModel, setIsSharedFilesModel] = useState(false); const [sharedScreenList, setSharedScreenList] = useState([]); const [sharedScreenItem, setSharedScreenItem] = useState(''); const [footerList, setFooterList] = useState([ [ { title: '关闭声音', icon: '/src/assets/icon22', active: false, }, { title: '关闭视频', icon: '/src/assets/icon23', active: false, }, ], [ { title: '共享屏幕', icon: '/src/assets/icon24', active: false, }, { title: '共享文件', icon: '/src/assets/icon25', active: false, }, { title: '邀请人员', icon: '/src/assets/icon26', active: false, }, { title: '录制', icon: '/src/assets/icon27', active: false, }, { title: '设置向导', icon: '/src/assets/icon28', active: false, }, { title: '结束', icon: '/src/assets/icon29', active: false, }, ], [ { title: '成员列表', icon: '/src/assets/icon30', active: false, }, { title: '聊天', icon: '/src/assets/icon31', active: false, }, ], ]) const [footerListIndex, setFooterListIndex] = useState({ itemIndex: 0, rowIndex: 0, }); const [audioDeviceManager, setAudioDeviceManager] = useState({ currentDevices: [], currentDevice: {}, currentVolume: 0, }); const [fileList, setFileList] = useState({ data: [], keyword: '', total: 0, pageIndex: 1, pageSize: 10, }) const [stepsStatus, setStepsStatus] = useState(true); const [isVideoLoad, setIsVideoLoad] = useState(false); const [list] = useState([1, 2, 3, 4, 5, 6, 7]) const [open, setOpen] = useState(false) const [videoID, setVideoID] = useState('') useEffect(() => { if (isInit) { setUser(JSON.parse(storage.getItem('user') as string)) // window.electron.setJoinChannel({ // channelId: state.channelId, // userid: user.userName, // token: state.token, // }) setIsInit(false) } else { getRoomFile() } }, [fileList.pageIndex]); const changeStatusList = async (row: any, itemIndex: number, rowIndex: number): Promise => { const footerListTemplate = [...footerList] setFooterListIndex({ itemIndex, rowIndex, }) switch (row.title) { case '成员列表': setStatusList({ userList: true, userChatList: false, }) break; case '聊天': setStatusList({ userList: false, userChatList: true, }) break; case '共享屏幕': getDesktopCapturerVideo() setIsSharedScreenModal(true) break; case '停止共享': window.electron.stopScreenCapture() footerListTemplate[itemIndex][rowIndex].title = '共享屏幕' break; case '关闭声音': footerListTemplate[itemIndex][rowIndex].title = '开启声音' footerListTemplate[itemIndex][rowIndex].active = true setFooterList(footerListTemplate) window.electron.muteLocalAudioStream(true) break; case '开启声音': footerListTemplate[itemIndex][rowIndex].title = '关闭声音' footerListTemplate[itemIndex][rowIndex].active = false setFooterList(footerListTemplate) window.electron.muteLocalAudioStream(false) break; case '关闭视频': footerListTemplate[itemIndex][rowIndex].title = '开启视频' footerListTemplate[itemIndex][rowIndex].active = true setFooterList(footerListTemplate) window.electron.muteLocalVideoStream(true) break; case '开启视频': footerListTemplate[itemIndex][rowIndex].title = '关闭视频' footerListTemplate[itemIndex][rowIndex].active = false setFooterList(footerListTemplate) window.electron.muteLocalVideoStream(false) break; case '设置向导': getAudioMediaList() window.electron.startRecordingDeviceTest(200) setIsStupWizard(true) break; case '录制': footerListTemplate[itemIndex][rowIndex].title = '录制中' footerListTemplate[itemIndex][rowIndex].active = true setFooterList(footerListTemplate) window.electron.startRecording() break; case '录制中': footerListTemplate[itemIndex][rowIndex].title = '录制' footerListTemplate[itemIndex][rowIndex].active = false setFooterList(footerListTemplate) window.electron.stopRecording() break; case '共享文件': await getRoomFile() setIsSharedFilesModel(true) break; } } const changeVdeio = async (bool: boolean): Promise => { if (bool) { } else { let data = sharedScreenList.find((item: any) => item.sourceId === sharedScreenItem.sourceId) if (data) { const footerListTemplate = [...footerList] footerListTemplate[footerListIndex.itemIndex][footerListIndex.rowIndex].title = '停止共享' setIsSharedScreenModal(false) window.electron.setDesktopCapturerVideo(sharedScreenItem) setVideoID(window.electron.getVideoId()) } else { message.error('请选择应用!') } } } const getDesktopCapturerVideo = (): void => { window.electron.getDesktopCapturerVideo().then((res: any) => { if (sharedScreenList.length !== res.length) { res.forEach((item: any) => { if (item.thumbImage.buffer) { item.thumbnailUrl = thumbImageBufferToBase64(item.thumbImage) } if (item.iconImage.buffer) { item.iconDataUrl = thumbImageBufferToBase64(item.iconImage) } }) setSharedScreenList(res) } }) }; const getAudioMediaList = (): void => { const { currentDevices, currentDevice, currentVolume } = window.electron.getAudioMediaList(); setAudioDeviceManager({ currentDevices: currentDevices.map((row: any) => { return { value: row.deviceId, label: row.deviceName } }), currentDevice: currentDevice.deviceId, currentVolume, }) } const getRoomFile = async (): Promise => { await GetRoomFile({ pageIndex: fileList.pageIndex, pageSize: fileList.pageSize, keyword: fileList.keyword, roomId: state.channelId }).then(res => { if (res.code === 200) { setFileList({ ...fileList, data: res.data.items.map((item: any) => { return { ...item, key: item.id, } }), total: res.data.total }) } }) } return ( <>
00:13:45
会议号:2323235
演讲者模式
{ swiper.on('click', (e: any) => { swiper.slideTo(e.clickedIndex) }) }} onSlideChange={() => { }} > {list.map((item, index) =>
{meetingContentUser()}
)}
{meetingContentUser()}
{ (statusList.userList || statusList.userChatList) ? (
{statusList.userList ?
成员列表 { setStatusList({ userList: false, userChatList: false, }) }} />
} />
{list.map((item: number) =>
潇潇主持人
)}
邀请
全员静音
:
聊天 { setStatusList({ userList: false, userChatList: false, }) }} />
{list.map((item: number) =>
潇潇
哈哈哈哈
)}
}
) : null }
{footerList.map((item, itemIndex) => { return (
{item.map((row, rowIndex) => { return ( row.title === '结束' ?
{ window.electron.leaveChannel() window.electron.stopScreenCapture() navigate(-1) }}>全员结束会议
{ window.electron.leaveChannel() window.electron.stopScreenCapture() navigate(-1) }}>仅自己离开
{ setOpen(false) }}>取消
} title="" trigger="click" open={open} onOpenChange={() => setOpen(true)} >
{row.title}
:
changeStatusList(row, itemIndex, rowIndex)} key={rowIndex}> {row.title}
) })}
) })}
{sharedScreenList.map((item: any, index: number) => { return (
{ setSharedScreenItem(item) }}> {item.iconDataUrl ? : ''}
{item.sourceTitle}
) })}
{ }}>共享电脑音频
{stepsStatus ? '音频设置向导' : '视频测试'}
音频输出设备: } onChange={(e) => { setFileList({ ...fileList, keyword: e.target.value }) }} onBlur={() => { if (fileList.pageIndex === 1) { getRoomFile() } else { setFileList({ ...fileList, pageIndex: 1 }) } }} /> { if (fileList.pageIndex === 1) { getRoomFile() } else { setFileList({ ...fileList, pageIndex: 1 }) } }} /> { setShowRowSelection(!showRowSelection) }} style={{ color: showRowSelection ? '#5575F2' : 'white' }} /> {showRowSelection ? { if (selectedRowKeys.length) { DeleteRoomFile(selectedRowKeys).then(res => { if (res.code === 200) { message.success('删除成功!') getRoomFile() } }) } else { message.error('请选择文件!') } }} /> : null}
{ setSelectedRowKeys(newSelectedRowKeys); } } : undefined} dataSource={fileList.data} pagination={false} scroll={{ y: '40vh' }} style={{ width: '100%' }} > ( <> {item.size / 1024 > 1000 ? (item.size / (1024 * 1024)).toFixed(2) + 'MB' : (item.size / 1024).toFixed(2) + 'KB'} )} /> ( <> {item.downloadCount}次 )} /> ( <> { GetRoomFileDwUrl(item.fileUrl).then(res => { if (res.code === 200) { window.electron.dwFile(res.data) } }) }} /> {/* */} )} />
{ setFileList({ ...fileList, pageIndex: e }) }} pageSize={fileList.pageSize} current={fileList.pageIndex} hideOnSinglePage={true} />
) } const meetingContentUser = () => { return ( <>
张大龙
) } export default Meeting