123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454 |
- var Register = {
- registData: {},
- validateFields: {
- username: {validators: {notEmpty: {message: '登录账号不能为空'}}},
- name: {validators: {notEmpty: {message: '单位名称不能为空'}}},
- idCard: {validators: {notEmpty: {message: '社会信用代码不能为空'}}},
- agentName: {validators: {notEmpty: {message: '经办人不能为空'}}},
- agentPhone: {
- validators: {
- notEmpty: {
- message: '经办人手机号不能为空'
- }, regexp: {
- regexp: /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/,
- message: "经办人手机号格式不合法"
- }
- }
- },
- verificationCode: {validators: {notEmpty: {message: '手机验证码不能为空'}}},
- legal: {validators: {notEmpty: {message: '法人代表不能为空'}}},
- street: {validators: {notEmpty: {message: '所属街道不能为空'}}},
- address: {validators: {notEmpty: {message: '单位地址不能为空'}}},
- ephone: {
- validators: {
- notEmpty: {
- message: '单位电话不能为空'
- }, regexp: {
- regexp: /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/,
- message: "单位电话格式不合法"
- }
- }
- },
- agentEmail: {
- validators: {
- notEmpty: {
- message: '电子邮箱不能为空'
- },
- regexp: {
- regexp: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
- message: "电子邮箱格式不正确"
- }
- }
- }
- }
- };
- var enterpriseCountDown = 0;
- var enterpriseSmsBtn = $("#enterprise_sms_btn");
- var persionCountDown = 0;
- var psSmsBtn = $("#ps_sms_btn");
- var lock = false;
- Register.addSubmit = function() {
- var regType = $(".active").attr("regType");
- if (regType == "en") { //企业用户注册
- Register.enterpriseUserRegister();
- } else if (regType == "ps") { //个人用户注册
- Register.personUserRegister();
- }
- };
- /**
- * 验证数据
- */
- Register.validate = function () {
- $('#ep_form').data("bootstrapValidator").resetForm();
- $('#ep_form').bootstrapValidator('validate');
- return $("#ep_form").data('bootstrapValidator').isValid();
- }
- var isDis = false;
- Register.enterpriseUserRegister = function() {
- if(!Register.validate()){
- return ;
- }
- isDis = $("#type").prop("disabled");
- var source = $("#source").val();
- var username = $("#username").val();
- var password = $("#password").val();
- var rePassword = $("#re_password").val();
- var name = $("#name").val();
- var idCard = $("#idCard").val();
- var agentName = $("#agentName").val();
- var agentPhone = $("#agentPhone").val();
- var verificationCode = $("#verificationCode").val();
- var legal = $("#legal").val();
- var street = $("#street").val();
- var address = $("#address").val();
- if(isDis){
- $("#type").removeAttr("disabled");
- }
- var type = $("#type").val();
- var agentEmail = $("#agentEmail").val();
- var talentType = $("#talentType").val();
- var ephone = $("#ephone").val();
- var industryField = $("#industryField").val();
- if (username==null || username=='') {
- Feng.info("请填写账号!");
- return;
- }
- if (username.length > 50) {
- Feng.info("账号最多50个字符!");
- return;
- }
- if(source != 2){
- if (password==null || password=='') {
- Feng.info("请填写密码!");
- return;
- }
- if (!/^(?=.*\d)(?=.*[a-zA-Z]).{8,20}$/.test(password)){
- Feng.info("密码格式错误,密码由字母、数字及特殊字符且8-20个字符组成!");
- return;
- }
- if (rePassword==null || rePassword=='') {
- Feng.info("请填写重复密码!");
- return;
- }
- if (password != rePassword) {
- Feng.info("两次密码填写不一致!");
- return;
- }
- }
- if (name==null || name=='') {
- Feng.info("请填写单位名称!");
- return;
- }
- if (name.length > 100) {
- Feng.info("单位名称最多100个字符!");
- return;
- }
- if (idCard==null || idCard=='') {
- Feng.info("请填写社会信用代码!");
- return;
- }
- if (type==null || type=='') {
- Feng.info("请选择申报类型!");
- return;
- }
- if (idCard.length > 40) {
- Feng.info("社会信用代码最多40个字符!");
- return;
- }
- if (agentName==null || agentName=='') {
- Feng.info("请填写经办人!");
- return;
- }
- if (agentName.length > 30) {
- Feng.info("经办人最多30个字符!");
- return;
- }
- if (agentPhone==null || agentPhone=='') {
- Feng.info("请填写经办人电话!");
- return;
- }
- if(ephone == null || ephone==''){
- Feng.info("请填写单位电话");
- return;
- }
- if (verificationCode==null || verificationCode=='') {
- Feng.info("请填写手机验证码!");
- return;
- }
- if (legal==null || legal=='') {
- Feng.info("请填写法人代表!");
- return;
- }
- if (street==null || street=='') {
- Feng.info("请选择所属街道!");
- return;
- }
- if (address==null || address=='') {
- Feng.info("请填写单位地址!");
- return;
- }
- if(type==null || type==''){
- Feng.info("请选择企业类别");
- return ;
- }
- if (agentEmail==null || agentEmail=='') {
- Feng.info("请填写电子邮箱!");
- return;
- }
- if(type==1 ){
- if(talentType==null||talentType==''){
- Feng.info("请选择企业标签!");
- return;
- }
- if(industryField == null || industryField ==''){
- Feng.info("请选择行业领域");
- return ;
- }
- }
- var x=document.getElementById("imgurl").value;
- if(x==""){
- Feng.info("请上传营业执照照片!");
- return;
- }
- if(!/((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(ephone)){
- Feng.info("单位电话格式不合法!");
- return;
- }
- if(!/((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(agentPhone)){
- Feng.info("经办人电话格式不合法!");
- return;
- }
- if(!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)){
- Feng.info("电子邮箱格式不合法!");
- return;
- }
- if(!lock){
- lock = true;
- }else{
- Feng.info("不能重复点击");
- return;
- }
- $("#ep_form")[0].submit();
- };
- Register.personUserRegister = function() {
- var source = $("#ps_source").val();
- var username = $("#ps_username").val();
- var password = $("#ps_password").val();
- var rePassword = $("#ps_re_password").val();
- var name = $("#ps_name").val();
- var sex = $("#ps_sex").val();
- var idCard = $("#ps_idCard").val();
- var phone = $("#ps_phone").val();
- var verificationCode = $("#ps_verificationCode").val();
- if (username==null || username=='') {
- Feng.info("请填写账号!");
- return;
- }
- if (username.length > 50) {
- Feng.info("账号最多20个字符!");
- return;
- }
- if(source !=2 ){
- if (password==null || password=='') {
- Feng.info("请填写密码!");
- return;
- }
- if (rePassword==null || rePassword=='') {
- Feng.info("请填写重复密码!");
- return;
- }
- if (password != rePassword) {
- Feng.info("两次密码填写不一致!");
- return;
- }
- }
- if (name==null || name=='') {
- Feng.info("请填写姓名!");
- return;
- }
- if (name.length > 20) {
- Feng.info("姓名最多20个字符!");
- return;
- }
- if (sex==null || sex=='') {
- Feng.info("请选择性别!");
- return;
- }
- if (idCard==null || idCard=='') {
- Feng.info("请填写身份证号!");
- return;
- }
- if (phone==null || phone=='') {
- Feng.info("请填写手机号!");
- return;
- }
- if (verificationCode==null || verificationCode=='') {
- Feng.info("请填写手机验证码!")
- return;
- }
- if(!/0?(13|14|15|17|18|19)[0-9]{9}/.test(phone)){
- Feng.info("手机号格式不合法!");
- return;
- }
- var da = {"source":source,"username":username, "password":password, "name":name, "sex":sex, "idCard":idCard, "phone":phone, "verificationCode":verificationCode};
- var ajax = new $ax(Feng.ctxPath + "/api/personalUser/register", function(data){
- Feng.info(data.msg);
- if (data.code == 200) {
- parent.layer.close(window.parent.Login.layerIndex);
- }
- },function(data){
- Feng.error("操作失败!" + data.responseJSON.message + "!");
- });
- ajax.set(da);
- ajax.start();
- };
- Register.getEnterpriseSms = function() {
- var agentPhone = $("#agentPhone").val();
- if (agentPhone==null || agentPhone=="") {
- Feng.info("请填写经办人手机号!");
- return;
- }
- agentPhone = $.trim(agentPhone);
- if (!Feng.checkMobilePhoneNum(agentPhone)) {
- Feng.info("手机号格式有误,请填写正确的手机号码!");
- return;
- }
- Register.enterpriseBtnCountDown();
- var ajax = new $ax(Feng.ctxPath + "/common/api/verificationCode?phone="+agentPhone+"&type=1", function(data){
- Feng.info(data.msg);
- },function(data){
- Feng.error("操作失败!" + data.responseJSON.message + "!");
- });
- ajax.set(null);
- ajax.start();
- };
- Register.enterpriseBtnCountDown = function() {
- if (enterpriseCountDown == 0) {
- enterpriseCountDown = 60;
- } else if (enterpriseCountDown == 1) {
- enterpriseSmsBtn.removeAttr("disabled");
- enterpriseSmsBtn.html("获取验证码");
- enterpriseCountDown = 0;
- return;
- }
- enterpriseSmsBtn.attr("disabled", true);
- enterpriseSmsBtn.html(enterpriseCountDown + "秒");
- enterpriseCountDown--;
- setTimeout("Register.enterpriseBtnCountDown()", 1000);
- };
- Register.getPersionSms = function() {
- var phone = $("#ps_phone").val();
- if (phone==null || phone=="") {
- Feng.info("请填写手机号!");
- return;
- }
- phone = $.trim(phone);
- if (!Feng.checkMobilePhoneNum(phone)) {
- Feng.info("手机号格式有误,请填写正确的手机号码!");
- return;
- }
- Register.getPersionBtnCountDown();
- var ajax = new $ax(Feng.ctxPath + "/common/api/verificationCode?phone="+phone+"&type=1", function(data){
- Feng.info(data.msg);
- },function(data){
- Feng.error("操作失败!" + data.responseJSON.message + "!");
- });
- ajax.set(null);
- ajax.start();
- };
- Register.getPersionBtnCountDown = function() {
- if (persionCountDown == 0) {
- persionCountDown = 60;
- } else if (persionCountDown == 1) {
- psSmsBtn.removeAttr("disabled");
- psSmsBtn.html("获取验证码");
- persionCountDown = 0;
- return;
- }
- psSmsBtn.attr("disabled", true);
- psSmsBtn.html(persionCountDown + "秒");
- persionCountDown--;
- setTimeout("Register.getPersionBtnCountDown()", 1000);
- };
- /**
- * 企业用户注册回调
- */
- Register.epCallBack = function(data) {
- lock = false;
- var nowDis = $("#type").prop("disabled");
- if(isDis!=nowDis){
- $("#type").attr("disabled","disabled");
- }
- Feng.info(data.msg);
- if (data.code == 200) {
- parent.layer.close(window.parent.Login.layerIndex);
- }
- };
- Register.typeChange = function(){
- $("#type").removeAttr("disabled");
- var type = $("#type").val();
- if(type==1){
- $("#talentType,#industryField").parent().parent().attr("style","display:block");
- }else{
- $("#talentType,#industryField").val("");
- $("#talentType,#industryField").parent().parent().attr("style","display:none");
- }
- }
- $(function(){
- $('#ep_form').bootstrapValidator({
- feedbackIcons: {
- valid: 'glyphicon glyphicon-ok',
- invalid: 'glyphicon glyphicon-remove',
- validating: 'glyphicon glyphicon-refresh'
- },
- group:'.rowGroup',
- fields: Register.validateFields,
- live: 'enabled',
- message: '该字段不能为空'
- });
- var userType = Feng.getUrlValue("userType");
- var username = Feng.getUrlValue("username");
- var name = Feng.getUrlValue("name");
- var idCard = Feng.getUrlValue("idCard");
- var type = Feng.getUrlValue("type");
- if(userType == 1){ //企业用户trigger
- $("#source").val(2);
- $("#username").val(username).attr("readonly","readonly");
- $("#name").val(name).attr("readonly","readonly");
- $("#idCard").val(idCard).attr("readonly","readonly");
- $("#type").val(type).trigger("change");
- $("#type").attr("disabled","disabled");
- $("#password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
- $("#re_password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
- $("#personTab").css("pointer-events","none");
- } else if(userType == 2){ //个人用户
- $("#personTab").css("pointer-events","block");
- $("#personTab").children().click();
- $("#ps_source").val(2);
- $("#ps_username").val(name).attr("readonly","readonly");
- $("#ps_idCard").val(idCard).attr("readonly","readonly");
- $("#ps_password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
- $("#ps_re_password").val("").attr("placeholder","密码为聚才网账号密码").attr("readonly","readonly");
- $("#enTab").css("pointer-events","none");
- } else{ //无
- }
- var arr = [
- {"name":"street","code":"street"},
- {"name":"talentType","code":"enterprise_tag"},
- {"name":"industryField","code":"industry_field"}];
- Feng.findChildDictBatch(JSON.stringify(arr));
- $("#imgurl").change(function (e) {
- var tag = e.target;
- var file = tag.files[0];
- var imgSrc;
- var reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onload = function() {
- var src = $("#imgurl").val();
- var sn = src.lastIndexOf(".");
- var suffix = src.substring(sn+1,src.length);
- if(suffix == 'pdf' || suffix == 'PDF'){
- $("#photoImg").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
- }else{
- imgSrc = this.result;
- $("#photoImg").attr("src", imgSrc);
- }
- };
- });
- });
|