123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- var Register = {};
- var enterpriseCountDown = 0;
- var enterpriseSmsBtn = $("#enterprise_sms_btn");
- var persionCountDown = 0;
- var psSmsBtn = $("#ps_sms_btn");
- Register.enterpriseUserRegister = function () {
- $("#agentPhone").removeAttr("disabled");
- var type = $("#type").val();
- var special = $("#special").val();
- var enterpriseTypeName = "学校";
- var idCardName = "统一社会信用代码";
- var username = $("#username").val();
- var name = $("#name").val();
- var idCard = $("#idCard").val();
- var legal = $("#legal").val();
- var province = $("#province").val();
- var city = $("#city").val();
- var county = $("#county").val();
- var address = $("#address").val();
- var ephone = $("#ephone").val();
- var agentName = $("#agentName").val();
- var agentPhone = $("#agentPhone").val();
- var agentEmail = $("#agentEmail").val();
- if (username == null || username == '') {
- Feng.info("请填写账号!");
- return;
- }
- if (username.length > 50) {
- Feng.info("账号最多50个字符!");
- return;
- }
- if (name == null || name == '') {
- Feng.info("请填写" + enterpriseTypeName + "名称!");
- return;
- }
- if (name.length > 100) {
- Feng.info(enterpriseTypeName + "名称最多100个字符!");
- return;
- }
- if (idCard == null || idCard == '') {
- Feng.info("请填写" + idCardName + "!");
- return;
- }
- if (idCard.length > 40) {
- Feng.info(idCardName + "最多40个字符!");
- return;
- }
- if (legal == null || legal == '') {
- Feng.info("请填写法人代表!");
- return;
- }
- if (ephone == null || ephone == '') {
- Feng.info("请填写" + enterpriseTypeName + "电话");
- return;
- }
- if (province == null || province == '') {
- Feng.info("请选择" + enterpriseTypeName + "所在省份!");
- return;
- }
- if (city == null || city == '') {
- Feng.info("请选择" + enterpriseTypeName + "所在市!");
- return;
- }
- if ((county == null || county == '') && $("#county option").length > 1 && !$("#county").val()) {
- Feng.info("请选择" + enterpriseTypeName + "所在县\区!");
- return;
- }
- if (address == null || address == '') {
- Feng.info("请填写" + enterpriseTypeName + "地址!");
- return;
- }
- if (agentName == null || agentName == '') {
- Feng.info("请填写人才联络员!");
- return;
- }
- if (agentName.length > 30) {
- Feng.info("人才联络员最多30个字符!");
- return;
- }
- if (agentPhone == null || agentPhone == '') {
- Feng.info("请填写人才联络员电话!");
- return;
- }
- if (agentEmail == null || agentEmail == '') {
- 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(enterpriseTypeName + "电话格式不合法!");
- 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;
- }
- $("#ep_form")[0].submit();
- };
- /**
- * 企业用户注册回调
- */
- Register.epCallBack = function (data) {
- $("#agentPhone").prop("disabled", true);
- Feng.info(data.msg);
- if (data.code == 200) {
- setInterval(function () {
- window.location.href = Feng.ctxPath + "/";
- }, 3000);
- }
- };
- $("#imgurl,#bankImg,#beian,#domainImg,#typeImg").change(function (e) {
- var that = this;
- if (!Feng.chkFileInvalid(that.files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "只允许上传PDF或图片")) {
- return;
- }
- var file = that.files[0];
- var imgSrc;
- var reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onload = function () {
- if (Feng.isImg(file.type)) {
- imgSrc = this.result;
- $(that).prev("img").attr("src", imgSrc);
- } else {
- $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
- }
- };
- });
- Register.setFieldDisabled = function () {
- //注释注册驳回$("#ep_form :input").not("button").prop("disabled", true);
- var fields = $("#fields").val().split(",");
- for (var i in fields) {
- $("#" + fields[i]).removeAttr("disabled");
- }
- var files = $("#files").val().split(",");
- for (var i in files) {
- switch (files[i]) {
- case "imgurl":
- $("#imgurl").removeAttr("disabled");
- var html = $("#imgurl").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
- $("#imgurl").parent().find("label").html(html);
- break;
- case "bankImg":
- $("#bankImg").removeAttr("disabled");
- var html = $("#bankImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
- $("#bankImg").parent().find("label").html(html);
- break;
- case "domainImg":
- $("#domainImg").removeAttr("disabled");
- var html = $("#domainImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
- $("#domainImg").parent().find("label").html(html);
- break;
- case "typeImg":
- $("#typeImg").removeAttr("disabled");
- var html = $("#typeImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
- $("#typeImg").parent().find("label").html(html);
- break;
- case "beian":
- $("#beian").removeAttr("disabled");
- var html = $("#beian").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
- $("#beian").parent().find("label").html(html);
- break;
- }
- }
- }
- Register.afterSelectProvince = function () {
- var province = $("#province").val();
- $("#city").empty();
- $("#county").empty();
- if (province == null || province == '') {
- return;
- }
- Feng.addAjaxSelect({
- "id": "city",
- "displayCode": "code",
- "displayName": "name",
- "type": "GET",
- "url": Feng.ctxPath + "/common/tool/findCityByProvinceSelect/code/" + province
- });
- }
- /**
- * 加载县
- */
- Register.afterSelectCity = function () {
- var city = $("#city").val();
- $("#county").empty();
- if (city == null || city == '') {
- return;
- }
- Feng.addAjaxSelect({
- "id": "county",
- "displayCode": "code",
- "displayName": "name",
- "type": "GET",
- "url": Feng.ctxPath + "/common/tool/findCountyByCitySelect/code/" + city
- });
- }
- $(function () {
- //加载省份
- Feng.addAjaxSelect({
- "id": "province",
- "displayCode": "code",
- "displayName": "name",
- "type": "GET",
- "url": Feng.ctxPath + "/common/tool/getProvinceSelect"
- });
- $("select").each(function () {
- $(this).val($(this).attr("value"));
- $(this).trigger("change");
- });
- Register.setFieldDisabled();
- });
|