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