This commit is contained in:
yj 2024-09-26 11:40:23 +08:00
parent eecbd88eea
commit 75a4f1b191
2 changed files with 33 additions and 19 deletions

View File

@ -316,15 +316,18 @@ const Login: React.FC = () => {
if (!anonInfo.nickName) { if (!anonInfo.nickName) {
return message.error('请输入参会昵称!') return message.error('请输入参会昵称!')
} }
PostAnonLogin(anonInfo).then((res) => { storage.setItem('loading', true)
PostAnonLogin(anonInfo).then(async (res) => {
if (res.code == 200) { if (res.code == 200) {
storage.setItem('user', JSON.stringify(res.data)) storage.setItem('user', JSON.stringify(res.data))
storage.setItem('userLogin', true) storage.setItem('userLogin', true)
startSignalr() await startSignalr()
getRoomRtcToken(anonInfo.roomNum, (options: any) => { getRoomRtcToken(anonInfo.roomNum, (options: any) => {
if (options) { if (options) {
GetRoomInfo(anonInfo.roomNum).then(async (res) => { GetRoomInfo(anonInfo.roomNum).then(async (res) => {
if (res.code === 200) { if (res.code === 200) {
setTimeout(() => {
storage.setItem('loading', false)
window.electron.getWindowSize().then((res: any) => { window.electron.getWindowSize().then((res: any) => {
window.electron.setMainWindowSize({ window.electron.setMainWindowSize({
width: Math.ceil(res.width / 1.5), width: Math.ceil(res.width / 1.5),
@ -342,11 +345,22 @@ const Login: React.FC = () => {
enableCamera: false, enableCamera: false,
} }
}) })
}, 2000)
} else {
storage.setItem('loading', false)
} }
}).catch(() => {
storage.setItem('loading', false)
})
} else {
storage.setItem('loading', false)
}
}).catch(() => {
storage.setItem('loading', false)
}) })
} }
}) }).catch(() => {
} storage.setItem('loading', false)
}) })
}}></Button> }}></Button>
</div> </div>

View File

@ -10,7 +10,7 @@ export const startSignalr = async () => {
accessTokenFactory: () => user.token accessTokenFactory: () => user.token
}) })
.build(); .build();
onStart() await onStart()
storage.setItem('isSignalr', true) storage.setItem('isSignalr', true)
connection.onclose(async () => { connection.onclose(async () => {
await onStart() await onStart()