279 lines
12 KiB
JavaScript
279 lines
12 KiB
JavaScript
var $lost_psd_valid = false;
|
||
var lost_psd_time = 60;
|
||
|
||
$(function(){
|
||
$("#change_user_email").on("click", function(){
|
||
$("#change_user_email_block").toggle();
|
||
});
|
||
|
||
$("#lost_psd_input").on("blur", function(){
|
||
if (/^1\d{10}$/.test($("#lost_psd_input").val())){
|
||
$.get(
|
||
'/account/valid_register_user',
|
||
{ valid: "phone",
|
||
value: $("#lost_psd_input").val() },
|
||
function (data) {
|
||
if (data.valid) {
|
||
$('#user_phone_notice').html('');
|
||
$('#user_phone_notice').parent().hide();
|
||
$("#user_phone_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check-circle").addClass("color-light-green");
|
||
$lost_psd_valid = true;
|
||
} else {
|
||
$('#user_phone_notice').html(data.message);
|
||
$('#user_phone_notice').parent().show();
|
||
$("#user_phone_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
|
||
$lost_psd_valid = false;
|
||
}
|
||
});
|
||
} else if(/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($("#lost_psd_input").val())){
|
||
$.get('/account/valid_register_user',
|
||
{ valid: "mail",
|
||
value: $("#lost_psd_input").val() },
|
||
function (data) {
|
||
if (data.valid) {
|
||
$('#user_phone_notice').html('');
|
||
$('#user_phone_notice').parent().hide();
|
||
$("#user_phone_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check-circle").addClass("color-light-green");
|
||
$lost_psd_valid = true;
|
||
} else {
|
||
$('#user_phone_notice').html(data.message);
|
||
$('#user_phone_notice').parent().show();
|
||
$("#user_phone_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
|
||
$lost_psd_valid = false;
|
||
}
|
||
});
|
||
} else{
|
||
$lost_psd_valid = false;
|
||
$('#user_phone_notice').html('请输入有效的邮箱或手机号');
|
||
$('#user_phone_notice').parent().show();
|
||
$("#user_phone_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
|
||
return false;
|
||
}
|
||
});
|
||
|
||
$("#new_psd_submit").on("click", function(){
|
||
if($("#new_password").val().trim().length < 8 || $("#new_password").val().trim().length > 16){
|
||
$('#new_password_notice').parent().show();
|
||
} else{
|
||
$('#new_password_notice').parent().hide();
|
||
if($("#new_password").val() != $("#new_password_confirmation").val()) {
|
||
$('#new_password_confirmation_notice').parent().show();
|
||
} else{
|
||
$('#new_password_confirmation_notice').parent().hide();
|
||
$("#new_psd_submit").parent().parent().parent().submit();
|
||
}
|
||
}
|
||
});
|
||
});
|
||
|
||
function g(o){
|
||
return document.getElementById(o);
|
||
}
|
||
function bigDataHoverLi(n){
|
||
for(var i=1;i<=2;i++){
|
||
g('login_weixin_nav_'+i).className='login_weixin_nav_nomal';
|
||
g('login_weixin_content_'+i).className='undis';
|
||
}
|
||
g('login_weixin_nav_'+n).className='login_weixin_nav_hover';
|
||
g('login_weixin_content_'+n).className='dis';
|
||
if(n==1){
|
||
$('#drag').empty();
|
||
$('#drag').drag();
|
||
} else{
|
||
$('#email_drag').empty();
|
||
$('#email_drag').drag();
|
||
}
|
||
}
|
||
|
||
function settime(btn){
|
||
if (lost_psd_time==0) {
|
||
$(btn).removeClass("rest-btn-ver");
|
||
btn.removeAttribute("disabled");
|
||
btn.innerHTML = "获取验证码";
|
||
lost_psd_time = 60;
|
||
return;
|
||
}else{
|
||
$(btn).addClass("rest-btn-ver");
|
||
btn.setAttribute("disabled", "disabled");
|
||
btn.innerHTML = lost_psd_time + "s后重试";
|
||
lost_psd_time--;
|
||
}
|
||
setTimeout(function(){
|
||
settime(btn);
|
||
},1000);
|
||
}
|
||
|
||
function get_psd_verification_code(btn){
|
||
if($lost_psd_valid){
|
||
if($('.drag_text').html() == "验证通过") {
|
||
btn.setAttribute("disabled", "disabled");
|
||
$.get(
|
||
'/account/get_verification_code',
|
||
{ value: $('#lost_psd_input').val().trim(),
|
||
type: 2},
|
||
function (data) {
|
||
if (data.status == "2") {
|
||
$('#user_phone_notice').html('该手机号或邮箱未注册');
|
||
$('#user_phone_notice').parent().show();
|
||
btn.removeAttribute("disabled");
|
||
} else {
|
||
$('#user_phone_notice').html('');
|
||
$('#user_phone_notice').parent().hide();
|
||
settime(btn);
|
||
if(data.status == "3"){
|
||
$("#ver_code_type").val(3);
|
||
$("#send_success_notice").html("验证码已发送到您的邮箱,去<a href='http://mail." + data.link + "' style='color: #6a8abe; text-decoration: underline;' target='_blank'>查收</a>");
|
||
$("#send_success_notice").show();
|
||
} else{
|
||
$("#ver_code_type").val(2);
|
||
$("#send_success_notice").html("验证码已发送到您的手机,请注意查收");
|
||
$("#send_success_notice").show();
|
||
}
|
||
}
|
||
});
|
||
} else{
|
||
$("#user_verification_notice").html("请先拖动滑块完成验证");
|
||
$('#user_verification_notice').parent().show();
|
||
}
|
||
}
|
||
}
|
||
|
||
function lost_psd_next(){
|
||
if($("#lost_psd_next_a").hasClass('new_login_submit_disable')){
|
||
return;
|
||
}
|
||
if($lost_psd_valid){
|
||
if($('.drag_text').html() == "验证通过"){
|
||
if($("#psd_verification_code").val().trim() == ""){
|
||
$("#phone_verification_code_notice").html("请输入验证码");
|
||
$("#phone_verification_code_notice").parent().show();
|
||
} else{
|
||
$("#phone_verification_code_notice").html("");
|
||
$("#phone_verification_code_notice").parent().hide();
|
||
$.get(
|
||
'/account/valid_verification_code',
|
||
{ phone: $("#lost_psd_input").val().trim(),
|
||
code: $("#psd_verification_code").val().trim(),
|
||
type: $("#ver_code_type").val()},
|
||
function (data) {
|
||
if (data.valid) {
|
||
$("#phone_verification_code_notice").html("");
|
||
$("#phone_verification_code_notice").parent().hide();
|
||
$("#lost_psd_next_a").addClass("new_login_submit_disable");
|
||
window.location.href = "/account/reset_psd?value="+$("#lost_psd_input").val().trim();
|
||
} else {
|
||
$("#phone_verification_code_notice").html("验证码错误或过期");
|
||
$("#phone_verification_code_notice").parent().show();
|
||
}
|
||
});
|
||
}
|
||
} else{
|
||
$("#user_verification_notice").html("请先拖动滑块完成验证");
|
||
$('#user_verification_notice').parent().show();
|
||
}
|
||
} else{
|
||
$('#lost_psd_input').blur();
|
||
}
|
||
}
|
||
|
||
function submit_user_emails(id){
|
||
if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($("#user_new_email").val()) == false){
|
||
$('#mail_req').html("请输入有效的邮箱地址").show();
|
||
return ;
|
||
} else{
|
||
$.get('/account/valid_ajax',
|
||
{ valid: "mail",
|
||
value: $("#user_new_email").val() },
|
||
function (data) {
|
||
if (data.valid) {
|
||
$('#mail_req').html("");
|
||
$.get('/account/change_email',
|
||
{ valid: "mail",
|
||
value: $("#user_new_email").val(),
|
||
user_id: id
|
||
},
|
||
function (change_data){
|
||
var uurl = gotoEmail(change_data.email_link);
|
||
$("#user_email_show").html(change_data.email);
|
||
$("#user_email_link").attr('href', 'http://' + uurl);
|
||
$("#user_new_email").val("");
|
||
$("#change_user_email_block").toggle();
|
||
return;
|
||
});
|
||
} else {
|
||
$('#mail_req').html("该邮箱已注册");
|
||
}
|
||
$('#mail_req').show();
|
||
});
|
||
}
|
||
}
|
||
|
||
function loginin(){
|
||
$('#main_login_form').submit(); //表单提交没有任何反应的原因:js冲突
|
||
}
|
||
|
||
function phone_register(){
|
||
if($("#regist_btn_phone").hasClass('new_login_submit_disable')){
|
||
return;
|
||
}
|
||
if($phone_correct && $passwd_1_correct){
|
||
if($("#phone_verification_code").val().trim() == ""){
|
||
$("#phone_verification_code_notice").html("请输入手机验证码");
|
||
$("#phone_verification_code_notice").parent().show();
|
||
} else{
|
||
$("#phone_verification_code_notice").html("");
|
||
$("#phone_verification_code_notice").parent().hide();
|
||
if($("#read_and_confirm_1").attr("checked") == 'checked'){
|
||
$("#user_aggre_1_notice").html("");
|
||
$("#user_aggre_1_notice").parent().hide();
|
||
$.get(
|
||
'/account/valid_verification_code',
|
||
{ phone: $("#user_phone_num").val().trim(),
|
||
code: $("#phone_verification_code").val().trim(),
|
||
type: 1},
|
||
function (data) {
|
||
if (data.valid) {
|
||
$("#phone_verification_code_notice").html("");
|
||
$("#phone_verification_code_notice").parent().hide();
|
||
$("#main_reg_form").submit();
|
||
$("#regist_btn_phone").addClass("new_login_submit_disable");
|
||
} else {
|
||
$("#phone_verification_code_notice").html("手机验证码错误或过期");
|
||
$("#phone_verification_code_notice").parent().show();
|
||
}
|
||
});
|
||
} else{
|
||
$("#user_aggre_1_notice").html("如果要继续请选中此框");
|
||
$("#user_aggre_1_notice").parent().show();
|
||
}
|
||
}
|
||
}else{
|
||
$('#user_phone_num').blur();
|
||
$('#user_password_1').blur();
|
||
}
|
||
}
|
||
|
||
function email_register(){
|
||
if($("#regist_btn_email").hasClass('new_login_submit_disable')){
|
||
return;
|
||
}
|
||
if($mail_correct && $passwd_2_correct){
|
||
if($('#email_drag .drag_text').html() == "验证通过") {
|
||
if($("#read_and_confirm_2").attr("checked") == 'checked'){
|
||
$("#user_aggre_2_notice").html("");
|
||
$("#user_aggre_2_notice").parent().hide();
|
||
$("#main_reg_email_form").submit();
|
||
$("#regist_btn_email").addClass("new_login_submit_disable");
|
||
} else{
|
||
$("#user_aggre_2_notice").html("如果要继续请选中此框");
|
||
$("#user_aggre_2_notice").parent().show();
|
||
}
|
||
} else{
|
||
$("#email_verification_notice").html("请先拖动滑块完成验证");
|
||
$('#email_verification_notice').parent().show();
|
||
}
|
||
}else{
|
||
$('#user_email_addr').blur();
|
||
$('#user_password_2').blur();
|
||
}
|
||
} |