From 523efcae2e4264824852ad25e44c5419daa8c19c Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Wed, 14 Aug 2024 16:26:58 +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 | 38 ++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-) 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