var UserCenter = {}; var psSmsBtn = $("#ps_sms_btn"); var persionCountDown = 0; UserCenter.changeBasic = function() { var name = $("#tab-1").find("input[name='name']").val(); var sex = $("#tab-1").find("select[name='sex']").val(); var idCard = $("#tab-1").find("input[name='idCard']").val(); var address = $("#tab-1").find("input[name='address']").val(); var email = $("#tab-1").find("input[name='email']").val(); if (name==null || name=='') { Feng.info("请填写姓名!"); return; } if (sex==null || sex=='') { Feng.info("请选择性别!"); return; } if (idCard==null || idCard=='') { Feng.info("请填写身份证号!"); return; } var da = {"name":name, "sex":sex, "idCard":idCard, "address":address, "email":email}; var ajax = new $ax(Feng.ctxPath + "/api/personalUser/changeBasic", function(data){ Feng.info(data.msg); },function(data){ Feng.error("操作失败!" + data.responseJSON.message + "!"); }); ajax.set(da); ajax.start(); }; UserCenter.changePwd = function() { var password = $("#tab-2").find("input[name='password']").val(); var newPassword = $("#tab-2").find("input[name='newPassword']").val(); var newRePassword = $("#tab-2").find("input[name='newRePassword']").val(); if (password==null || password=='') { Feng.info("请填写原密码!"); return; } if (newPassword==null || newPassword=='') { Feng.info("请填写新密码!"); return; } if (newRePassword==null || newRePassword=='') { Feng.info("请填写重复新密码!"); return; } if (newPassword != newRePassword) { Feng.info("两次输入的新密码不一致!"); return; } var da = {"password":password, "newPassword":newPassword, "newRePassword":newRePassword}; var ajax = new $ax(Feng.ctxPath + "/api/personalUser/changePwd", function(data){ Feng.info(data.msg); if (data.code == 200) { $("#password").val(""); $("#newPassword").val(""); $("#newRePassword").val(""); } },function(data){ Feng.error("操作失败!" + data.responseJSON.message + "!"); }); ajax.set(da); ajax.start(); }; UserCenter.changePhone = function() { var phone = $("#tab-3").find("input[name='phone']").val(); var verificationCode = $("#tab-3").find("input[name='verificationCode']").val(); var newPhone = $("#tab-3").find("input[name='newPhone']").val(); if (phone==null || phone=='') { Feng.info("当前号码不能为空!"); return; } if (verificationCode==null || verificationCode=='') { Feng.info("请填写验证码!"); return; } if (newPhone==null || newPhone=='') { Feng.info("请填写新号码!"); return; } var da = {"phone":phone, "verificationCode":verificationCode, "newPhone":newPhone}; var ajax = new $ax(Feng.ctxPath + "/api/personalUser/changePhone", function(data){ Feng.info(data.msg); if (data.code == 200) { $("#tab-1").find("input[name='phone']").val(newPhone); $("#tab-3").find("input[name='phone']").val(newPhone); $("#tab-3").find("input[name='verificationCode']").val(""); $("#tab-3").find("input[name='newPhone']").val(""); } },function(data){ Feng.error("操作失败!" + data.responseJSON.message + "!"); }); ajax.set(da); ajax.start(); }; UserCenter.getVerificationCode = function(context) { var phone = $("#phone").val(); if (phone==null || phone=='') { Feng.info("电话号码不存在!"); return; } phone = $.trim(phone); if (!Feng.checkMobilePhoneNum(phone)) { Feng.info("手机号格式有误!"); return; } UserCenter.personBtnCountDown(context); var da = {"phone":phone, "type":'2'}; var ajax = new $ax(Feng.ctxPath + "/api/common/verificationCode", function(data){ Feng.info(data.msg); },function(data){ Feng.error("操作失败!" + data.responseJSON.message + "!"); }); ajax.set(da); ajax.start(); }; UserCenter.personBtnCountDown = function(context) { if (persionCountDown == 0) { persionCountDown = 60; } else if (persionCountDown == 1) { $(context).removeAttr("disabled"); $(context).html("获取验证码"); persionCountDown = 0; return; } $(context).attr("disabled", true); $(context).html(persionCountDown + "秒"); persionCountDown--; setTimeout("UserCenter.personBtnCountDown()", 1000); }; UserCenter.bindJcAccount = function(){ var username = $("#username").val(); var password = $("#jcPassword").val(); var verificationCode = $("#verificationCode").val(); if(username == null || username == ''){ Feng.info("聚才网账号不能为空");return ; } if(password == null || password == ''){ Feng.info("聚才网账号密码不能为空");return ; } if(verificationCode == null || verificationCode == ''){ Feng.info("验证码不能为空");return ; } var ajax = new $ax(Feng.ctxPath + "/api/jucaiInterface/bindAccount", function(data){ Feng.info(data.msg); },function(data){ Feng.error("操作失败!" + data.responseJSON.message + "!"); }); ajax.setData({"userType":2,"username":username,"password":password,"verificationCode":verificationCode}) ajax.start(); } $(function() { var sexTemp = $("#sexTemp").val(); if (sexTemp!=null && sexTemp!='') { $("#sex").val(sexTemp); } });