优化了登录

This commit is contained in:
2020-11-12 18:03:30 +08:00
parent 3b2c47e0ec
commit 5d893d26b5
4 changed files with 36 additions and 73 deletions

View File

@@ -12,14 +12,7 @@ let cameraId = '';
let micId = '';
function login() {
if ($('#userId').val() == '') {
alert('用户名不能为空!');
return;
}
if ($('#roomId').val() == '') {
alert('房间号不能为空!');
return;
}
presetting.login(false, options => {
rtc = new RtcClient(options);
join();
@@ -29,7 +22,10 @@ function login() {
share = new ShareClient(options);
});
}
$(function (){
login();
})
function join() {
rtc.join();
$('#login-root').hide();

View File

@@ -25,7 +25,7 @@ class Presetting {
}
login(share, callback) {
let userId = $('#userId').val();
let userId = window.mid;
if (share) {
userId = 'share_' + userId;
}
@@ -33,7 +33,7 @@ class Presetting {
let sdkAppId;
let userSig;
let roomId = $('#roomId').val();
let roomId = window.roomid;
genTestUserSig(userId).then((res)=>{
sdkAppId = res.id;
userSig = res.data