邀请完成

This commit is contained in:
yj 2024-07-19 16:48:02 +08:00
parent d7eaf1584d
commit 7a75abc22c
5 changed files with 27 additions and 10 deletions

View File

@ -72,7 +72,7 @@ const App: React.FC = () => {
break; break;
} }
}) })
}, []) }, [navigate])
const handleResize = (): void => { const handleResize = (): void => {
setWindowSize({ setWindowSize({
width: window.innerWidth, width: window.innerWidth,

View File

@ -6,6 +6,7 @@ import { SearchOutlined } from '@ant-design/icons';
import { GetUserList } from '@/api/Home/User'; import { GetUserList } from '@/api/Home/User';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { PostRoomInvite } from '@/api/Meeting'; import { PostRoomInvite } from '@/api/Meeting';
import { storage } from '@/utils';
const InvitingPersonnelModal = forwardRef((props: any, ref: any) => { const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
changeInvitingPersonnelModal: () => { changeInvitingPersonnelModal: () => {
@ -164,8 +165,18 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
<Button type="primary" onClick={() => { setIsInvitingPersonnelModal(false) }} style={{ backgroundColor: '#31353A', marginRight: '14px' }}></Button> <Button type="primary" onClick={() => { setIsInvitingPersonnelModal(false) }} style={{ backgroundColor: '#31353A', marginRight: '14px' }}></Button>
<Button type="primary" className='m-ant-btn' onClick={() => { <Button type="primary" className='m-ant-btn' onClick={() => {
if (checkedList.length) { if (checkedList.length) {
PostRoomInvite(state.roomId, checkedList.map((item: any) => item.id)) let userInfo = JSON.parse(storage.getItem('user') as string)
setIsInvitingPersonnelModal(false) let me = checkedList.find((item: any) => item.id === userInfo.uid)
if (me) {
message.error('您不能邀请自己')
} else {
PostRoomInvite(state.roomId, checkedList.map((item: any) => item.id)).then(res => {
if (res.code === 200) {
message.success('邀请成功')
setIsInvitingPersonnelModal(false)
}
})
}
} else { } else {
message.error('请选择人员') message.error('请选择人员')
} }

View File

@ -52,6 +52,10 @@ const JoinMeetingModal = forwardRef((props: any, ref: any) => {
<span></span> <span></span>
</div> </div>
<div onClick={() => { <div onClick={() => {
if (location.hash.indexOf('/meeting') !== -1) {
setIsJoinMeetingModal(false)
return message.error('您已经在房间中了,请退出房间重试。')
}
isGetCheckoutRoomNum(info.roomNum, (bool: boolean) => { isGetCheckoutRoomNum(info.roomNum, (bool: boolean) => {
if (bool) { if (bool) {
getRoomRtcToken(info.roomNum, (token: string) => { getRoomRtcToken(info.roomNum, (token: string) => {

View File

@ -638,7 +638,7 @@ const Meeting: React.FC = () => {
} }
)} )}
</div> </div>
<div className={`${styles.meetingUserListFooter} drag`}> <div className={`${styles.meetingUserListFooter} drag`} onClick={() => invitingPersonnelRef.current.changeInvitingPersonnelModal()}>
<div></div> <div></div>
<div onClick={() => postOpenMicr(false, true)}></div> <div onClick={() => postOpenMicr(false, true)}></div>
</div> </div>

View File

@ -17,12 +17,14 @@ export const startSignalr = () => {
} }
export const onInvitation = (callBack: Function) => { export const onInvitation = (callBack: Function) => {
connection.on("Invitation", (roomNum: string, roomName: string, InviterName: string) => { if (connection) {
callBack({ connection.on("Invitation", (roomNum: string, roomName: string, InviterName: string) => {
key: 'Invitation', callBack({
roomNum, roomName, InviterName key: 'Invitation',
}) roomNum, roomName, InviterName
}); })
});
}
} }
export const onSignalr = (callBack: Function) => { export const onSignalr = (callBack: Function) => {
if (connection) { if (connection) {