<div class="" id="mask"></div>
<div id="login_mask" class="login_mask_content">
<div class="mask_title">用户登录</div>
<form method="post" class="login_form" id="login_subform" >
<div class="login-input username">
<span>账号</span>
<input type="text" id="username" name="username" placeholder="身份证号或者注册手机号">
<input id="fwid" type="hidden" name="fwid" value="">
<input type="hidden" value="" name="menuid" id="menuid">
<a href="javascript:void(0)" onclick="fnOpenRegistWin()">注册</a>
</div>
<div class="login-input pswd">
<span>密码</span>
<input type="password" id="password" name="password" placeholder="请输入密码!">
</div>
<div class="login-input yzm" id="ptyzm">
<span>验证码</span>
<input id="captcha_gr" type="text" name="captcha" placeholder="请输入验证码!">
<img id="codeimg" style="width:60px;height:100%;border-left:solid #ddd 1px;size:100%;position:absolute;right:0" onclick="refeshCode()" title="点击换一张" src="${rootpath}/CaptchaImg">
</div>
<div class="tips div-after">
<a href="javascript:void(0)" onclick="fnOpenPsdWin()">重置密码</a>
</div>
<div class="btn-content">
<a class="login-btn" id="login_btn" onclick="login()">登 录</a>
<a class="cancle-btn" onclick="fnCloseWin()">取消</a>
</div>
</form>
</div>
<div id="regist_mask" class="login_mask_content">
<div class="mask_title">注册</div>
<form method="post" class="regist_form" id="regist_subform" >
<div class="inputs idcard">
<span><i>*</i>身份证号</span>
<input type="text" onChange="validIdcard(this)" id="idcard" placeholder="请输入二代身份证号码">
</div>
<div class="inputs name">
<span><i>*</i>姓 名</span>
<input type="text" id="name" placeholder="请输入姓名!">
</div>
<div class="inputs phone">
<span><i>*</i>手机号码</span>
<input type="text" onChange="validTel()" id="tel" placeholder="请输入手机号码!">
</div>
<div class="inputs validCode">
<span><i>*</i>验 证 码</span>
<input type="text" id="validCode" placeholder="请输入短信验证码!" style="width: 160px;">
<a class="send-btn" href="javascript:;" onclick="sendCode(this,1)">发送验证码</a>
</div>
<div class="inputs pwd">
<span><i>*</i>密 码</span>
<input type="password" id="pwd" placeholder="请输入密码!">
</div>
<div class="inputs pwd_confirm">
<span><i>*</i>确认密码</span>
<input type="password" class="" id="pwd_confirm" onChange="validPwd(this)" placeholder="请输入确认密码!">
</div>
<div class="inputs tips">已有账号,<a class="toLogin-btn" onclick="fnChangeToLoginWin()">立即登录</a></div>
<div class="btn-content">
<a class="login-btn" id="register_btn" onclick="fnRegister()">注册</a>
<a class="cancle-btn" onclick="fnCloseWin()">取消</a>
</div>
</form>
</div>
<div id="password_mask" class="login_mask_content">
<div class="mask_title">重置密码</div>
<form method="post" class="password_form" id="password_subform" >
<div class="inputs phone">
<span><i>*</i>手 机 号</span>
<input type="text" id="phone1" name="phone" onChange="validIdTel1()" placeholder="请输入手机号!">
</div>
<div class="inputs validCode">
<span><i>*</i>验 证 码</span>
<input type="text" id="validCode1" placeholder="请输入短信验证码!" style="width: 144px;">
<a class="send-btn" href="javascript:;" onclick="sendCode(this,2)">发送验证码</a>
</div>
<div class="inputs idcard">
<span><i>*</i>身份证号码</span>
<input type="text" id="idcard1" onChange="validIdcard1(this)" placeholder="请输入身份证号码!">
</div>
<div class="inputs username">
<span><i>*</i>姓 名</span>
<input type="text" id="username1" name="username" placeholder="请输入姓名!">
</div>
<div class="inputs yac005" style="display:none;">
<span><i>*</i>社保 卡号</span>
<input type="text" id="yac005" name="yac005" placeholder="请输入社保卡号!">
</div>
<div class="inputs psw">
<span><i>*</i>新 密 码</span>
<input type="password" id="new_psw" name="password" placeholder="请输入新密码!">
</div>
<div class="inputs new-psw">
<span><i>*</i>确认新密码</span>
<input type="password" id="new_psw_confirm" name="password" placeholder="请输入确认新密码!" onChange="validPwd1(this)">
</div>
<div class="inputs tips"><a class="toLogin-btn" onclick="fnChangeToLoginWin()">返回登录</a></div>
<div class="btn-content">
<a class="login-btn" id="changePsw_btn" onclick="fnChangePsw()">重置密码</a>
<a class="cancle-btn" onclick="fnCloseWin()">取消</a>
</div>
</form>
</div>
<script type="text/javascript">
$(function(){
//捕获回车键
$('html').bind('keydown',function(e){
if(e.keyCode==13){
var login_flag = $("#login_mask").is(':visible');
var register_flag = $("#regist_mask").is(':visible');
if(login_flag){
login();
}else if(register_flag){
fnRegister();
}else{
fnChangePsw();
}
}
});
});
//切换到登录界面
function fnChangeToLoginWin(){
$("#mask").show();
$("#regist_mask").hide();
$("#password_mask").hide();
$("#login_mask").show();
}
//打开登录弹框
function fnOpenLoginWin(zpType,menuid){
$("#menuid").val(menuid);
$("#mask").show();
$("#regist_mask").hide();
$("#password_mask").hide();
$("#login_mask").show();
}
//打开注册界面
function fnOpenRegistWin(){
$("#mask").show();
$("#login_mask").hide();
$("#password_mask").hide();
$("#regist_mask").show();
}
//打开修改密码界面
function fnOpenPsdWin(){
$("#login_mask").hide();
$("#regist_mask").hide();
$("#password_mask").show();
}
//关闭弹框
function fnCloseWin(){
$("#mask").hide();
$("#login_mask").hide();
$("#regist_mask").hide();
$("#password_mask").hide();
window.location.reload()
}
//刷新验证码
function refeshCode() {
document.getElementById("codeimg").src = "${rootpath}/CaptchaImg?j="+ Math.random();
}
var timer = 60;
var clock = '';
var btn;
//发送验证码
function sendCode(obj,type){
btn = $(obj);
if(btn.hasClass("btn-disabled")){
return;
}
var tel = "";
if(type == 1){
tel = $("#tel").val();
}else{
tel = $("#phone1").val();
}
if(tel==''||tel==null){
Netof.alertBox("手机号不能为空!");
$("#tel").focus();
return;
}
btn.addClass("btn-disabled");
btn.text(timer + "秒后重试");
clock = setInterval(doLoop,1000);
$.ajax({
"url":"${rootpath}/wtqt/memberCtroller/sendCode.jspx",
"async":true,
"data":{"phone":tel},
"success":function(data){
if(data.fieldData.code = "1"){
Netof.alertMsgTopTip("发送短信成功!");
}else{
Netof.alertMsgTopTip("发送短信失败!");
}
},
"error":function(data){
},
"type":"POST",
"dataType":"json"
});
}
function doLoop(){
timer--;
if (timer > 0) {
btn.text(timer + "秒后重试");
}else{
clearInterval(clock);
btn.removeClass("btn-disabled");
btn.text("发送验证码");
timer = 60;//重置时间
}
}
</script>
<!--登录js-->
<script type="text/javascript">
//登录注册之前个人基本信息校验2018-02-01
function validateBefore(flag,username){
var str = false;
if(flag==1){ //手机号
$.ajax({
"url":"${rootpath}/wtqt/memberCtroller/queryIdcard.jspx",
"async":false,
"data":{"username":username},
"type":"POST",
"dataType":"json",
"success":function(data){
console.log(data);
if(data.success){
$.ajax({
"url":"${rootpath}/xtpt/businessController/getDataNoLogin.jspx",
"async":false,
"data":{"aac002":data.fieldData.aac002,"fwid":"HBSIZB10011"},
"type":"POST",
"dataType":"json",
"success":function(data2){
if(data2.success){
if(data2.lists){
if(data2.lists.resultset.list.length==1){//数据正常可以登录
str = true;
}else{
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
}else{//数据有误
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
}else{
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
},
"error":function(data){
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
});
}else{
Netof.alertBox(data.resultMessage.message);
}
},
"error":function(data){
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
});
}else{
$.ajax({
"url":"${rootpath}/xtpt/businessController/getDataNoLogin.jspx",
"async":false,
"data":{"aac002":username,"fwid":"HBSIZB10011"},
"type":"POST",
"dataType":"json",
"success":function(data2){
console.log(data2);
if(data2.success){
if(data2.lists){
if(data2.lists.resultset.list.length==1){
if(data2.lists.resultset.list[0].cn=="1"){//数据正常可以登录
str = true;
}else{
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
}else{
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
}else{//数据有误
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
}else{
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
},
"error":function(data){
Netof.alertBox("请到社保大厅三楼核实个人基本资料");
}
});
}
return str;
}
var aab005="";
var RSAkey=getPublicKey();
//执行登录方法
function login(){
var key=AESUtils.getKey();
var zplb = "2017001";
var menuid=$("#menuid").val();
var fwid=$("#fwid").val();
var username=$("#username").val();
var password=$("#password").val();
var captcha="";
var captcha_dw=$("#captcha_dw").val();
var captcha_gr=$("#captcha_gr").val();
if(username==''||username==null){
Netof.alertBox("用户名不能为空!");
$("#username").focus();
return;
}
if(password==''||password==null){
Netof.alertBox("请先输入密码!");
$("#captcha").focus();
return;
}
var loginid_type='';
var usertype = "个人用户";
if(usertype=="个人用户"){
if(captcha_gr==''||captcha_gr==null){
Netof.alertBox("请输入图形验证码!");
$("#password").focus();
return;
}
captcha=captcha_gr;
var partten = /^1[3,5,4,7,8]\d{9}$/;
if (partten.test(username)) {
loginid_type='tel';
}else{
loginid_type='idcard';
}
usertype="aac001";
}
logining(true);
var cFlag = false;
if(loginid_type=="tel"){
cFlag=validateBefore(1,username);
}else{
cFlag=validateBefore(2,username);
}
if(!cFlag){
logining(false);
return;
}
var parameter = "username="+(username.length>0?RSAUtils.encryptedString(RSAkey,decodeURIComponent(username)) :"")+"&password="+(password.length>0?RSAUtils.encryptedString(RSAkey,decodeURIComponent(password)) :"")+"&checkCode="+captcha+"&loginidtype="+loginid_type+"&zplb="+zplb;
$.ajax({
"url":"${rootpath}/wtqt/memberCtroller/loginNew.jhtml",
"async":true,
"data":parameter,
"success":function(data, textStatus, jqXHR){
//console.log(data);
var sjcode=data.fieldData.code;
if(sjcode=="1"){
if(menuid == "123740"){
window.open("${rootpath}/hbsyldyzm/index.jhtml");
}else if(menuid == "123741"){
window.open("${rootpath}/hbsylbxlncbjfzm/index.jhtml");
}else if(menuid == "123742"){
window.open("${rootpath}/jxylbxgxtzd/index.jhtml");
}else if(menuid == "123743"){
window.open("${rootpath}/jbylbxcbjfpz/index.jhtml");
}else if(menuid == "123744"){
window.open("${rootpath}/hbsshbxcbzm(grzy)/index.jhtml");
}else if(menuid == "123745"){
window.open("${rootpath}/hbsshbxcbzm/index.jhtml");
}else if(menuid == "123746"){
window.open("${rootpath}/ndylbxgrqyjld/index.jhtml");
}
window.location.reload();
}else{
var message=data.resultMessage.message;
Netof.alertBox(message);
logining(false);
return;
}
},
"error":function(data, textStatus, jqXHR){
Netof.alertBox("请刷新页面重试!");
Netof.hideMask();
return;
},
"complete":function(_XMLHTTPRequest,textStatus){
return ;
},
"type":"POST",
"dataType":"json"
});
}
//登录中...
function logining(allow){
//改变背景色和字
if (allow) {
$("#login_btn").css({'background-color':'#ddd',"cursor":"not-allowed","border":"none"}).text("登录中...").attr("onclick","");
}
else{
$("#login_btn").css({'background-color':'#3B84E2',"cursor":"pointer"}).text("登录").attr("onclick","login()");
}
}
function getPublicKey(){
var RSAkey;
var param={
}
$.ajax({
"url":"${rootpath}/getRSAKey.jspx",
"async":false,
"data":param,
"success":function(data, textStatus, jqXHR){
if(!data.success){
return ;
}
var publicKeyExponent=data.fieldData.publicKeyExponent;
var publicKeyModulus=data.fieldData.publicKeyModulus;
RSAkey=new RSAUtils.getKeyPair(publicKeyExponent, "", publicKeyModulus);//生成rsa公钥
},
"error":function(data, textStatus, jqXHR){
return;
},
"complete":function(_XMLHTTPRequest,textStatus){
return ;
},
"type":"POST",
"dataType":"json"
});
return RSAkey;
}
</script>
<!--注册js-->
<script type="text/javascript">
//身份证验证
function validIdcard(){
var idcard = $("#idcard").val();
if(idcard.trim()==""){
Netof.alertBox("身份证不能为空");
Netof.setValue("idcard","");
$("#idcard").focus();
return;
}
if(validataIdcard(idcard,"idcard")){//如果身份证合法,则校验是否已经注册
Netof.submit("","${rootpath}/wtqt/memberCtroller/checkUserExit.jhtml",{"code":idcard},"",function(data){
if(data.fieldData.code=="1"){
pass = true;
var flag = validateBefore(2,idcard);
if(!flag){
Netof.setValue("idcard","");
$("#idcard").focus();
}
}else{
Netof.alertBox("对不起,你输入的身份证号:"+idcard+"已经注册");
Netof.setValue("idcard","");
$("#idcard").focus();
pass = false;
}
},null,null,null,null,null,true);
}
}
//电话号码验证
function validTel(){
var _cell = $('#tel').val();
var partten = /^1[3,5,4,7,8]\d{9}$/;
if(partten.test(_cell)) {
var pass;
Netof.submit("","${rootpath}/wtqt/memberCtroller/checkUserExit.jhtml",{"username":_cell},"",function(data){
if(data.fieldData.code=="1"){
pass = true;
}else{
Netof.alertBox("对不起,你输入的手机号:"+_cell+"已经注册");
Netof.setValue("tel","");
$("#tel").focus();
pass = false;
}
},null,null,null,null,null,true);
return pass;
}else{
Netof.alertBox("请输入正确的手机号","","warn");
$('#tel').val("");
return false;
}
}
//邮箱验证
function validEmail(){
var _email = $("#email").val();
var _filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(_filter.test(_email)){
return true;
}else{
Netof.alertBox("请输入正确邮箱","","warn");
Netof.setValue("email","");
return false;
}
}
//密码验证
function validPwd(obj){
var _id = $(obj).id;
var _pwd = $('#pwd').val();
var _pwd_c = $('#pwd_confirm').val();
if(_pwd != _pwd_c){
Netof.alertBox("两次输入的密码不一致","","warn");
return false;
}else{
return true;
}
}
//重复密码是否相同验证
function validPwd_c(){
var _pwd = $('.input_pwd input').val();
var _confirm_pwd = $('.confirm_pwd input').val();
if (_pwd==_confirm_pwd){
return true;
}else{
Netof.alertBox("两次输入的密码不一致","","warn");
return false;
}
}
//用户注册
function fnRegister(){
var tel = $("#tel").val();
var idcard = $("#idcard").val();
var name = $("#name").val();
var email = $("#email").val();
var password = $("#pwd").val();
var password_c = $("#pwd_confirm").val();
var validCode = $("#validCode").val();
if(idcard.trim() == ""){
Netof.alertBox('身份证号不能为空!','','warn');
return;
}
if(name.trim() == ""){
Netof.alertBox('姓名不能为空!','','warn');
return;
}
if(tel.trim() == ""){
Netof.alertBox('手机号码不能为空!','','warn');
return;
}
if(validCode.trim() == ""){
Netof.alertBox("请输入短信验证码!","","warn");
return;
}
if(password.trim() == ""){
Netof.alertBox('密码不能为空!','','warn');
return;
}
if(password_c.trim() == ""){
Netof.alertBox('请输入确认密码!','','warn');
return;
}
if(password.trim() != password_c.trim()){
Netof.alertBox('两次输入的密码不一致!','','warn');
return;
}
var parm = {"tel":tel,"validCode":validCode,"email":email,"password":password,"aac002":idcard,"aac003":name,"isfrom":"1"};
//交验个人身份是否在参保
$.ajax({
"url":"${rootpath}/xtpt/businessController/getDataNoLogin.jhtml",
"async":true,
"data":{"fwid":"HBSIZM1001","aac002":idcard,"aac003":name},
"success":function(data){
console.log(data);
if(!data.lists){//如果不参保提示不能注册
//Netof.alertBox("抱歉,查询不到您的个人信息,暂时无法注册!");
Netof.alertBox("身份信息有误,请持身份证到省直业务大厅核实!");
return;
}else{
//注册
$.ajax({
"url":"${rootpath}/wtqt/memberCtroller/personRegister.jhtml",
"async":true,
"data":parm,
"success":function(data){
console.log(data);
if(data.success){
$("#userid").val(data.fieldData.userid);
Netof.alertBox("恭喜!注册成功是否马上登陆?","confirm","success",fnChangeToLoginWin,fnCloseWin,"去登陆","取消");
}else{
Netof.alertBox(data.resultMessage.message);
return;
}
},
"error":function(data){
Netof.alertBox("请核实个人基本资料!");
return;
},
"type":"POST",
"dataType":"json"
});
}
},
"error":function(data){
Netof.alertBox("请到核实个人基本资料!");
},
"type":"POST",
"dataType":"json"
});
}
//身份证验证
function validIdcard1(){
var idcard1 = $("#idcard1").val();//$(obj).val();
if(idcard1.trim()==""){
Netof.alertBox("身份证不能为空");
return;
}
if(validataIdcard(idcard1,"idcard1")){//如果身份证合法,则校验是否已经注册
$.ajax({
"url":"${rootpath}/wtqt/memberCtroller/checkRegIdcard.jspx",
"async":true,
"data":{"idcard":idcard1},
"success":function(data){
if(!data.success){
Netof.alertBox("对不起,你输入的身份证号未注册,请前往注册!");
}
},
"error":function(data){
},
"type":"POST",
"dataType":"json"
});
}
}
function validIdTel1(){
var _cell = $('#phone1').val();
var partten = /^1[3,5,4,7,8]\d{9}$/;
if(partten.test(_cell)) {
$.ajax({
"url":"${rootpath}/wtqt/memberCtroller/checkUserExit.jhtml",
"async":true,
"data":{"username":_cell},
"success":function(data){
console.log(data);
if(data.fieldData.code=="1"){
Netof.alertBox("对不起,你输入的手机号:"+_cell+"暂未注册");
Netof.setValue("phone1","");
$("#phone1").focus();
}
},
"error":function(data){
},
"type":"POST",
"dataType":"json"
});
}else{
Netof.alertBox("请输入正确的手机号","","warn");
Netof.setValue("phone1","");
$("#phone1").focus();
return false;
}
}
//邮箱验证
function validEmail1(){
var _email = $("#email1").val();
var _filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(_filter.test(_email)){
return true;
}else{
Netof.alertBox("请输入正确邮箱","","warn");
Netof.setValue("email1","");
return false;
}
}
//密码验证
function validPwd1(obj){
var _id = $(obj).id;
var _pwd = $('#new_psw').val();
var _pwd_c = $('#new_psw_confirm').val();
if(_pwd != _pwd_c){
Netof.alertBox("两次输入的密码不一致","","warn");
return false;
}else{
return true;
}
}
//重复密码是否相同验证
function validPwd_c(){
var _pwd = $('.input_pwd input').val();
var _confirm_pwd = $('.confirm_pwd input').val();
if (_pwd==_confirm_pwd){
return true;
}else{
Netof.alertBox("两次输入的密码不一致","","warn");
return false;
}
}
//重置密码
function fnChangePsw(){
var idcard = $("#idcard1").val();//身份证号码
var name = $("#username1").val();//姓名
var phone = $("#phone1").val();//手机号码
var vcode = $("#validCode1").val();//验证码
var yac005 = $("#yac005").val();//社保卡号
var email = $("#email1").val();//电子邮箱
var new_psw = $("#new_psw").val();//新密码
var new_psw_confirm = $("#new_psw_confirm").val();//确认新密码
var arr = new Array();
if(idcard.trim() == ""){
Netof.alertBox('身份证号不能为空!','','warn');
return;
}
if(name.trim() == ""){
Netof.alertBox('姓名不能为空!','','warn');
return;
}
if(phone.trim() == ""){
Netof.alertBox('手机号码不能为空!','','warn');
return;
}
if(vcode.trim() == ""){
Netof.alertBox('验证码不能为空!','','warn');
return;
}
if(new_psw.trim() == ""){
Netof.alertBox('新密码不能为空!','','warn');
return;
}
if(new_psw_confirm.trim() == ""){
Netof.alertBox('确认新密码不能为空!','','warn');
return;
}
if(new_psw.trim() != new_psw_confirm.trim()){
Netof.alertBox('两次输入的密码不一致!','','warn');
return;
}
var myparam = {"aac002":idcard,"aac003":name,"tel":phone,"email":email,"yac005":yac005};
arr.push(myparam);
Netof.submit("","${rootpath}/xtpt/businessController/getDataNoLogin.jhtml",{"fwid":"JYUSER1007","newpassword":new_psw,"vcode":vcode,"list":JSON.stringify(arr)},null,function(data){
if(data.fieldData.code=="1"){
Netof.alertBox("密码修改成功!","","success");
$("#password_mask").hide();
$("#mask").hide();
}else{
Netof.alertBox('您的验证码错误!','','warn');
}
},function(data){
Netof.alertBox(data.resultMessage.message);
});
}
</script>
登录注册之前个人基本信息校验
最新推荐文章于 2018-11-07 21:53:44 发布