优化设置发言人提示
This commit is contained in:
parent
369aaa420c
commit
05c4cfdd95
13
main.js
13
main.js
|
|
@ -95,6 +95,7 @@ function createWindow() {
|
|||
}
|
||||
const additionalData = { myKey: 'myValue' }
|
||||
app.on('ready', () => {
|
||||
// const gotTheLock = true
|
||||
const gotTheLock = app.requestSingleInstanceLock(additionalData)
|
||||
if (gotTheLock) {
|
||||
app.getPath('crashDumps')
|
||||
|
|
@ -185,6 +186,7 @@ app.on('ready', () => {
|
|||
connection.off('ModifyNickName');
|
||||
connection.off('JoinChannelCallback');
|
||||
connection.off('ExitSharedScreen');
|
||||
connection.off('SetSpeaker');
|
||||
}
|
||||
});
|
||||
ipcMain.handle('onStop', (event) => {
|
||||
|
|
@ -226,6 +228,10 @@ app.on('ready', () => {
|
|||
// 退出房间
|
||||
await connection.invoke(str, data.roomNum)
|
||||
break;
|
||||
case 'SetSpeakerCallback':
|
||||
// 发言人设置成功
|
||||
await connection.invoke(str, data)
|
||||
break;
|
||||
}
|
||||
});
|
||||
ipcMain.handle('onOtherSignalr', (event) => {
|
||||
|
|
@ -394,6 +400,13 @@ app.on('ready', () => {
|
|||
key: 'ExitSharedScreen'
|
||||
})
|
||||
});
|
||||
// 设置发言人
|
||||
connection.on("SetSpeaker", (RoomManagerInputDTO) => {
|
||||
mainWindow.webContents.send('onSignalr', {
|
||||
key: 'SetSpeaker',
|
||||
RoomManagerInputDTO
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
// 放大缩小退出窗口
|
||||
|
|
|
|||
|
|
@ -71,14 +71,20 @@ export const PostRoomManager = (data: any) =>
|
|||
request({
|
||||
url: `/room/manager`,
|
||||
method: 'post',
|
||||
data
|
||||
data: {
|
||||
...data,
|
||||
SettingUserId: ''
|
||||
}
|
||||
})
|
||||
|
||||
export const DeleteRoomManager = (data: any) =>
|
||||
request({
|
||||
url: `/room/manager`,
|
||||
method: 'delete',
|
||||
data
|
||||
data: {
|
||||
...data,
|
||||
SettingUserId: ''
|
||||
}
|
||||
})
|
||||
|
||||
export const GetRoomKickout = (roomNum: string, kickUid: string) =>
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ const Meeting: React.FC = () => {
|
|||
const [_speackUid, setSpeackUid] = useState<any>([])
|
||||
const [currentSpeakUser, setCurrentSpeakUser] = useState<any>([])
|
||||
const [chatList, setChatList] = useState<any>([])
|
||||
const [applyUserList, setApplyUserList] = useState<any>([])
|
||||
const [isExpand, setIsExpand] = useState(false)
|
||||
const [currentVideoId, setCurrentVideoId] = useState('')
|
||||
const [currentVideoUid, setCurrentVideoUid] = useState('')
|
||||
|
|
@ -1022,6 +1023,10 @@ const Meeting: React.FC = () => {
|
|||
return res
|
||||
})
|
||||
break;
|
||||
// 共享
|
||||
case 'SetSpeaker':
|
||||
window.electron.onInvoke('SetSpeakerCallback', item.RoomManagerInputDTO)
|
||||
break;
|
||||
}
|
||||
})
|
||||
return () => {
|
||||
|
|
@ -1177,6 +1182,49 @@ const Meeting: React.FC = () => {
|
|||
return () => clearTimeout(timer);
|
||||
}, [isClickedMediaSteam]);
|
||||
|
||||
useEffect(() => {
|
||||
let timer: NodeJS.Timeout | undefined;
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = undefined;
|
||||
}
|
||||
if (applyUserList.length) {
|
||||
timer = setInterval(() => {
|
||||
setRoomUserList((list: any) => {
|
||||
let newApplyUserList = [...applyUserList]
|
||||
newApplyUserList.forEach((item: any, index: number) => {
|
||||
const user = list.find((i: any) => i.uid === item.uid)
|
||||
if (user) {
|
||||
if (user.isRoomManager) {
|
||||
newApplyUserList.splice(index, 1)
|
||||
} else {
|
||||
item.status--
|
||||
if (item.status <= 0) {
|
||||
message.error(`用户${user.userName}设置管理员失败!`)
|
||||
newApplyUserList.splice(index, 1)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newApplyUserList.splice(index, 1)
|
||||
}
|
||||
});
|
||||
if (newApplyUserList.length === 0) {
|
||||
clearInterval(timer)
|
||||
timer = undefined;
|
||||
}
|
||||
setApplyUserList(newApplyUserList)
|
||||
return list
|
||||
})
|
||||
}, 1000);
|
||||
} else {
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = undefined;
|
||||
}
|
||||
}
|
||||
return () => timer ? clearTimeout(timer) : null;
|
||||
}, [applyUserList]);
|
||||
|
||||
useEffect(() => {
|
||||
const elements = document.querySelectorAll('.intersectionObserver-view');
|
||||
if (elements.length && currentVideoId) {
|
||||
|
|
@ -1991,6 +2039,13 @@ const Meeting: React.FC = () => {
|
|||
roomId: data.roomId,
|
||||
roomNum: data.roomNum,
|
||||
userId: data.userId
|
||||
}).then(res => {
|
||||
if (res.code === 200) {
|
||||
setApplyUserList((newChatList: any) => [...newChatList, {
|
||||
uid: data.userId,
|
||||
status: 5
|
||||
}])
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue