去除多余代码

This commit is contained in:
yj 2024-08-20 17:27:14 +08:00
parent 99e5a22c8e
commit 62757bfcdf
1 changed files with 1 additions and 28 deletions

View File

@ -388,29 +388,6 @@ const Meeting: React.FC = () => {
}, [recorder]) }, [recorder])
const changeAgoraDevice = () => { const changeAgoraDevice = () => {
function sortUsersByRole(arr: any[]): any[] {
// 使用 sort 方法对数组进行排序
return arr.sort((a: any, b: any) => {
// 定义角色优先级
const rolePriority: any = {
admin: 1,
speaker: 2,
user: 3,
};
// 获取角色优先级
const aPriority = rolePriority[a.role] || 3; // 默认为普通用户
const bPriority = rolePriority[b.role] || 3; // 默认为普通用户
// 比较角色优先级
if (aPriority < bPriority) {
return -1; // a 的优先级更高
} else if (aPriority > bPriority) {
return 1; // b 的优先级更高
} else {
// 如果角色相同,则可以按其他标准排序,例如按姓名字母顺序
return a.userName.localeCompare(b.userName);
}
});
}
setRoomUserList((res: any) => { setRoomUserList((res: any) => {
res.forEach(async (item: any) => { res.forEach(async (item: any) => {
if (item.roleId === '1') { if (item.roleId === '1') {
@ -778,11 +755,7 @@ const Meeting: React.FC = () => {
// 设置全员看谁 // 设置全员看谁
const allUserLook = async (uid: string, name: string): Promise<void> => { const allUserLook = async (uid: string, name: string): Promise<void> => {
await PostShowUser(state.channelId, uid, name).then(res => { await PostShowUser(state.channelId, uid, name)
if (res.code === 200) {
getShowUser()
}
})
} }
// 获取房间用户 // 获取房间用户