diff --git a/src/components/JoinSetting/index.tsx b/src/components/JoinSetting/index.tsx index 15b7650..690b127 100644 --- a/src/components/JoinSetting/index.tsx +++ b/src/components/JoinSetting/index.tsx @@ -148,35 +148,37 @@ const JoinSetting = forwardRef((_props: any, ref: any) => {
{ joinRoomSettingForm.list.map((item, index) => { - return
{ + return
{ let msg = ''; setDeviceList((res: any) => { if (index === 0) { if (!res.audioList.length) { msg = '未检测到麦克风!' + console.log(msg); + } } else { if (!res.videoList.length) { msg = '未检测到麦克风!' } } + if (msg) { + message.error('未检测到麦克风!') + return + } + const list = [...joinRoomSettingForm.list] + list[index].active = !list[index].active + setJoinRoomSettingForm({ + ...joinRoomSettingForm, + list + }) + if (index === 1) { + if (list[index].active) { + agora.startPreview('videoPreview', Number(user.account)) + } + } return res }) - if (msg) { - message.error('未检测到麦克风!') - return - } - const list = [...joinRoomSettingForm.list] - list[index].active = !list[index].active - setJoinRoomSettingForm({ - ...joinRoomSettingForm, - list - }) - if (index === 1) { - if (list[index].active) { - await agora.startPreview('videoPreview', Number(user.account)) - } - } }}>