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.

161 lines
7.5 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<extend name="Public/base" />
<block name="body" >
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<div class="g-container">
<div class="g-main">
<include file="Public/user_head" />
<div class="user-bd laybox fix">
<include file="Public/user_base" />
<div class="user-section-wrap fl" id="user-section-wrap">
<div class="us2-bindphone">
<form>
<div class="section-tit">手机<if condition="$phone['ming'] neq ''">解绑<else/>绑定</if></div>
<div class="w-item">
<label for="" class="w-label "><span style="color: red">*</span>手机号码:</label>
<input type="text" name="phone" <if condition="$phone['ming'] neq ''"> disabled="disabled" class="w-input"<else/> class="w-input cheackinput" id="phone"</if> value="{$phone['mi']}">
<if condition="$phone['ming'] neq ''">
<input type="hidden" class="w-input cheackinput" name="phone" id="phone" value="{$phone['ming']}">
<input type="hidden" class='jiebang' name="jiebang" value="1">
<else/>
<input type="hidden" class='jiebang' name="jiebang" value="0">
</if>
<span class="error-msg" style="color: red"></span>
</div>
<div class="w-item">
<label for="" class="w-label "><span style="color: red">*</span>验证码:</label>
<input type="text" class="w-input-s cheackinput" id="vcode" name="vcode">
<img src="{:U('verify?vid=3')}" width="115px" height="30px" alt="" class="checkcode" >
<span class="error-msg" style="color: red"></span>
</div>
<div class="w-item">
<label for="" class="w-label "></label>
<input type="button" class="g-btn" id="sendSafeCode" value="获取短信验证码">
</div>
<div class="w-item">
<label for="" class="w-label "><span style="color: red">*</span>短信验证码:</label>
<input type="text" class="w-input cheackinput" name="captcha" id="scode">
<span class="error-msg" style="color: red"></span>
</div>
<div class="w-item">
<label for="" class="w-label"></label>
<div class="w-div">请输入您手机收到的短信验证码。如果您没有收到验证码请等待1分钟后重新点击"获取验证码"</div>
</div>
<div class="w-item">
<label for="" class="w-label"></label>
<input type="button" id="bwbtn" value="<if condition="$phone['ming'] neq ''">解绑<else/>绑定</if>手机" class="g-btn">
</div>
<div class="utips">
<h4>友情提示</h4>
<ul>
<li>手机绑定是{:C(APP_NAME)}账号安全的一项基础功能,绑定后可以轻松享受各项账号管理服务:异地登录短信验证,快捷修复账号密码,<br>享受及时的短信通知服务,随时随地保护您的账号安全。</li>
<li>收到验证码短信内容出现"回复TD退订"是指退订验证码短信,并不是解除手机绑定。</li>
</ul>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$('.checkcode').on('click',function() {
$(this).attr('src','__MODULE__/Member/verify/vid/3/t/'+(new Date).getTime());
});
$('.cheackinput').on('blur',function() {
var val = $(this).val();
if (val == ''){
if ($(this).attr('id') == 'phone') {
$(this).siblings('.error-msg').text('*手机号码不能为空');return;
}else if($(this).attr('id') == 'vcode'){
$(this).siblings('.error-msg').text('*验证码不能为空');return;
}else{
$(this).siblings('.error-msg').text('*短信验证码不能为空');return;
}
} else {
$(this).siblings('.error-msg').text('');
}
if ($(this).attr('id') == 'phone') {
if (val.length !== 11 || !(/^[1][358][0-9]{9}/.test(val))) {
$(this).siblings('.error-msg').text('*手机号码格式不正确');return;
} else {
$(this).siblings('.error-msg').text('');
}
}
});
$('#sendSafeCode').on('click',function() {
var jphone = $('#phone'),phone = $.trim(jphone.val()),
jvcode =$('#vcode'), vcode = $.trim(jvcode.val()),that = $(this);
if (phone == '') {jphone.siblings('.error-msg').text('*必填项');return false;}
if (phone.length !== 11 || !(/^[1][358][0-9]{9}$/.test(phone))) {jphone.siblings('.error-msg').text('*手机号码格式不正确');return false;}
if (vcode == ''){jvcode.siblings('.error-msg').text('*必填项');return false;}
if(!$('#sendSafeCode').hasClass('g-btntn')){
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone+'&verify='+vcode+'&vid=3',
url:'{:U("sendvcode")}',
success:function(data) {
switch (parseInt(data.status)) {
case 1: {
r(1);
};break;
case 2: {
that.siblings('span').text('');
$('#vcode').siblings('.error-msg').text(data.msg); $('.checkcode').click();
};break;
case 0:{
that.siblings('span').text('');
$('#vcode').siblings('.error-msg').text(data.msg); $('.checkcode').click();
};break;
default:
$('#vcode').siblings('.error-msg').text(''); $('.checkcode').click();
that.siblings('span').removeClass('right-msg').addClass('error-msg').text(data.msg);
}
},
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).val('成功'+r + '秒后重发'),
0 == r && ($(e).removeClass('g-btntn').addClass('g-btn'), $(e).val('获取短信验证码'), clearInterval(a))
},1e3)
}
};
}
});
$('#bwbtn').on('click',function() {
var jphone = $('#phone'),phone = $.trim(jphone.val()),
jscode =$('#scode'), scode = $.trim(jscode.val()), jiebang = $(".jiebang").val(),
that = $(this);
if (phone == '') {jphone.siblings('.error-msg').text('*必填项');return false;}
if (phone.length !== 11 || !(/^[1][358][0-9]{9}$/.test(phone))) {jphone.siblings('.error-msg').text('*手机格式不正确');return false;}
if (scode == ''){jscode.siblings('.error-msg').text('*必填项');return false;}
$.ajax({
type:'post',
dataType:'json',
data:'vcode='+scode+'&phone='+phone+'&jiebang='+jiebang,
url:'{:U("users_phone")}',
success:function(data) {
if (parseInt(data.status) == 1 ) {
layer.msg(data.msg,{icon:1});
setTimeout(function() {
window.location.href="{:U('Member/users_safe')}";
},2000);
} else {
layer.msg(data.msg,function(){});
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
});
</script>
</block>