yangjie #48

Merged
yangqiang merged 10 commits from yangjie into master 2025-02-13 17:28:41 +08:00
3 changed files with 76 additions and 2 deletions
Showing only changes of commit 05c4cfdd95 - Show all commits

13
main.js
View File

@ -95,6 +95,7 @@ function createWindow() {
} }
const additionalData = { myKey: 'myValue' } const additionalData = { myKey: 'myValue' }
app.on('ready', () => { app.on('ready', () => {
// const gotTheLock = true
const gotTheLock = app.requestSingleInstanceLock(additionalData) const gotTheLock = app.requestSingleInstanceLock(additionalData)
if (gotTheLock) { if (gotTheLock) {
app.getPath('crashDumps') app.getPath('crashDumps')
@ -185,6 +186,7 @@ app.on('ready', () => {
connection.off('ModifyNickName'); connection.off('ModifyNickName');
connection.off('JoinChannelCallback'); connection.off('JoinChannelCallback');
connection.off('ExitSharedScreen'); connection.off('ExitSharedScreen');
connection.off('SetSpeaker');
} }
}); });
ipcMain.handle('onStop', (event) => { ipcMain.handle('onStop', (event) => {
@ -226,6 +228,10 @@ app.on('ready', () => {
// 退出房间 // 退出房间
await connection.invoke(str, data.roomNum) await connection.invoke(str, data.roomNum)
break; break;
case 'SetSpeakerCallback':
// 发言人设置成功
await connection.invoke(str, data)
break;
} }
}); });
ipcMain.handle('onOtherSignalr', (event) => { ipcMain.handle('onOtherSignalr', (event) => {
@ -394,6 +400,13 @@ app.on('ready', () => {
key: 'ExitSharedScreen' key: 'ExitSharedScreen'
}) })
}); });
// 设置发言人
connection.on("SetSpeaker", (RoomManagerInputDTO) => {
mainWindow.webContents.send('onSignalr', {
key: 'SetSpeaker',
RoomManagerInputDTO
})
});
} }
}); });
// 放大缩小退出窗口 // 放大缩小退出窗口

View File

@ -71,14 +71,20 @@ export const PostRoomManager = (data: any) =>
request({ request({
url: `/room/manager`, url: `/room/manager`,
method: 'post', method: 'post',
data data: {
...data,
SettingUserId: ''
}
}) })
export const DeleteRoomManager = (data: any) => export const DeleteRoomManager = (data: any) =>
request({ request({
url: `/room/manager`, url: `/room/manager`,
method: 'delete', method: 'delete',
data data: {
...data,
SettingUserId: ''
}
}) })
export const GetRoomKickout = (roomNum: string, kickUid: string) => export const GetRoomKickout = (roomNum: string, kickUid: string) =>

View File

@ -162,6 +162,7 @@ const Meeting: React.FC = () => {
const [_speackUid, setSpeackUid] = useState<any>([]) const [_speackUid, setSpeackUid] = useState<any>([])
const [currentSpeakUser, setCurrentSpeakUser] = useState<any>([]) const [currentSpeakUser, setCurrentSpeakUser] = useState<any>([])
const [chatList, setChatList] = useState<any>([]) const [chatList, setChatList] = useState<any>([])
const [applyUserList, setApplyUserList] = useState<any>([])
const [isExpand, setIsExpand] = useState(false) const [isExpand, setIsExpand] = useState(false)
const [currentVideoId, setCurrentVideoId] = useState('') const [currentVideoId, setCurrentVideoId] = useState('')
const [currentVideoUid, setCurrentVideoUid] = useState('') const [currentVideoUid, setCurrentVideoUid] = useState('')
@ -1022,6 +1023,10 @@ const Meeting: React.FC = () => {
return res return res
}) })
break; break;
// 共享
case 'SetSpeaker':
window.electron.onInvoke('SetSpeakerCallback', item.RoomManagerInputDTO)
break;
} }
}) })
return () => { return () => {
@ -1177,6 +1182,49 @@ const Meeting: React.FC = () => {
return () => clearTimeout(timer); return () => clearTimeout(timer);
}, [isClickedMediaSteam]); }, [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(() => { useEffect(() => {
const elements = document.querySelectorAll('.intersectionObserver-view'); const elements = document.querySelectorAll('.intersectionObserver-view');
if (elements.length && currentVideoId) { if (elements.length && currentVideoId) {
@ -1991,6 +2039,13 @@ const Meeting: React.FC = () => {
roomId: data.roomId, roomId: data.roomId,
roomNum: data.roomNum, roomNum: data.roomNum,
userId: data.userId userId: data.userId
}).then(res => {
if (res.code === 200) {
setApplyUserList((newChatList: any) => [...newChatList, {
uid: data.userId,
status: 5
}])
}
}) })
} }
} }