var __root_dir__ = "";
var __version__ = "v1.6.2";
var __lang__ = "cn";
var eyou_basefile = "/index.php";
$(document).keydown(function(event){
if(event.keyCode ==13){
check_submit();
}
});
function fleshVerify(){
var src = "/index.php?m=api&c=Ajax&a=vertify&type=users_retrieve_password";
if (src.indexOf('?') > -1) {
src += '&';
} else {
src += '?';
}
src += 'r='+ Math.floor(Math.random()*100);
$('#imgVerifys').attr('src', src);
}
function check_submit()
{
var email = $('#email').val();
var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
// 邮箱格式不正确
if(!reg.test(email)){
layer.msg('邮箱格式不正确,请正确输入邮箱地址!', {time: 1500});
return false;
}
var email_code = $('#email_code').val();
if(email_code == ''){
layer.msg('邮箱验证码不能为空', {time: 1000});
return false;
}
layer_loading('正在处理');
$.ajax({
// async:false,
url: "/index.php?m=user&c=Users&a=retrieve_password",
data: $('#theForm').serialize(),
type:'post',
dataType:'json',
success:function(res){
layer.closeAll();
if (res.code == 1) {
window.location.href = res.url;
} else {
layer.msg(res.msg, {time: 2000, icon: 5});
}
},
error : function(e) {
layer.closeAll();
showErrorAlert(e.responseText);
}
});
};
function send_email(email){
var email = $('#email').val();
var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
// 邮箱格式不正确
if(!reg.test(email)){
layer.msg('邮箱格式不正确,请正确输入邮箱地址!', {time: 1500});
return false;
}
$("#email_code_button").val('发送中…');
$("#email_code_button").attr('disabled', 'disabled');
layer_loading('正在处理');
$.ajax({
url: "/index.php?m=user&c=Smtpmail&a=send_email",
data: {email:email,title:'找回密码',type:'retrieve_password',scene:4},
type:'post',
dataType:'json',
success:function(res){
layer.closeAll();
if(res.code == 1){
countdown();
layer.msg(res.msg, {time: 1000});
}else{
$("#email_code_button").val('点击发送');
$("#email_code_button").removeAttr("disabled");
showErrorAlert(res.msg);
}
},
error : function(e) {
layer.closeAll();
$("#email_code_button").val('点击发送');
$("#email_code_button").removeAttr("disabled");
showErrorAlert(e.responseText);
}
});
};
function countdown(){
// 倒计时
var setTime;
var time = 120;
setTime = setInterval(function(){
if(0 >= time){
clearInterval(setTime);
return;
}
time--;
$("#email_code_button").val(time+'秒');
$("#email_code_button").attr('disabled', 'disabled');
if(time == 0){
$("#email_code_button").val('点击发送');
$("#email_code_button").removeAttr("disabled");
}
},1000);
}