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.

148 lines
4.4 KiB
HTML

5 years ago
<extend name="Public/bases" />
<block name="body">
5 years ago
<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__/name.css">
<link rel="stylesheet" type="text/css" href="__CSS__/remove.css">
<style>
body {
background: white;
}
</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>
<div class="remove-info">
<form id='form' action="" method="post" class="">
<?php if(!empty($user['phone'])){ ?>
<div class="remove-input">
<div class="remove-inputBox">
<img src="__IMG__/shoujibangding.png" alt="">
<div>手机号</div>
</div>
<div style="color: #292929">{$user['phone']}</div>
<input type="hidden" name="phone" id="phone" value="{$user['phone']}">
5 years ago
</div>
<?php }else{ ?>
<div class="name-input">
<div class="name-inputBox">
<img src="__IMG__/shoujibangding.png" alt="">
<div>手机号</div>
</div>
<input type="text" placeholder="请输入手机号" style="padding: 0" name="phone" id="phone" value="{$user['phone']}">
</div>
<?php }?>
<div class="remove-input">
<div class="remove-inputBox">
<img src="__IMG__/mingzibianji.png" alt="">
<div>验证码</div>
<input type="text" placeholder="请输入验证码" id="scode" name="scode" value="">
</div>
<div class="code g-btn" id="sendSafeCode">获取验证码</div>
</div>
<div class="save jssubmit">保存修改</div>
</form>
</div>
</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);
5 years ago
};
case 0:{
pmsg.msg(data.msg);
5 years ago
}
break;
5 years ago
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
5 years ago
});
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 + '秒后重发'),
0 == r && ($(e).removeClass('g-btntn').addClass('g-btn'), $(e).text('获取短信验证码'), 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("错误")
}
})
5 years ago
});
});
</script>
5 years ago
</block>