You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.2 KiB
HTML

<extend name="Public/bases" />
<block name="body">
<link href="__CSS__/user.css" rel="stylesheet" >
<script src="__JS__/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="__JS__/getRem.js"></script>
<link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
<link rel="stylesheet" type="text/css" href="__CSS__/remove.css">
<style>
body {
background: white;
}
input,button{
padding: 0;
}
</style>
<div class="name">
<!-- 子页公共头部 -->
<div class="subpage-heard"><empty name="user.phone">绑定手机<else/>解除绑定</empty>
<a href="javascript:window.history.go(-1);" class="arrows"></a>
</div>
<form action="">
<div class="login-box">
<?php if(!empty($user['phone'])){ ?>
<div class="login-input">
<img src="__IMG__/shouji.png" alt="">
<input style="color: #292929" type="text" placeholder="请输入手机号" readonly style="padding: 0" name="phone" id="phone" value="{$user['phone']}">
</div>
<?php }else{ ?>
<div class="login-input">
<img src="__IMG__/shouji.png" alt="">
<input type="text" placeholder="请输入手机号" name="phone" id="phone" value="{$user['phone']}">
</div>
<?php }?>
<div class="login-code">
<input type="text" placeholder="请输入验证码" id="scode" name="scode" value="">
<div id="sendSafeCode">获取验证码</div>
</div>
<div class="login-btn jssubmit">提交</div>
</div>
</form>
</div>
<div class="popmsg pop-dialog"></div>
<script src="__JS__/pop.lwx.min.js"></script>
<script>
$(function() {
$('#sendSafeCode').on('click',function() {
var jphone = $('#phone'),phone = $.trim(jphone.val()), that = $(this);
var pmsg = $('.popmsg').pop();
if (phone == '') {
pmsg.msg("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][35789][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("sendvcode")}',
success:function(data) {
switch (parseInt(data.status)) {
case 1: {
r(1);
};
case 0:{
pmsg.msg(data.msg);
}
break;
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
var r = function(i, t) {
if (i>0) {
var r = 59;
e='#sendSafeCode';
$(e).removeClass('g-btn').addClass('g-btntn');
var a = setInterval(function() {
r--;
$(e).text(r + '秒'),
$(e).css("background", "rgba(169,169,169)");
0 == r && ($(e).removeClass('g-btntn').addClass('g-btn'),
$(e).text('获取短信验证码'),
$(e).css("background", "rgba(33,177,235,1)"),
clearInterval(a))
},1e3)
}
};
});
$('.jssubmit').click(function() {
var pmsg = $('.popmsg').pop();
var phone = $.trim($('#phone').val());
var scode = $.trim($('#scode').val());
if (phone == '') {
pmsg.msg("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][358][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
if(scode == ''){
pmsg.msg("验证码不能为空");
return false;
}
$.ajax({
cache:true,
type:'post',
url:"{:U('User/userphone')}",
data:$('#form').serialize(),
dataType:'json',
success:function(result){
pmsg.msg(result.msg);
if(result.status == 1){
setTimeout(function () {
window.location.href = result.url;
}, 2000);
}
},
error:function(){
pmsg.msg("错误")
}
})
});
});
</script>
</block>