|
|
@@ -12,7 +12,7 @@ |
|
|
|
var isBindAccountLogin = request('isBindAccountLogin');//切换账号登录 |
|
|
|
var bindUserName = request('bindUserName');//绑定账号 |
|
|
|
var bindUserPassword = request('bindUserPassword');//绑定账号密码 |
|
|
|
var codeType = 'firstlogin' |
|
|
|
var codeType = 'firstlogin', hasSendCode = false, time = 0, timeT = '', isSending = false; |
|
|
|
var lrPage = { |
|
|
|
init: function () { |
|
|
|
//切换账号登录时:登录页赋值,触发登录事件; |
|
|
@@ -248,6 +248,7 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
sendCode: function () { |
|
|
|
if (isSending || hasSendCode) return; |
|
|
|
let phone = $('#phone').val() |
|
|
|
if (!phone) { |
|
|
|
$('#firstLoginBox .error_info span').text('请输入手机号') |
|
|
@@ -259,14 +260,26 @@ |
|
|
|
return |
|
|
|
} |
|
|
|
$('#firstLoginBox .error_info').hide() |
|
|
|
lrPage.firstLogining(true); |
|
|
|
isSending = true |
|
|
|
$.ajax({ |
|
|
|
url: $.rootUrl + "/Login/Sendcode", |
|
|
|
data: { phone, codeType }, |
|
|
|
dataType:'json', |
|
|
|
type: "post", |
|
|
|
success: function (res) { |
|
|
|
lrPage.firstLogining(false); |
|
|
|
success: (res) => { |
|
|
|
isSending = false; |
|
|
|
hasSendCode = true |
|
|
|
time = 60 |
|
|
|
$('#sendCode').text(`重新发送(${time}s)`) |
|
|
|
timeT = setInterval(() => { |
|
|
|
time-- |
|
|
|
if (time == 0) { |
|
|
|
hasSendCode = false |
|
|
|
clearInterval(timeT) |
|
|
|
timeT = '' |
|
|
|
} |
|
|
|
$('#sendCode').text(`重新发送${time ?'('+time+'s'+')':''}`) |
|
|
|
}, 1000); |
|
|
|
if (res.code == 200) { |
|
|
|
$('#firstLoginBox .error_info span').text('短信已发送') |
|
|
|
$('#firstLoginBox .error_info').show() |
|
|
@@ -278,8 +291,39 @@ |
|
|
|
}); |
|
|
|
}, |
|
|
|
firstLogin: function () { |
|
|
|
let username = $('#username').val() |
|
|
|
let phone = $('#phone').val() |
|
|
|
let verifycode = $('#verifycode').val() |
|
|
|
if (!phone) { |
|
|
|
$('#firstLoginBox .error_info span').text('请输入手机号') |
|
|
|
$('#firstLoginBox .error_info').show() |
|
|
|
return |
|
|
|
} else if (!/^1[0-9]{10}$/.test(phone)) { |
|
|
|
$('#firstLoginBox .error_info span').text('手机号格式不正确') |
|
|
|
$('#firstLoginBox .error_info').show() |
|
|
|
return |
|
|
|
} |
|
|
|
if (!verifycode) { |
|
|
|
$('#firstLoginBox .error_info span').text('请输入验证码') |
|
|
|
$('#firstLoginBox .error_info').show() |
|
|
|
return |
|
|
|
} |
|
|
|
$('#firstLoginBox .error_info').hide() |
|
|
|
lrPage.firstLogining(true); |
|
|
|
$.ajax({ |
|
|
|
url: $.rootUrl + "/Login/LoginByMobile", |
|
|
|
data: { phone, codeType, verifycode }, |
|
|
|
dataType: 'json', |
|
|
|
type: "post", |
|
|
|
success: (res) => { |
|
|
|
lrPage.firstLogining(false); |
|
|
|
if (res.code == 200) { |
|
|
|
|
|
|
|
} else { |
|
|
|
$('#firstLoginBox .error_info span').text(res.info) |
|
|
|
$('#firstLoginBox .error_info').show() |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
$(function () { |
|
|
|