From 37c309a2796fa701a3b262ffa81fc254ca0ae6ec Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Wed, 14 Aug 2024 16:28:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JoinSetting/index.tsx | 34 +++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) 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)) - } - } }}>