From ef932fd3a8865b58682084273c1e3d0dccd6a45a Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 24 Sep 2024 15:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=A0=E5=85=A5=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E9=92=B1=E7=9A=84loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JoinSetting/index.tsx | 15 +++++++++++++++ src/page/Home/Index/index.tsx | 9 ++++++++- src/utils/styles/App.scss | 4 ++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/components/JoinSetting/index.tsx b/src/components/JoinSetting/index.tsx index 2d38cba..6a11b2a 100644 --- a/src/components/JoinSetting/index.tsx +++ b/src/components/JoinSetting/index.tsx @@ -68,7 +68,11 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { await GetCheckoutRoomNum(roomNum).then(res => { if (res.code === 200) { callBack(res.data) + } else { + storage.setItem('loading', false) } + }).catch(() => { + storage.setItem('loading', false) }) } const getRoomRtcToken = async (roomNum: string, callBack: Function): Promise => { @@ -78,7 +82,11 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { token: res[0].data, tokenA: res[1].data, }) + } else { + storage.setItem('loading', false) } + }).catch(() => { + storage.setItem('loading', false) }) } const postRefresh = async (callBack: Function): Promise => { @@ -87,7 +95,11 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { storage.setItem('user', JSON.stringify(res.data)) storage.setItem('userLogin', true) callBack(res.data) + } else { + storage.setItem('loading', false) } + }).catch(() => { + storage.setItem('loading', false) }) } return ( @@ -172,6 +184,7 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { message.error('请输入会议号!') return } + storage.setItem('loading', true) isGetCheckoutRoomNum(roomNumber, (bool: boolean) => { if (bool) { getRoomRtcToken(roomNumber, (options: any) => { @@ -194,6 +207,8 @@ const JoinSetting = forwardRef((_props: any, ref: any) => { } }) } + }).finally(() => { + storage.setItem('loading', false) }) }) } diff --git a/src/page/Home/Index/index.tsx b/src/page/Home/Index/index.tsx index d24253a..765597c 100644 --- a/src/page/Home/Index/index.tsx +++ b/src/page/Home/Index/index.tsx @@ -87,6 +87,8 @@ const Index: React.FC = () => { tokenA: res[1].data, }) } + }).finally(() => { + storage.setItem('loading', false) }) } const postRefresh = async (callBack: Function): Promise => { @@ -95,7 +97,11 @@ const Index: React.FC = () => { storage.setItem('user', JSON.stringify(res.data)) storage.setItem('userLogin', true) callBack(res.data) + } else { + storage.setItem('loading', false) } + }).catch(() => { + storage.setItem('loading', false) }) } @@ -206,7 +212,7 @@ const Index: React.FC = () => {
- {role.ID.includes(userInfo.roleId) ? {userInfo.roleId === '1' ? { if (role.ID.includes(userInfo.roleId)) { joinSettingRef.current.changeModal(item.roomNum) } else { + storage.setItem('loading', true) postRefresh(() => { getRoomRtcToken(item.roomNum, (options: any) => { if (options) { diff --git a/src/utils/styles/App.scss b/src/utils/styles/App.scss index 1ca5229..f14107f 100644 --- a/src/utils/styles/App.scss +++ b/src/utils/styles/App.scss @@ -380,4 +380,8 @@ $pagination-hover-background-color: #5575F2; // ant-message .ant-message { -webkit-app-region: no-drag; +} + +.ant-spin-fullscreen { + z-index: 10000; } \ No newline at end of file