作者 xiaohu thinkpad
... ... @@ -5,7 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="yes" name="apple-touch-fullscreen">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="viewport"
content="width=device-width, initial-scale=1,maximum-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>登录</title>
<link rel="stylesheet" href="/static/css/common.css">
<link rel="stylesheet" href="/static/css/style.css">
... ... @@ -27,7 +28,7 @@
<i>抱歉,此手机号没有权限登录</i>
</div>
<div class="btn_login">
<img src="/static/image/btn_login.png" />
<img src="/static/image/btn_login.png"/>
</div>
</div>
... ... @@ -39,40 +40,40 @@
$(function () {
//获取短信验证码
var times = 1;
var validCode=true;
$(".get_code").click (function () {
if(validCode){
var user_phone=$(".login_phone").val();
var validCode = true;
$(".get_code").click(function () {
if (validCode) {
var user_phone = $(".login_phone").val();
console.log(user_phone);
if(!user_phone){
if (!user_phone) {
layer.msg("手机号码格式不正确")
}else{
if(times ==1){
} else {
if (times == 1) {
times++;
$.ajax({
type:"post",
url:"{:url('portal/tool/get_sms_code')}",
data:{
mobile:user_phone
type: "post",
url: "{:url('portal/tool/get_sms_code')}",
data: {
mobile: user_phone
},
success:function(){
var time=60;
var code=$(".get_code");
success: function () {
var time = 60;
var code = $(".get_code");
if (validCode) {
code.html("60秒");
validCode=false;
validCode = false;
code.addClass("msgs1");
var t=setInterval(function () {
if (time>=0) {
var t = setInterval(function () {
if (time >= 0) {
time--;
code.html(time+"秒");
validCode=false;
} else{
validCode =true;
code.html(time + "秒");
validCode = false;
} else {
validCode = true;
code.html("重新获取");
clearInterval(t);
}
},1000)
}, 1000)
}
}
})
... ... @@ -81,29 +82,27 @@
}
});
$('.btn_login').click(function(){
var user_phone=$(".login_phone").val();
var user_code=$('.login_code').val();
if(!user_code){
$('.btn_login').click(function () {
var user_phone = $(".login_phone").val();
var user_code = $('.login_code').val();
if (!user_code) {
layer.msg("验证码不能为空")
}else{
} else {
$.ajax({
type:"post",
url:"{:url('user/login/do_login')}",
data:{
mobile:user_phone,
sms_code:user_code
type: "post",
url: "{:url('user/login/do_login')}",
data: {
mobile: user_phone,
sms_code: user_code
},
success:function(res){
if(res.code==0){
$('.login_tab i').text(res.msg);
$('.login_tab').show();
}else {
window.location.href="{:url('user/profile/percenter')}"
success: function (res) {
if (res.code == 0) {
layer.msg(res.msg);
} else {
window.location.href = "{:url('user/profile/percenter')}"
}
console.log(res);
},
error:function(){
error: function () {
}
})
... ...