设备管理
This commit is contained in:
parent
50e15e43bf
commit
6fb7020836
|
|
@ -3,14 +3,21 @@ import { getKeyOpenChildWindow } from '@/utils/package/public';
|
|||
import { onInvoke } from '@/utils/package/signalr';
|
||||
import { Button, Modal, Select, Slider, message } from 'antd';
|
||||
import { useState, useImperativeHandle, forwardRef } from "react";
|
||||
const EquipmentManagement = forwardRef((_props: any, ref: any) => {
|
||||
const EquipmentManagement = forwardRef((props: any, ref: any) => {
|
||||
useImperativeHandle(ref, () => ({
|
||||
changeModal: async (uid: string, userName: string) => {
|
||||
setCallerUid(uid)
|
||||
setDeviceInfo({})
|
||||
let isOpen = await getKeyOpenChildWindow('shareScreenWindow')
|
||||
if (isOpen) {
|
||||
if (props.getDriver) {
|
||||
props.getDriver(uid)
|
||||
}
|
||||
} else {
|
||||
await onInvoke('getDrivers', {
|
||||
uid
|
||||
})
|
||||
}
|
||||
setUserName(userName)
|
||||
setEquipmentManagementModal(true)
|
||||
},
|
||||
|
|
@ -23,11 +30,6 @@ const EquipmentManagement = forwardRef((_props: any, ref: any) => {
|
|||
const [deviceInfo, setDeviceInfo] = useState<any>({})
|
||||
const [userName, setUserName] = useState<any>({})
|
||||
const handleWindowsChange = async (): Promise<void> => {
|
||||
const isOpen = await getKeyOpenChildWindow('shareScreenWindow')
|
||||
if (isOpen) {
|
||||
window.electron.mainWindowHide()
|
||||
window.electron.setViewStatus('hide')
|
||||
}
|
||||
setEquipmentManagementModal(false)
|
||||
}
|
||||
return (
|
||||
|
|
@ -92,10 +94,20 @@ const EquipmentManagement = forwardRef((_props: any, ref: any) => {
|
|||
</div>
|
||||
<div>
|
||||
<Button type="primary" className='m-ant-btn' onClick={async () => {
|
||||
let isOpen = await getKeyOpenChildWindow('shareScreenWindow')
|
||||
if (isOpen) {
|
||||
if (props.setDriver) {
|
||||
props.setDriver({
|
||||
uid: callerUid,
|
||||
driversJsonString: JSON.stringify(deviceInfo)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
await onInvoke('setDrivers', {
|
||||
uid: callerUid,
|
||||
driversJsonString: JSON.stringify(deviceInfo)
|
||||
})
|
||||
}
|
||||
handleWindowsChange()
|
||||
message.success('设置成功')
|
||||
}}>确定</Button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import styles from '@/page/Meeting/ChatBigWindow/index.module.scss'
|
||||
import ImageUrl from '@/utils/package/imageUrl';
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useState, useRef } from "react";
|
||||
import { storage } from '@/utils';
|
||||
import { setKeyOpenChildWindow } from '@/utils/package/public';
|
||||
import { Button, Input, Modal, Popover } from 'antd';
|
||||
|
|
@ -9,6 +9,7 @@ import { GetRoomUserItem } from '@/api/Meeting';
|
|||
import Avatar from '@/components/Avatar';
|
||||
import dayjs from 'dayjs';
|
||||
import { ExclamationCircleFilled } from '@ant-design/icons';
|
||||
import EquipmentManagement from '@/components/EquipmentManagement';
|
||||
const { confirm } = Modal;
|
||||
const ChatBigWindow: React.FC = () => {
|
||||
const [inputValue, setInputValue] = useState<string>('')
|
||||
|
|
@ -21,13 +22,14 @@ const ChatBigWindow: React.FC = () => {
|
|||
'听不到',
|
||||
'我要发言',
|
||||
])
|
||||
const equipmentManagementRef = useRef<any>();
|
||||
const userInfo = JSON.parse(storage.getItem('user') as string)
|
||||
const stateInfo = JSON.parse(storage.getItem('stateInfo') as string)
|
||||
const channel = new BroadcastChannel('meeting_channel');
|
||||
useEffect(() => {
|
||||
setUser(userInfo)
|
||||
channel.onmessage = function (event) {
|
||||
const { type, chatList } = event.data;
|
||||
const { type, chatList, showDriverList } = event.data;
|
||||
switch (type) {
|
||||
case 'chatList':
|
||||
setChatLists(chatList)
|
||||
|
|
@ -38,6 +40,9 @@ const ChatBigWindow: React.FC = () => {
|
|||
}
|
||||
}, 100)
|
||||
break;
|
||||
case 'showDriverList':
|
||||
equipmentManagementRef.current.setData(showDriverList)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
|
@ -160,13 +165,7 @@ const ChatBigWindow: React.FC = () => {
|
|||
className='m-ant-btn'
|
||||
size={'small'}
|
||||
onClick={() => {
|
||||
channel.postMessage({
|
||||
type: 'chatBigWindowEquipmentManagement',
|
||||
chatBigWindowEquipmentManagement: {
|
||||
uid: roomUserItem.uid,
|
||||
userName: roomUserItem.userName
|
||||
}
|
||||
});
|
||||
equipmentManagementRef.current.changeModal(item.uid, item.userName)
|
||||
}}
|
||||
>设备管理</Button> : null}
|
||||
{roomUserItem.uid !== user.uid ? <Button
|
||||
|
|
@ -256,6 +255,19 @@ const ChatBigWindow: React.FC = () => {
|
|||
}}>发送</Button>
|
||||
</div>
|
||||
</div>
|
||||
<EquipmentManagement ref={equipmentManagementRef} getDriver={(uid: string) => {
|
||||
channel.postMessage({
|
||||
type: 'userListWindowEquipmentManagement',
|
||||
userListWindowEquipmentManagement: {
|
||||
uid
|
||||
}
|
||||
});
|
||||
}} setDriver={(data: any) => {
|
||||
channel.postMessage({
|
||||
type: 'userListWindowSetEquipmentManagement',
|
||||
userListWindowSetEquipmentManagement: data
|
||||
});
|
||||
}} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ const ShareScreenWindow: React.FC = () => {
|
|||
if (!chatBigWindow) {
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/chatBigWindow`,
|
||||
width: 440,
|
||||
width: 540,
|
||||
height: 640,
|
||||
key: 'chatBigWindow',
|
||||
})
|
||||
|
|
@ -159,7 +159,7 @@ const ShareScreenWindow: React.FC = () => {
|
|||
if (!userListWindow) {
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/userListWindow`,
|
||||
width: 340,
|
||||
width: 440,
|
||||
height: 540,
|
||||
key: 'userListWindow',
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,27 +4,32 @@ import ImageUrl from '@/utils/package/imageUrl';
|
|||
import { EllipsisOutlined, ExclamationCircleFilled, SearchOutlined } from '@ant-design/icons';
|
||||
import { Button, Input, Modal, Popover } from 'antd';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useState, useRef } from "react";
|
||||
import { storage } from '@/utils';
|
||||
import { GetRoomUser } from '@/api/Meeting';
|
||||
import { setKeyOpenChildWindow } from '@/utils/package/public';
|
||||
import EquipmentManagement from '@/components/EquipmentManagement';
|
||||
const { confirm } = Modal;
|
||||
|
||||
const UserListWindow: React.FC = () => {
|
||||
const [userSearchValue, setUserSearchValue] = useState('')
|
||||
const [user, setUser] = useState<any>({});
|
||||
const [roomUserList, setRoomUserList] = useState<any>([])
|
||||
const equipmentManagementRef = useRef<any>();
|
||||
const channel = new BroadcastChannel('meeting_channel');
|
||||
const userInfo = JSON.parse(storage.getItem('user') as string)
|
||||
useEffect(() => {
|
||||
setUser(userInfo)
|
||||
getRoomUser()
|
||||
channel.onmessage = function (event) {
|
||||
const { type, roomUserList } = event.data;
|
||||
const { type, roomUserList, showDriverList } = event.data;
|
||||
switch (type) {
|
||||
case 'roomUserList':
|
||||
setRoomUserList(roomUserList)
|
||||
break;
|
||||
case 'showDriverList':
|
||||
equipmentManagementRef.current.setData(showDriverList)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
|
@ -143,15 +148,7 @@ const UserListWindow: React.FC = () => {
|
|||
style={{ width: '100%' }}
|
||||
size={'small'}
|
||||
onClick={() => {
|
||||
channel.postMessage({
|
||||
type: 'shareScreenWindowEquipmentManagement',
|
||||
shareScreenWindowEquipmentManagement: {
|
||||
uid: item.uid,
|
||||
userName: item.userName,
|
||||
}
|
||||
});
|
||||
window.electron.closeChildWindow('userListWindow')
|
||||
setKeyOpenChildWindow('userListWindow', false)
|
||||
equipmentManagementRef.current.changeModal(item.uid, item.userName)
|
||||
}}
|
||||
>设备管理</Button>
|
||||
<Button
|
||||
|
|
@ -201,6 +198,19 @@ const UserListWindow: React.FC = () => {
|
|||
}}>全员静音</div>
|
||||
</div>
|
||||
</div>
|
||||
<EquipmentManagement ref={equipmentManagementRef} getDriver={(uid: string) => {
|
||||
channel.postMessage({
|
||||
type: 'userListWindowEquipmentManagement',
|
||||
userListWindowEquipmentManagement: {
|
||||
uid
|
||||
}
|
||||
});
|
||||
}} setDriver={(data: any) => {
|
||||
channel.postMessage({
|
||||
type: 'userListWindowSetEquipmentManagement',
|
||||
userListWindowSetEquipmentManagement: data
|
||||
});
|
||||
}} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,14 +212,14 @@ const Meeting: React.FC = () => {
|
|||
userListWindowDeleteRoomManager,
|
||||
userListWindowPostRoomManager,
|
||||
userListWindowGetRoomKickout,
|
||||
shareScreenWindowEquipmentManagement,
|
||||
userListWindowEquipmentManagement,
|
||||
userListWindowSetEquipmentManagement,
|
||||
chatSmallWindowSendChannelMsg,
|
||||
chatBigWindowSetAllUserLook,
|
||||
chatBigWindowDeleteRoomManager,
|
||||
chatBigWindowPostRoomManager,
|
||||
chatBigWindowPostOpenMicr,
|
||||
chatBigWindowPostOpenCamera,
|
||||
chatBigWindowEquipmentManagement,
|
||||
chatBigWindowGetRoomKickout,
|
||||
chatBigWindowSendChannelMsg,
|
||||
noticeWindowPostRoomManager
|
||||
|
|
@ -260,10 +260,16 @@ const Meeting: React.FC = () => {
|
|||
return res
|
||||
})
|
||||
break;
|
||||
case 'shareScreenWindowEquipmentManagement':
|
||||
equipmentManagement(shareScreenWindowEquipmentManagement.uid, shareScreenWindowEquipmentManagement.userName)
|
||||
window.electron.mainWindowCenter()
|
||||
window.electron.setViewStatus('show')
|
||||
case 'userListWindowEquipmentManagement':
|
||||
await onInvoke('getDrivers', {
|
||||
uid: userListWindowEquipmentManagement.uid,
|
||||
})
|
||||
break;
|
||||
case 'userListWindowSetEquipmentManagement':
|
||||
await onInvoke('setDrivers', {
|
||||
uid: userListWindowSetEquipmentManagement.uid,
|
||||
driversJsonString: userListWindowSetEquipmentManagement.driversJsonString
|
||||
})
|
||||
break;
|
||||
case 'userListWindowPostOpenMicr':
|
||||
postOpenMicr(userListWindowPostOpenMicr.enableMicr, userListWindowPostOpenMicr.uid)
|
||||
|
|
@ -317,11 +323,6 @@ const Meeting: React.FC = () => {
|
|||
case 'chatBigWindowPostOpenCamera':
|
||||
postOpenCamera(chatBigWindowPostOpenCamera.enableCamera, chatBigWindowPostOpenCamera.uid)
|
||||
break;
|
||||
case 'chatBigWindowEquipmentManagement':
|
||||
equipmentManagement(chatBigWindowEquipmentManagement.uid, chatBigWindowEquipmentManagement.userName)
|
||||
window.electron.mainWindowCenter()
|
||||
window.electron.setViewStatus('show')
|
||||
break;
|
||||
case 'chatBigWindowGetRoomKickout':
|
||||
GetRoomKickout(state.channelId, chatBigWindowGetRoomKickout.uid)
|
||||
break;
|
||||
|
|
@ -764,8 +765,13 @@ const Meeting: React.FC = () => {
|
|||
case 'ShowDriverList':
|
||||
if (item.driversJsonString) {
|
||||
const data = JSON.parse(item.driversJsonString);
|
||||
const isOpen = await getKeyOpenChildWindow('shareScreenWindow')
|
||||
if (isOpen) {
|
||||
channel.postMessage({ type: 'showDriverList', showDriverList: data })
|
||||
} else {
|
||||
equipmentManagementRef.current.setData(data)
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue