$(function () { settime(); }); //验证码类型 var sms_type; var smstype; var countdown=100; var indexRoute = $("#indexRoute").val(); $("#countdown").css("backgroundColor","#fff") function settime() { if (countdown == 0) { $("#btn").hide(); window.location.href=indexRoute; } else { countdown--; if(document.getElementById('countdown')){ document.getElementById('countdown').innerHTML = countdown; } } setTimeout(function() { settime(); },1000) } //用户名、帐号登录 $('.loginUser').click(function(){ $('label[for="user"]').addClass('select'); $('label[for="pwd"]').removeClass('select'); }); $('.loginPwd').click(function(){ $('label[for="pwd"]').addClass('select'); $('label[for="user"]').removeClass('select'); }); $('.loginBtn').click(function(){ var account = $("#user").val(); var password = $("#pwd").val(); var autoLogin = $("#autoLogin").val(); if (account == "") { dialogDiv('请输入用户名','确定','Display'); return false; } if (password == "") { dialogDiv('请输入密码','确定','Display'); return false; } $.ajax({ headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, url: $("#form1").attr('action'), type: 'POST', dataType: 'json', data: { account:account, password:password, autoLogin:autoLogin, }, success: function (result) { location.href=result.data.redirect_url; }, error: function (errorData) { if (errorData.status==422) {//验证错误 $.each(JSON.parse(errorData.responseText).errors,function (key,val) { dialogDiv(val[0],'确定','Display'); return false; }); } else if(errorData.status==400) {//业务错误 dialogDiv(JSON.parse(errorData.responseText).message,'确定','Display'); } } }) }); // 手机动态码登录 var regularMobile = /^13[0-9]{9}$|14[0-9]{9}$|15[0-9]{9}$|18[0-9]{9}$|17[0-9]{9}$/; // 验证手机号正则 $('#J_dologinByMobile').on('click', function() { var mobileValue = $.trim($('input[name=mobile]').val()); var verfyCodeValue = $.trim($('input[name=verfy_code]').val()); var isQuick = $("#is_quick").val(); if (mobileValue == "") { dialogDiv('请输入手机号','确定','Display'); $('input[name=mobile]').focus(); return false; } if (mobileValue != "" && !regularMobile.test(mobileValue)) { dialogDiv('手机号码格式不正确','确定','Display'); return false; } if (verfyCodeValue == "") { dialogDiv('请填写验证码','确定','Display'); $('input[name=verfy_code]').focus(); return false; } $.ajax({ headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, url: $("#form2").attr('action_to'), type: 'POST', dataType: 'json', data: { mobile:mobileValue, mobile_code:verfyCodeValue, }, success: function (result) { location.href=result.data.redirect_url; }, error: function (errorData) { if (errorData.status==422) {//验证错误 $.each(JSON.parse(errorData.responseText).errors,function (key,val) { dialogDiv(val[0],'确定','Display'); return false; }); } else if(errorData.status==400) {//业务错误 dialogDiv(JSON.parse(errorData.responseText).message,'确定','Display'); } } }) }); //登录获取验证码 $("#getverificode").click(function () { var is_reg = $("#is_reg").val(); var is_status = $("#is_status").val(); var mobileValue = $.trim($('#mobile').val()); if (mobileValue == '') { dialogDiv('请输入手机号码','确定','Display'); $('#mobile').focus(); return false; }; if (mobileValue != "" && !regularMobile.test(mobileValue)) { dialogDiv('请输入正确的手机号码','确定','Display'); $('#mobile').focus(); return false; } if(is_status==1){ if(is_reg==1) { $.ajax({ headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, url: $("#form2").attr('action'), type: 'POST', dataType: 'json', data: { mobile:mobileValue, }, success: function (result) { // 开始倒计时 var countdownZZ = 60; function settime() { if (countdownZZ == 0) { $('#getverificode').prop("disabled", 0); $('#getverificode').removeClass('btn_disabled'); $('#getverificode').html('获取验证码'); $("#is_status").val(1); countdownZZ = 100; return; } else { $("#is_status").val(0); $('#getverificode').prop("disabled", !0); $('#getverificode').addClass('btn_disabled'); $("#getverificode").css('font-size','18px') $('#getverificode').html('重新发送' + countdownZZ + '秒'); countdownZZ--; } setTimeout(function() { settime() },1000) } settime(); }, error: function (errorData) { if (errorData.status==422) {//验证错误 $.each(JSON.parse(errorData.responseText).errors,function (key,val) { dialogDiv(val[0],'确定','Display'); return false; }); } else if(errorData.status==400) {//业务错误 dialogDiv(JSON.parse(errorData.responseText).message,'确定','Display'); } } }) } } }); function Register() { window.location.href = $("#indexRegister").val(); return false; } function Display() { $("#MyDiv").remove(); $("#fade").remove(); } function create_resume() { window.location.href = +"?m=Aio&c=Members&a=createresume"; return false; } //身份证注册 $("#cardreg").click(function () { var card_mobile = $.trim($("#mobile").val()); var mobilevcode = $.trim($("#mobilevcode").val()); if(card_mobile=="") { dialogDiv('手机号不能空','确定','refresh'); $("#mobile").focus(); return false; } if(mobilevcode == "") { dialogDiv('验证码不能空','确定','refresh'); $("#mobilevcode").focus(); return false; } $.ajax({ type:"post", url:root + "?m=Aio&c=Members&a=register", dataType:"json", data:$("#card_reg").serialize(), success:function (res) { console.log(res); if(res.status) { window.location.href = res.data; } else { dialogDiv(res.msg,'确定','toback'); } } }) }); $("#saveresume").click(function () { var username = $("input[name='username']").val(); var education = $('#education').val(); var salary = $("#salary").val(); var email = $("#email").val(); if(username == '' || username == null) { dialogDiv("姓名不能为空",'确定','refresh'); return ; } else if(education == '' || education == null) { dialogDiv("学历不能为空",'确定','refresh'); return ; } else if(salary == '' || salary == null) { dialogDiv("薪资不能为空",'确定','refresh'); return ; } // else if(email =='' || email == null) // { // dialogDiv("email不能为空",'是','refresh'); // return ; // } else { $.ajax({ url:root + "?m=Aio&c=Members&a=createresume", type:'POST', dataType:"JSON", data:$("#createresume").serialize(), success:function (res) { if(parseInt(res.status)) { dialogDiv(res.msg,'确定','savelocation'); } else { dialogDiv(res.msg,'确定','refresh'); } } }) } }); $("#saveresume2").click(function () { var username = $("input[name='username']").val(); var education = $('#education').val(); var salary = $("#salary").val(); var email = $("#email").val(); if(username == '' || username == null) { dialogDiv("姓名不能为空",'确定','refresh'); return ; } else if(education == '' || education == null) { dialogDiv("学历不能为空",'确定','refresh'); return ; } else if(salary == '' || salary == null) { dialogDiv("薪资不能为空",'确定','refresh'); return ; } // else if(email =='' || email == null) // { // dialogDiv("email不能为空",'是','refresh'); // return ; // } else { $.ajax({ url:root + "?m=Aio&c=Members&a=editresume", type:'POST', dataType:"JSON", data:$("#editresume").serialize(), success:function (res) { if(parseInt(res.status)) { dialogDiv(res.msg,'确定','savelocation'); } else { dialogDiv(res.msg,'确定','refresh'); } } }) } }); function savelocation() { window.location.href = root +"?m=Aio&c=Job&a=joblist&flag=1" } function toback() { window.history.go(-1); } function refresh() { window.location.reload(); } /*底部导航选中事件 by zmy 2018 02 06*/ window.onload=function(){ urlinfo=window.location.href; //获取当前页面的url len=urlinfo.length;//获取url的长度 offset=urlinfo.indexOf("?");//设置参数字符串开始的位置 newsidinfo_first=urlinfo.substr(offset,len)//取出参数字符串 newsidinfo = newsidinfo_first.replace('?','') newsidinfoarray = newsidinfo.split("&");//以&分隔形成参数数组 var newsid; for(var i=0; i