This commit is contained in:
parent
98d7911918
commit
17254b30fc
|
|
@ -17,7 +17,6 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
>div {
|
>div {
|
||||||
background: #FDC229;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ const Meeting: React.FC = () => {
|
||||||
const [isShareUser, setIsShareUser] = useState<any>(null)
|
const [isShareUser, setIsShareUser] = useState<any>(null)
|
||||||
const [currentLookUserStatus, setCurrentLookUserStatus] = useState<0 | 1 | 2 | 3 | 4>(1)
|
const [currentLookUserStatus, setCurrentLookUserStatus] = useState<0 | 1 | 2 | 3 | 4>(1)
|
||||||
let userInfo = JSON.parse(storage.getItem('user') as string)
|
let userInfo = JSON.parse(storage.getItem('user') as string)
|
||||||
const msgTips = '您不是管理员,无法开启此功能!'
|
const msgTips = '您不是管理员或主讲人,无法开启此功能!'
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let time = null as any;
|
let time = null as any;
|
||||||
setUser(userInfo)
|
setUser(userInfo)
|
||||||
|
|
@ -298,6 +298,13 @@ const Meeting: React.FC = () => {
|
||||||
break;
|
break;
|
||||||
// 主讲人用户信息刷新
|
// 主讲人用户信息刷新
|
||||||
case 'ManagerRefresh':
|
case 'ManagerRefresh':
|
||||||
|
if (item.uid === userInfo.uid) {
|
||||||
|
await agora.updateChannelMediaOptions(item.isRoomManager)
|
||||||
|
if (!item.isRoomManager) {
|
||||||
|
postOpenMicr(false, user.id)
|
||||||
|
postOpenCamera(false, user.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
setAllUserListData('ManagerRefresh', item)
|
setAllUserListData('ManagerRefresh', item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -533,7 +540,7 @@ const Meeting: React.FC = () => {
|
||||||
setNoViewChatList(0)
|
setNoViewChatList(0)
|
||||||
break;
|
break;
|
||||||
case '共享屏幕':
|
case '共享屏幕':
|
||||||
if (user.roleId === '1') {
|
if (getUserRoomInfo()) {
|
||||||
getDesktopCapturerVideo()
|
getDesktopCapturerVideo()
|
||||||
setIsSharedScreenModal(true)
|
setIsSharedScreenModal(true)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -541,7 +548,7 @@ const Meeting: React.FC = () => {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '停止共享':
|
case '停止共享':
|
||||||
if (user.roleId === '1') {
|
if (getUserRoomInfo()) {
|
||||||
await agora.leaveChannelEx(userInfo.screenShareId)
|
await agora.leaveChannelEx(userInfo.screenShareId)
|
||||||
agora.stopScreenCapture()
|
agora.stopScreenCapture()
|
||||||
await allUserLook(userInfo.uid)
|
await allUserLook(userInfo.uid)
|
||||||
|
|
@ -725,7 +732,7 @@ const Meeting: React.FC = () => {
|
||||||
}
|
}
|
||||||
// 开关麦克风
|
// 开关麦克风
|
||||||
const postOpenMicr = async (enableMicr: boolean, uid: string, isAll?: boolean): Promise<void> => {
|
const postOpenMicr = async (enableMicr: boolean, uid: string, isAll?: boolean): Promise<void> => {
|
||||||
if (user.roleId === '1') {
|
if (getUserRoomInfo()) {
|
||||||
if (isAll) {
|
if (isAll) {
|
||||||
await PostMuteAll({
|
await PostMuteAll({
|
||||||
roomNum: state.channelId,
|
roomNum: state.channelId,
|
||||||
|
|
@ -756,7 +763,7 @@ const Meeting: React.FC = () => {
|
||||||
}
|
}
|
||||||
// 开关视频
|
// 开关视频
|
||||||
const postOpenCamera = async (enableCamera: boolean, uid: string): Promise<void> => {
|
const postOpenCamera = async (enableCamera: boolean, uid: string): Promise<void> => {
|
||||||
if (user.roleId === '1') {
|
if (getUserRoomInfo()) {
|
||||||
let msg = '';
|
let msg = '';
|
||||||
if (uid === user.uid) {
|
if (uid === user.uid) {
|
||||||
await agora.getVideoDeviceManager().then(res => {
|
await agora.getVideoDeviceManager().then(res => {
|
||||||
|
|
@ -787,6 +794,14 @@ const Meeting: React.FC = () => {
|
||||||
// const changeSpeakerMode = (): void => {
|
// const changeSpeakerMode = (): void => {
|
||||||
// speakerModeModalRef.current.changeSpeakerMode()
|
// speakerModeModalRef.current.changeSpeakerMode()
|
||||||
// }
|
// }
|
||||||
|
// 获取当前用户在房间的角色信息
|
||||||
|
const getUserRoomInfo = (): any => {
|
||||||
|
let userItem = roomUserList.find((item: any) => item.uid === user.uid)
|
||||||
|
if (userItem && (userItem.roleId === '1' || userItem.isRoomManager)) {
|
||||||
|
return userItem
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
// 获取当前模式样式
|
// 获取当前模式样式
|
||||||
const getMeetingContentBodyLeftModeClass = (): string => {
|
const getMeetingContentBodyLeftModeClass = (): string => {
|
||||||
switch (meetingMode) {
|
switch (meetingMode) {
|
||||||
|
|
@ -1341,11 +1356,11 @@ const meetingContentUser = (item: any) => {
|
||||||
<div className={styles.meetingContentUser}>
|
<div className={styles.meetingContentUser}>
|
||||||
<div className={styles.meetingContentUserName}>
|
<div className={styles.meetingContentUserName}>
|
||||||
{item.roleId === '1' || item.isRoomManager ?
|
{item.roleId === '1' || item.isRoomManager ?
|
||||||
<div>
|
<div style={{ background: item.roleId === '1' ? '#FDC229' : '#3F51B5' }}>
|
||||||
<img src={ImageUrl.icon32} alt="" />
|
<img src={ImageUrl.icon32} alt="" />
|
||||||
</div> : null}
|
</div> : null}
|
||||||
{!item.enableMicr ? <img src={item.enableMicr ? ImageUrl.icon22 : ImageUrl.icon22Active} alt="" /> : ''}
|
{!item.enableMicr ? <img src={item.enableMicr ? ImageUrl.icon22 : ImageUrl.icon22Active} alt="" /> : ''}
|
||||||
<span>{item.userName}</span>
|
<span>{item.userName}{item.roleId === '1' || item.isRoomManager ? item.roleId === '1' ? '(管理员)' : '(主讲人)' : ''}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -189,12 +189,12 @@ const agora = {
|
||||||
joinChannel: async () => {
|
joinChannel: async () => {
|
||||||
await rtcEngine.enableAudioVolumeIndication(100, 1, true)
|
await rtcEngine.enableAudioVolumeIndication(100, 1, true)
|
||||||
await rtcEngine.joinChannel(option.token, option.channelId, option.uid);
|
await rtcEngine.joinChannel(option.token, option.channelId, option.uid);
|
||||||
await agora.updateChannelMediaOptions()
|
await agora.updateChannelMediaOptions(option.roleId === '1' ? true : false)
|
||||||
},
|
},
|
||||||
// 更新频道配置
|
// 更新频道配置
|
||||||
updateChannelMediaOptions: async () => {
|
updateChannelMediaOptions: async (bool: boolean) => {
|
||||||
await rtcEngine.updateChannelMediaOptions({
|
await rtcEngine.updateChannelMediaOptions({
|
||||||
clientRoleType: option.roleId === '1' ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
clientRoleType: bool ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||||
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
|
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
|
||||||
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
publishMicrophoneTrack: true,//设置是否发布麦克风采集到的音频
|
publishMicrophoneTrack: true,//设置是否发布麦克风采集到的音频
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export const onSignalr = (callBack: Function) => {
|
||||||
user
|
user
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
// 管理员用户信息刷新
|
// 主讲人用户信息刷新
|
||||||
connection.on("ManagerRefresh", (user: any) => {
|
connection.on("ManagerRefresh", (user: any) => {
|
||||||
callBack({
|
callBack({
|
||||||
key: 'ManagerRefresh',
|
key: 'ManagerRefresh',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue