diff --git a/src/components/JoinSetting/index.tsx b/src/components/JoinSetting/index.tsx index e212ec3..15b7650 100644 --- a/src/components/JoinSetting/index.tsx +++ b/src/components/JoinSetting/index.tsx @@ -15,9 +15,14 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { let userInfo = JSON.parse(storage.getItem('user') as string) setUser(userInfo) setJoinRoomSettingModal(true) - setJoinRoomSettingForm({ - ...joinRoomSettingForm, - roomNum, + setJoinRoomSettingForm((res: any) => { + res.list.forEach((item: any) => { + item.active = false + }); + return { + ...res, + roomNum: roomNum + } }) if (location.hash.indexOf('/meeting') === -1) { agora.init() @@ -107,7 +112,8 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { <> { clearInterval(time) @@ -143,16 +149,22 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { { joinRoomSettingForm.list.map((item, index) => { return
{ - if (index === 0) { - if (!deviceList.audioList.length) { - message.error('未检测到麦克风!') - return - } - } else { - if (!deviceList.videoList.length) { - message.error('未检测到摄像头!') - return + let msg = ''; + setDeviceList((res: any) => { + if (index === 0) { + if (!res.audioList.length) { + msg = '未检测到麦克风!' + } + } else { + if (!res.videoList.length) { + msg = '未检测到麦克风!' + } } + return res + }) + if (msg) { + message.error('未检测到麦克风!') + return } const list = [...joinRoomSettingForm.list] list[index].active = !list[index].active