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,37 +316,51 @@ 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) {
window.electron.getWindowSize().then((res: any) => { setTimeout(() => {
window.electron.setMainWindowSize({ storage.setItem('loading', false)
width: Math.ceil(res.width / 1.5), window.electron.getWindowSize().then((res: any) => {
height: Math.ceil(res.height / 1.3), window.electron.setMainWindowSize({
width: Math.ceil(res.width / 1.5),
height: Math.ceil(res.height / 1.3),
})
}) })
}) navigate(`/meeting`, {
navigate(`/meeting`, { state: {
state: { channelId: anonInfo.roomNum,
channelId: anonInfo.roomNum, token: options.token,
token: options.token, tokenA: options.tokenA,
tokenA: options.tokenA, roomId: res.data.id,
roomId: res.data.id, roomName: res.data.roomName,
roomName: res.data.roomName, enableMicr: false,
enableMicr: false, 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()