This commit is contained in:
parent
f085e98abe
commit
55269275e3
|
|
@ -7,10 +7,11 @@ import { useLocation } from 'react-router-dom';
|
||||||
import { GetRoomUser, PostRoomInvite } from '@/api/Meeting';
|
import { GetRoomUser, PostRoomInvite } from '@/api/Meeting';
|
||||||
import { storage } from '@/utils';
|
import { storage } from '@/utils';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
let userInfo = JSON.parse(storage.getItem('user') as string)
|
|
||||||
const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
|
const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
changeInvitingPersonnelModal: () => {
|
changeInvitingPersonnelModal: () => {
|
||||||
|
let userInfo = JSON.parse(storage.getItem('user') as string)
|
||||||
|
setUser(userInfo)
|
||||||
setCheckedList([])
|
setCheckedList([])
|
||||||
getUserList()
|
getUserList()
|
||||||
setIsInvitingPersonnelModal(true)
|
setIsInvitingPersonnelModal(true)
|
||||||
|
|
@ -19,6 +20,7 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
|
||||||
const { state } = useLocation();
|
const { state } = useLocation();
|
||||||
const [isInvitingPersonnelModal, setIsInvitingPersonnelModal] = useState(false);
|
const [isInvitingPersonnelModal, setIsInvitingPersonnelModal] = useState(false);
|
||||||
const [isFirstRender, setIsFirstRender] = useState(true);
|
const [isFirstRender, setIsFirstRender] = useState(true);
|
||||||
|
const [user, setUser] = useState<any>('');
|
||||||
const [optionsValue, setOperationValue] = useState<number>(1);
|
const [optionsValue, setOperationValue] = useState<number>(1);
|
||||||
const [list, setList] = useState<any>({
|
const [list, setList] = useState<any>({
|
||||||
data: [],
|
data: [],
|
||||||
|
|
@ -146,9 +148,9 @@ const InvitingPersonnelModal = forwardRef((props: any, ref: any) => {
|
||||||
return checkedList
|
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>
|
<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>
|
||||||
<div style={{ color: item.isOnline ? '#02B188' : 'rgb(221 11 11)' }}>{item.isOnline ? '在线' : '离线'}</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>}
|
</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" 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) {
|
||||||
let me = checkedList.find((item: any) => item.id === userInfo.uid)
|
PostRoomInvite(state.roomId, checkedList.map((item: any) => item.id)).then(res => {
|
||||||
if (me) {
|
if (res.code === 200) {
|
||||||
message.error('您不能邀请自己')
|
message.success('邀请成功')
|
||||||
} else {
|
setIsInvitingPersonnelModal(false)
|
||||||
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('请选择人员')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue