This commit is contained in:
yj 2024-08-14 09:04:25 +08:00
parent f085e98abe
commit 55269275e3
1 changed files with 11 additions and 14 deletions

View File

@ -7,10 +7,11 @@ import { useLocation } from 'react-router-dom';
import { GetRoomUser, PostRoomInvite } from '@/api/Meeting';
import { storage } from '@/utils';
import Avatar from '@/components/Avatar';
let userInfo = JSON.parse(storage.getItem('user') as string)
const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
useImperativeHandle(ref, () => ({
changeInvitingPersonnelModal: () => {
let userInfo = JSON.parse(storage.getItem('user') as string)
setUser(userInfo)
setCheckedList([])
getUserList()
setIsInvitingPersonnelModal(true)
@ -19,6 +20,7 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
const { state } = useLocation();
const [isInvitingPersonnelModal, setIsInvitingPersonnelModal] = useState(false);
const [isFirstRender, setIsFirstRender] = useState(true);
const [user, setUser] = useState<any>('');
const [optionsValue, setOperationValue] = useState<number>(1);
const [list, setList] = useState<any>({
data: [],
@ -146,9 +148,9 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
return checkedList
}
})
}} disabled={!item.isOnline || item.account === userInfo.account || item.disabled} checked={item.checked}></Checkbox>
}} disabled={!item.isOnline || item.account === user.account || item.disabled} checked={item.checked}></Checkbox>
<div><Avatar name={item.userName} /></div>
<span>{item.userName}{item.account === userInfo.account ? '(我)' : ''}{item.disabled ? '(已入会)' : ''}</span>
<span>{item.userName}{item.account === user.account ? '(我)' : ''}{item.disabled ? '(已入会)' : ''}</span>
</div>
<div style={{ color: item.isOnline ? '#02B188' : 'rgb(221 11 11)' }}>{item.isOnline ? '在线' : '离线'}</div>
</div>) : <span style={{ display: 'block', textAlign: 'center', color: 'white', padding: '30px 0' }}></span>}
@ -174,17 +176,12 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
<Button type="primary" onClick={() => { setIsInvitingPersonnelModal(false) }} style={{ backgroundColor: '#31353A', marginRight: '14px' }}></Button>
<Button type="primary" className='m-ant-btn' onClick={() => {
if (checkedList.length) {
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)
}
})
}
PostRoomInvite(state.roomId, checkedList.map((item: any) => item.id)).then(res => {
if (res.code === 200) {
message.success('邀请成功')
setIsInvitingPersonnelModal(false)
}
})
} else {
message.error('请选择人员')
}