register.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. var Register = {
  2. registData: {},
  3. validateFields: {
  4. username: {validators: {notEmpty: {message: '登录账号不能为空'}}},
  5. name: {validators: {notEmpty: {message: '单位/企业名称不能为空'}, regexp: {regexp: /^([\u4E00-\u9FA5]|\(|\)|\(|\)){1,100}$/, message: "单位/企业名称只允许中文"}}},
  6. //idCard: {validators: {notEmpty: {message: '统一社会信用代码不能为空'}}},
  7. agentName: {validators: {notEmpty: {message: '人才联络员不能为空'}}},
  8. agentPhone: {
  9. validators: {
  10. notEmpty: {
  11. message: '人才联络员手机号不能为空'
  12. }, regexp: {
  13. 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})))$/,
  14. message: "人才联络员手机号格式不合法"
  15. }
  16. }
  17. },
  18. verificationCode: {validators: {notEmpty: {message: '手机验证码不能为空'}}},
  19. //legal: {validators: {notEmpty: {message: '法人代表不能为空'},regexp:{regexp:/^[\u4e00-\u9fa5]{1,50}$/,message:"法人代表只允许中文"}}},
  20. street: {validators: {notEmpty: {message: '所属街道不能为空'}}},
  21. address: {validators: {notEmpty: {message: '单位/企业地址不能为空'}}},
  22. ephone: {
  23. validators: {
  24. notEmpty: {
  25. message: '单位/企业电话不能为空'
  26. }, regexp: {
  27. 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})))$/,
  28. message: "单位/企业电话格式不合法"
  29. }
  30. }
  31. },
  32. agentEmail: {
  33. validators: {
  34. notEmpty: {
  35. message: '电子邮箱不能为空'
  36. },
  37. regexp: {
  38. regexp: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
  39. message: "电子邮箱格式不正确"
  40. }
  41. }
  42. },
  43. //bankCard: {validators: {notEmpty: {message: '企业银行账号不能为空'}}},
  44. //bankNetwork: {validators: {notEmpty: {message: '企业开户银行网点不能为空'}}},
  45. //bank: {validators: {notEmpty: {message: '企业开户银行不能为空'}}}
  46. },
  47. sy_validateFields: {
  48. username: {validators: {notEmpty: {message: '登录账号不能为空'}}},
  49. name: {validators: {notEmpty: {message: '单位名称不能为空'}, regexp: {regexp: /^[\u4e00-\u9fa5]{1,100}$/, message: "单位名称只允许中文"}}},
  50. agentName: {validators: {notEmpty: {message: '人才联络员不能为空'}}},
  51. agentPhone: {
  52. validators: {
  53. notEmpty: {
  54. message: '人才联络员手机号不能为空'
  55. }, regexp: {
  56. 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})))$/,
  57. message: "人才联络员手机号格式不合法"
  58. }
  59. }
  60. },
  61. verificationCode: {validators: {notEmpty: {message: '手机验证码不能为空'}}},
  62. street: {validators: {notEmpty: {message: '所属街道不能为空'}}},
  63. address: {validators: {notEmpty: {message: '单位地址不能为空'}}},
  64. ephone: {
  65. validators: {
  66. notEmpty: {
  67. message: '单位电话不能为空'
  68. }, regexp: {
  69. 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})))$/,
  70. message: "单位电话格式不合法"
  71. }
  72. }
  73. },
  74. agentEmail: {
  75. validators: {
  76. notEmpty: {
  77. message: '电子邮箱不能为空'
  78. },
  79. regexp: {
  80. regexp: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
  81. message: "电子邮箱格式不正确"
  82. }
  83. }
  84. }
  85. }
  86. };
  87. var enterpriseCountDown = 0;
  88. var enterpriseSmsBtn = $("#enterprise_sms_btn");
  89. var persionCountDown = 0;
  90. var psSmsBtn = $("#ps_sms_btn");
  91. var lock = false;
  92. Register.addSubmit = function () {
  93. var regType = $(".active").attr("regType");
  94. if (regType == "en") { //企业用户注册
  95. Register.enterpriseUserRegister();
  96. } else if (regType == "ps") { //个人用户注册
  97. Register.personUserRegister();
  98. }
  99. };
  100. /**
  101. * 验证数据
  102. */
  103. Register.validate = function () {
  104. $('#ep_form').data("bootstrapValidator").resetForm();
  105. $('#ep_form').bootstrapValidator('validate');
  106. return $("#ep_form").data('bootstrapValidator').isValid();
  107. }
  108. var isDis = false;
  109. Register.enterpriseUserRegister = function () {
  110. var special = $("#ep_form .active").attr("special");
  111. $("#special").val(special)
  112. $('#ep_form').bootstrapValidator({
  113. feedbackIcons: {
  114. valid: 'glyphicon glyphicon-ok',
  115. invalid: 'glyphicon glyphicon-remove',
  116. validating: 'glyphicon glyphicon-refresh'
  117. },
  118. group: '.rowGroup',
  119. fields: Register.validateFields,
  120. live: 'enabled',
  121. message: '该字段不能为空'
  122. });
  123. if (special == "qiye") {
  124. $("#tab-3 .form-control").removeAttr("disabled");
  125. $("#tab-4 .form-control").attr("disabled", "disabled");
  126. $('#ep_form').bootstrapValidator("addField", "idCard", {validators: {notEmpty: {message: '统一社会信用代码不能为空'}}});
  127. $('#ep_form').bootstrapValidator("addField", "legal", {validators: {notEmpty: {message: '法人代表不能为空'}, regexp: {regexp: /^[\u4e00-\u9fa5]{1,50}$/, message: "法人代表只允许中文"}}});
  128. $('#ep_form').bootstrapValidator("addField", "bankCard", {validators: {notEmpty: {message: '开户银行账号不能为空'}}});
  129. $('#ep_form').bootstrapValidator("addField", "bankNetwork", {validators: {notEmpty: {message: '开户银行网点不能为空'},
  130. regexp: {
  131. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*$/,
  132. message: "开户银行网点格式不正确"
  133. }}});
  134. $('#ep_form').bootstrapValidator("addField", "bank", {validators: {notEmpty: {message: '开户银行不能为空'}, regexp: {
  135. regexp: /^[\u4e00-\u9fa5]*$/,
  136. message: "开户银行必须为中文"
  137. }}});
  138. var prefix = '企业';
  139. } else {
  140. $("#tab-4 .form-control").removeAttr("disabled");
  141. $("#tab-3 .form-control").attr("disabled", "disabled");
  142. $('#ep_form').bootstrapValidator("removeField", "idCard");
  143. $('#ep_form').bootstrapValidator("removeField", "legal");
  144. $('#ep_form').bootstrapValidator("removeField", "bankCard");
  145. $('#ep_form').bootstrapValidator("removeField", "bankNetwork");
  146. $('#ep_form').bootstrapValidator("removeField", "bank");
  147. var prefix = '单位';
  148. }
  149. if (!Register.validate()) {
  150. return;
  151. }
  152. isDis = $("#type").prop("disabled");
  153. var source = $("#source").val();
  154. if (special == "qiye") {
  155. var username = $("#username").val();
  156. var password = $("#password").val();
  157. var rePassword = $("#re_password").val();
  158. var name = $("#name").val();
  159. var idCard = $("#idCard").val();
  160. var legal = $("#legal").val();
  161. var street = $("#street").val();
  162. var address = $("#address").val();
  163. var ephone = $("#ephone").val();
  164. } else {
  165. var username = $("#sy_username").val();
  166. var password = $("#sy_password").val();
  167. var rePassword = $("#sy_re_password").val();
  168. var name = $("#sy_name").val();
  169. var street = $("#sy_street").val();
  170. var address = $("#sy_address").val();
  171. var ephone = $("#sy_ephone").val();
  172. }
  173. var agentName = $("#agentName").val();
  174. var agentPhone = $("#agentPhone").val();
  175. var verificationCode = $("#verificationCode").val();
  176. if (isDis) {
  177. $("#type").removeAttr("disabled");
  178. }
  179. var type = $("#type").val();
  180. var agentEmail = $("#agentEmail").val();
  181. var enterpriseTag = $("#enterpriseTag").val();
  182. var enterpriseType = $("#enterpriseType").val();
  183. var industryFieldNew = $("#industryFieldNew").val();
  184. var bankCard = $("#bankCard").val();
  185. var bank = $("#bank").val();
  186. var bankNetwork = $("#bankNetwork").val();
  187. if (username == null || username == '') {
  188. Feng.info("请填写账号!");
  189. return;
  190. }
  191. if (username.length > 50) {
  192. Feng.info("账号最多50个字符!");
  193. return;
  194. }
  195. if (source != 2) {
  196. if (password == null || password == '') {
  197. Feng.info("请填写密码!");
  198. return;
  199. }
  200. if (!/^(?=.*\d)(?=.*[a-zA-Z]).{8,20}$/.test(password)) {
  201. Feng.info("密码格式错误,密码由字母与数字组成,且长度必须8个字符及以上!");
  202. return;
  203. }
  204. if (rePassword == null || rePassword == '') {
  205. Feng.info("请填写重复密码!");
  206. return;
  207. }
  208. if (password != rePassword) {
  209. Feng.info("两次密码填写不一致!");
  210. return;
  211. }
  212. }
  213. if (name == null || name == '') {
  214. Feng.info("请填写" + prefix + "名称!");
  215. return;
  216. }
  217. if (!/^([\u4E00-\u9FA5]|\(|\)|\(|\)){1,100}$/.test(name)) {
  218. Feng.info(prefix + "名称只能输入中文 !");
  219. return;
  220. }
  221. if (name.length > 100) {
  222. Feng.info(prefix + "名称最多100个字符!");
  223. return;
  224. }
  225. if (ephone == null || ephone == '') {
  226. Feng.info("请填写" + prefix + "电话");
  227. return;
  228. }
  229. if (street == null || street == '') {
  230. Feng.info("请选择所属街道!");
  231. return;
  232. }
  233. if (address == null || address == '') {
  234. Feng.info("请填写单位地址!");
  235. return;
  236. }
  237. if (special == "qiye") {
  238. if ((idCard == null || idCard == '')) {
  239. Feng.info("请填写统一社会信用代码!");
  240. return;
  241. }
  242. if (idCard.length > 40) {
  243. Feng.info("统一社会信用代码最多40个字符!");
  244. return;
  245. }
  246. if (legal == null || legal == '') {
  247. Feng.info("请填写法人代表!");
  248. return;
  249. }
  250. if (!/^[\u4e00-\u9fa5]{1,50}$/.test(legal)) {
  251. Feng.info("法人代表只能输入中文 !");
  252. return;
  253. }
  254. if (type == null || type == '') {
  255. Feng.info("请选择申报类型!");
  256. return;
  257. }
  258. if (type == null || type == '') {
  259. Feng.info("请选择企业类别");
  260. return;
  261. }
  262. if (bankCard == null || bankCard == '') {
  263. Feng.info("请填写企业银行账号!");
  264. return;
  265. }
  266. if (bank == null || bank == '') {
  267. Feng.info("请填写企业开户银行!");
  268. return;
  269. }
  270. if (bankNetwork == null || bankNetwork == '') {
  271. Feng.info("请填写企业开户银行网点");
  272. return;
  273. }
  274. var x = document.getElementById("imgurl").value;
  275. if (x == "") {
  276. Feng.info("请上传营业执照照片!");
  277. return;
  278. }
  279. if (!Feng.chkFileInvalid(document.getElementById("imgurl").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "营业执照只允许上传PDF或图片")) {
  280. return;
  281. }
  282. var xx = document.getElementById("bankImg").value;
  283. if (xx == "") {
  284. Feng.info("请上传开户银行许可证!");
  285. return;
  286. }
  287. if (!Feng.chkFileInvalid(document.getElementById("bankImg").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "开户银行许可证只允许上传PDF或图片")) {
  288. return;
  289. }
  290. if (type == 1) {
  291. if (enterpriseTag == null || enterpriseTag == '') {
  292. Feng.info("请选择单位标签!");
  293. return;
  294. }
  295. if (industryFieldNew == null || industryFieldNew == '') {
  296. Feng.info("请选择产业领域");
  297. return;
  298. }
  299. var xxx = document.getElementById("domainImg").value;
  300. if (xxx == "") {
  301. Feng.info("请上传行业领域佐证材料!");
  302. return;
  303. }
  304. if (!Feng.chkFileInvalid(document.getElementById("domainImg").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "行业领域佐证材料只允许上传PDF或图片")) {
  305. return;
  306. }
  307. var checkType = ["guishang", "gaoxinjishu", "zhuanjingtexin"];
  308. if (checkType.indexOf(enterpriseType) > -1) {
  309. var typeImg = document.getElementById("typeImg").value;
  310. if (typeImg == "") {
  311. Feng.info("规上、高新技术、专精特新企业需要上传佐证材料!");
  312. return;
  313. }
  314. if (!Feng.chkFileInvalid(document.getElementById("typeImg").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "规上、高新技术、专精特新企业佐证材料只允许上传PDF或图片")) {
  315. return;
  316. }
  317. }
  318. }
  319. } else {
  320. var x = document.getElementById("sy_imgurl").value;
  321. if (x == "") {
  322. Feng.info("请上传法人证或批文!");
  323. return;
  324. }
  325. if (!Feng.chkFileInvalid(document.getElementById("sy_imgurl").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "法人证或批文只允许上传PDF或图片")) {
  326. return;
  327. }
  328. }
  329. if (agentName == null || agentName == '') {
  330. Feng.info("请填写人才联络员!");
  331. return;
  332. }
  333. if (agentName.length > 30) {
  334. Feng.info("人才联络员最多30个字符!");
  335. return;
  336. }
  337. if (agentPhone == null || agentPhone == '') {
  338. Feng.info("请填写人才联络员电话!");
  339. return;
  340. }
  341. if (verificationCode == null || verificationCode == '') {
  342. Feng.info("请填写手机验证码!");
  343. return;
  344. }
  345. if (agentEmail == null || agentEmail == '') {
  346. Feng.info("请填写电子邮箱!");
  347. return;
  348. }
  349. var xxxx = document.getElementById("beian").value;
  350. if (xxxx == "") {
  351. Feng.info("请上传人才联络员信息备案表!");
  352. return;
  353. }
  354. if (!Feng.chkFileInvalid(document.getElementById("beian").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "人才联络员信息备案表只允许上传PDF或图片")) {
  355. return;
  356. }
  357. 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)) {
  358. Feng.info(prefix + "电话格式不合法!");
  359. return;
  360. }
  361. 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)) {
  362. Feng.info("人才联络员电话格式不合法!");
  363. return;
  364. }
  365. if (!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)) {
  366. Feng.info("电子邮箱格式不合法!");
  367. return;
  368. }
  369. if (!lock) {
  370. lock = true;
  371. } else {
  372. Feng.info("不能重复点击");
  373. return;
  374. }
  375. $("#ep_form")[0].submit();
  376. };
  377. Register.changeEnterpriseType = function () {
  378. var enterpriseType = $("#enterpriseType").val();
  379. switch (enterpriseType) {
  380. case "guishang":
  381. case "gaoxinjishu":
  382. case "zhuanjingtexin":
  383. $("td.typeUploader").css("display", "table-cell");
  384. break;
  385. default:
  386. $("td.typeUploader").css("display", "none");
  387. break;
  388. }
  389. };
  390. Register.personUserRegister = function () {
  391. var source = $("#ps_source").val();
  392. var username = $("#ps_username").val();
  393. var password = $("#ps_password").val();
  394. var rePassword = $("#ps_re_password").val();
  395. var name = $("#ps_name").val();
  396. var sex = $("#ps_sex").val();
  397. var idCard = $("#ps_idCard").val();
  398. var phone = $("#ps_phone").val();
  399. var verificationCode = $("#ps_verificationCode").val();
  400. if (username == null || username == '') {
  401. Feng.info("请填写账号!");
  402. return;
  403. }
  404. if (username.length > 50) {
  405. Feng.info("账号最多20个字符!");
  406. return;
  407. }
  408. if (source != 2) {
  409. if (password == null || password == '') {
  410. Feng.info("请填写密码!");
  411. return;
  412. }
  413. if (rePassword == null || rePassword == '') {
  414. Feng.info("请填写重复密码!");
  415. return;
  416. }
  417. if (password != rePassword) {
  418. Feng.info("两次密码填写不一致!");
  419. return;
  420. }
  421. }
  422. if (name == null || name == '') {
  423. Feng.info("请填写姓名!");
  424. return;
  425. }
  426. if (name.length > 20) {
  427. Feng.info("姓名最多20个字符!");
  428. return;
  429. }
  430. if (sex == null || sex == '') {
  431. Feng.info("请选择性别!");
  432. return;
  433. }
  434. if (idCard == null || idCard == '') {
  435. Feng.info("请填写身份证号!");
  436. return;
  437. }
  438. if (phone == null || phone == '') {
  439. Feng.info("请填写手机号!");
  440. return;
  441. }
  442. if (verificationCode == null || verificationCode == '') {
  443. Feng.info("请填写手机验证码!")
  444. return;
  445. }
  446. if (!/0?(13|14|15|17|18|19)[0-9]{9}/.test(phone)) {
  447. Feng.info("手机号格式不合法!");
  448. return;
  449. }
  450. var da = {"source": source, "username": username, "password": password, "name": name, "sex": sex, "idCard": idCard, "phone": phone, "verificationCode": verificationCode};
  451. var ajax = new $ax(Feng.ctxPath + "/api/personalUser/register", function (data) {
  452. Feng.info(data.msg);
  453. if (data.code == 200) {
  454. parent.layer.close(window.parent.Login.layerIndex);
  455. }
  456. }, function (data) {
  457. Feng.error("操作失败!" + data.responseJSON.message + "!");
  458. });
  459. ajax.set(da);
  460. ajax.start();
  461. };
  462. Register.getEnterpriseSms = function () {
  463. var agentPhone = $("#agentPhone").val();
  464. if (agentPhone == null || agentPhone == "") {
  465. Feng.info("请填写人才联络员手机号!");
  466. return;
  467. }
  468. agentPhone = $.trim(agentPhone);
  469. if (!Feng.checkMobilePhoneNum(agentPhone)) {
  470. Feng.info("手机号格式有误,请填写正确的手机号码!");
  471. return;
  472. }
  473. Register.enterpriseBtnCountDown();
  474. var ajax = new $ax(Feng.ctxPath + "/common/auth/verificationCode?phone=" + agentPhone + "&type=1", function (data) {
  475. Feng.info(data.msg);
  476. }, function (data) {
  477. Feng.error("操作失败!" + data.responseJSON.message + "!");
  478. });
  479. ajax.set(null);
  480. ajax.start();
  481. };
  482. Register.enterpriseBtnCountDown = function () {
  483. if (enterpriseCountDown == 0) {
  484. enterpriseCountDown = 60;
  485. } else if (enterpriseCountDown == 1) {
  486. enterpriseSmsBtn.removeAttr("disabled");
  487. enterpriseSmsBtn.html("获取验证码");
  488. enterpriseCountDown = 0;
  489. return;
  490. }
  491. enterpriseSmsBtn.attr("disabled", true);
  492. enterpriseSmsBtn.html(enterpriseCountDown + "秒");
  493. enterpriseCountDown--;
  494. setTimeout("Register.enterpriseBtnCountDown()", 1000);
  495. };
  496. Register.getPersionSms = function () {
  497. var phone = $("#ps_phone").val();
  498. if (phone == null || phone == "") {
  499. Feng.info("请填写手机号!");
  500. return;
  501. }
  502. phone = $.trim(phone);
  503. if (!Feng.checkMobilePhoneNum(phone)) {
  504. Feng.info("手机号格式有误,请填写正确的手机号码!");
  505. return;
  506. }
  507. Register.getPersionBtnCountDown();
  508. var ajax = new $ax(Feng.ctxPath + "/common/auth/verificationCode?phone=" + phone + "&type=1", function (data) {
  509. Feng.info(data.msg);
  510. }, function (data) {
  511. Feng.error("操作失败!" + data.responseJSON.message + "!");
  512. });
  513. ajax.set(null);
  514. ajax.start();
  515. };
  516. Register.getPersionBtnCountDown = function () {
  517. if (persionCountDown == 0) {
  518. persionCountDown = 60;
  519. } else if (persionCountDown == 1) {
  520. psSmsBtn.removeAttr("disabled");
  521. psSmsBtn.html("获取验证码");
  522. persionCountDown = 0;
  523. return;
  524. }
  525. psSmsBtn.attr("disabled", true);
  526. psSmsBtn.html(persionCountDown + "秒");
  527. persionCountDown--;
  528. setTimeout("Register.getPersionBtnCountDown()", 1000);
  529. };
  530. /**
  531. * 企业用户注册回调
  532. */
  533. Register.epCallBack = function (data) {
  534. lock = false;
  535. var nowDis = $("#type").prop("disabled");
  536. if (isDis != nowDis) {
  537. $("#type").attr("disabled", "disabled");
  538. }
  539. Feng.info(data.msg);
  540. if (data.code == 200) {
  541. parent.layer.close(window.parent.Login.layerIndex);
  542. }
  543. };
  544. Register.typeChange = function () {
  545. $("#type").removeAttr("disabled");
  546. var type = $("#type").val();
  547. if (type == 1) {
  548. $("#typeGroup").attr("style", "display:block");
  549. } else {
  550. $("#typeGroup").attr("style", "display:none");
  551. $("#enterpriseTag,#industryFieldNew,#industryFieldOld").val("");
  552. }
  553. }
  554. Register.industryChange = function () {
  555. var industryNew = $("#industryFieldNew").val();
  556. var arr = [{"name": "industryFieldOld", "code": industryNew + "_field"}];
  557. Feng.findChildDictBatch(JSON.stringify(arr));
  558. }
  559. $(function () {
  560. $('#ep_form').bootstrapValidator({
  561. feedbackIcons: {
  562. valid: 'glyphicon glyphicon-ok',
  563. invalid: 'glyphicon glyphicon-remove',
  564. validating: 'glyphicon glyphicon-refresh'
  565. },
  566. group: '.rowGroup',
  567. fields: Register.validateFields,
  568. live: 'enabled',
  569. message: '该字段不能为空'
  570. });
  571. var userType = Feng.getUrlValue("userType");
  572. var username = Feng.getUrlValue("username");
  573. var name = Feng.getUrlValue("name");
  574. var idCard = Feng.getUrlValue("idCard");
  575. var type = Feng.getUrlValue("type");
  576. if (userType == 1) { //企业用户trigger
  577. $("#source").val(2);
  578. $("#username").val(username).attr("readonly", "readonly");
  579. $("#name").val(name).attr("readonly", "readonly");
  580. $("#idCard").val(idCard).attr("readonly", "readonly");
  581. $("#type").val(type).trigger("change");
  582. $("#type").attr("disabled", "disabled");
  583. $("#password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  584. $("#re_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  585. $("#personTab").css("pointer-events", "none");
  586. } else if (userType == 2) { //个人用户
  587. $("#personTab").css("pointer-events", "block");
  588. $("#personTab").children().click();
  589. $("#ps_source").val(2);
  590. $("#ps_username").val(name).attr("readonly", "readonly");
  591. $("#ps_idCard").val(idCard).attr("readonly", "readonly");
  592. $("#ps_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  593. $("#ps_re_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  594. $("#enTab").css("pointer-events", "none");
  595. } else { //无
  596. }
  597. var arr = [
  598. {"name": "street", "code": "street"},
  599. {"name": "enterpriseTag", "code": "enterprise_tag"},
  600. {"name": "industryFieldNew", "code": "industry_field"},
  601. {"name": "enterpriseType", "code": "enterprise_type"},
  602. {"name": "sy_street", "code": "street"}];
  603. Feng.findChildDictBatch(JSON.stringify(arr));
  604. $("#imgurl,#sy_imgurl,#bankImg,#sy_bankImg,#beian,#domainImg").change(function (e) {
  605. var that = this;
  606. if (!Feng.chkFileInvalid(that.files[0], 5, 10)) {
  607. return;
  608. }
  609. var file = that.files[0];
  610. var imgSrc;
  611. var reader = new FileReader();
  612. reader.readAsDataURL(file);
  613. reader.onload = function () {
  614. if (Feng.isImg(file.type)) {
  615. imgSrc = this.result;
  616. $(that).prev("img").attr("src", imgSrc);
  617. } else {
  618. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  619. }
  620. };
  621. });
  622. });