You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/public/javascripts/bigdata.js

414 lines
18 KiB

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.

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;
}
});
});
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($(btn).attr("disabled")) {
return false;
} else{
if($lost_psd_valid){
if($(".drag_certi_block").length > 0){
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);
var uurl = gotoEmail(data.link);
$("#send_success_notice").html("验证码已发送到您的邮箱,去<a href='http://" + uurl + "' id='validate_mail' 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();
}
} else{
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);
var uurl = gotoEmail(data.link);
$("#send_success_notice").html("验证码已发送到您的邮箱,去<a href='http://" + uurl + "' id='validate_mail' 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();
}
}
});
}
}
}
}
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_bind(){
if($phone_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();
$.get(
'/account/valid_verification_code',
{ phone: $("#user_phone_num").val().trim(),
code: $("#phone_verification_code").val().trim(),
type: 4},
function (data) {
if (data.valid) {
$("#phone_verification_code_notice").html("");
$("#phone_verification_code_notice").parent().hide();
$("#main_reg_form").submit();
$("#regist_btn_phone").attr("disabled", "disabled");
} else {
$("#phone_verification_code_notice").html("手机验证码错误或过期");
$("#phone_verification_code_notice").parent().show();
}
});
}
}else{
$('#user_phone_num').blur();
}
}
function phone_register(){
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").attr("disabled", "disabled");
} 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($(".drag_certi_block").length > 0){
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{
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{
$('#user_email_addr').blur();
$('#user_password_2').blur();
}
}
// 新注册用户绑定邮箱
$(function(){
$("#email_verification_code").on('input', function(){
if($(this).val().trim().length > 0){
$("#regist_bind_email").addClass("back-orange-main");
$("#regist_bind_email").attr("disabled", false);
} else{
$("#regist_bind_email").removeClass("back-orange-main");
$("#regist_bind_email").attr("disabled", "disabled");
}
});
$("#user_new_email_addr").on('blur', function(){
if (/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($(this).val().trim()) == false){
$('#user_email_addr_notice').html('请输入有效的邮箱地址');
$('#user_email_addr_notice').parent().show();
$("#user_email_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
}
else{
$.get(
'/account/valid_ajax',
{ valid: "mail",
value: $(this).val().trim() },
function (data) {
if (data.valid) {
$('#user_email_addr_notice').html('');
$('#user_email_addr_notice').parent().hide();
$("#user_email_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check-circle").addClass("color-light-green");
$("#get_mail_verification_code").addClass("btn_orange_bg");
$("#get_mail_verification_code").attr("disabled", false);
} else {
$('#user_email_addr_notice').html('该邮箱已被注册');
$('#user_email_addr_notice').parent().show();
$("#user_email_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$("#get_mail_verification_code").removeClass("btn_orange_bg");
$("#get_mail_verification_code").attr("disabled", "disabled");
}
});
}
});
});
function register_bind_email(){
if($("#user_new_email_addr").val().trim() != "" && $("#email_verification_code").val().trim() != ""){
$.get(
'/account/valid_verification_code',
{ phone: $("#user_new_email_addr").val().trim(),
code: $("#email_verification_code").val().trim(),
type: 5},
function (data) {
if (data.valid) {
$("#email_verification_code_notice").html("");
$("#email_verification_code_notice").parent().hide();
$("#main_bind_email_form").submit();
$("#regist_bind_email").attr("disabled", "disabled");
} else {
$("#email_verification_code_notice").html("验证码错误或过期");
$("#email_verification_code_notice").parent().show();
}
});
}
}
function get_mail_verification_code(btn) {
if($(btn).attr("disabled")) {
return false;
} else {
if (/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($("#user_new_email_addr").val().trim())){
$.get(
'/account/get_verification_code',
{ value: $("#user_new_email_addr").val().trim(),
type: 5},
function (data) {
if (data.status == "2") {
$('#user_email_addr_notice').html('该邮箱已被注册');
$('#user_email_addr_notice').parent().show();
$("#user_email_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check-circle").addClass("color-light-green");
} else {
var uurl = gotoEmail(data.link);
$("#send_code_notice").html("<font class=\"font-12\">验证码已经发送到您的邮箱,去<a href='http://" + uurl + "' id='validate_mail' style='color: #ff7500; text-decoration: underline;' target='_blank'>查收</a></font>").show();
$('#user_email_addr_notice').html('');
$('#user_email_addr_notice').parent().hide();
time(btn);
}
});
} else{
$('#user_email_addr_notice').html('请输入有效的邮箱地址');
$('#user_email_addr_notice').parent().show();
$("#user_email_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
}
}
}
var wait = 60;
function time(btn){
if (wait==0) {
$(btn).addClass("btn_orange_bg");
btn.removeAttribute("disabled");
btn.innerHTML = "获取验证码";
wait = 60;
return;
}else{
$(btn).removeClass("btn_orange_bg");
btn.setAttribute("disabled", "disabled");
btn.innerHTML = wait + "s后重试";
wait--;
}
setTimeout(function(){
time(btn);
},1000);
}