register.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  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 type = $("#type").val();
  111. var special = $("#ep_form .active").attr("special");
  112. $("#special").val(special)
  113. $('#ep_form').bootstrapValidator({
  114. feedbackIcons: {
  115. valid: 'glyphicon glyphicon-ok',
  116. invalid: 'glyphicon glyphicon-remove',
  117. validating: 'glyphicon glyphicon-refresh'
  118. },
  119. group: '.rowGroup',
  120. fields: Register.validateFields,
  121. live: 'enabled',
  122. message: '该字段不能为空'
  123. });
  124. switch (special) {
  125. case 'qiye':
  126. $("#tab-3 .form-control").removeAttr("disabled");
  127. $("#tab-4 .form-control").attr("disabled", "disabled");
  128. $("#tab-5 .form-control").attr("disabled", "disabled");
  129. $('#ep_form').bootstrapValidator("addField", "idCard", {validators: {notEmpty: {message: '统一社会信用代码不能为空'}}});
  130. $('#ep_form').bootstrapValidator("addField", "legal", {validators: {notEmpty: {message: '法人代表不能为空'}}});//, regexp: {regexp: /^[\u4e00-\u9fa5]{1,50}$/, message: "法人代表只允许中文"}
  131. if (type == 1) {
  132. $('#ep_form').bootstrapValidator("addField", "bankCard", {validators: {notEmpty: {message: '开户银行账号不能为空'}}});
  133. $('#ep_form').bootstrapValidator("addField", "bankNetwork", {validators: {notEmpty: {message: '开户银行网点不能为空'},
  134. regexp: {
  135. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*$/,
  136. message: "开户银行网点格式不正确"
  137. }}});
  138. $('#ep_form').bootstrapValidator("addField", "bank", {validators: {notEmpty: {message: '开户银行不能为空'}, regexp: {
  139. regexp: /^[\u4e00-\u9fa5]*$/,
  140. message: "开户银行必须为中文"
  141. }}});
  142. }
  143. var prefix = '企业';
  144. break;
  145. case 'minfei':
  146. $("#tab-5 .form-control").removeAttr("disabled");
  147. $("#tab-4 .form-control").attr("disabled", "disabled");
  148. $("#tab-3 .form-control").attr("disabled", "disabled");
  149. $('#ep_form').bootstrapValidator("addField", "idCard", {validators: {notEmpty: {message: '统一社会信用代码不能为空'}}});
  150. $('#ep_form').bootstrapValidator("addField", "legal", {validators: {notEmpty: {message: '法人代表不能为空'}}});//, regexp: {regexp: /^[\u4e00-\u9fa5]{1,50}$/, message: "法人代表只允许中文"}
  151. $('#ep_form').bootstrapValidator("addField", "bankCard", {validators: {notEmpty: {message: '开户银行账号不能为空'}}});
  152. $('#ep_form').bootstrapValidator("addField", "bankNetwork", {validators: {notEmpty: {message: '开户银行网点不能为空'},
  153. regexp: {
  154. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*$/,
  155. message: "开户银行网点格式不正确"
  156. }}});
  157. $('#ep_form').bootstrapValidator("addField", "bank", {validators: {notEmpty: {message: '开户银行不能为空'}, regexp: {
  158. regexp: /^[\u4e00-\u9fa5]*$/,
  159. message: "开户银行必须为中文"
  160. }}});
  161. var prefix = '企业';
  162. break;
  163. case 'shiye':
  164. $("#tab-4 .form-control").removeAttr("disabled");
  165. $("#tab-3 .form-control").attr("disabled", "disabled");
  166. $('#ep_form').bootstrapValidator("removeField", "idCard");
  167. $('#ep_form').bootstrapValidator("removeField", "legal");
  168. $('#ep_form').bootstrapValidator("removeField", "bankCard");
  169. $('#ep_form').bootstrapValidator("removeField", "bankNetwork");
  170. $('#ep_form').bootstrapValidator("removeField", "bank");
  171. var prefix = '单位';
  172. break;
  173. }
  174. if (!Register.validate()) {
  175. return;
  176. }
  177. isDis = $("#type").prop("disabled");
  178. var source = $("#source").val();
  179. switch (special) {
  180. case 'qiye':
  181. var username = $("#username").val();
  182. var password = $("#password").val();
  183. var rePassword = $("#re_password").val();
  184. var name = $("#name").val();
  185. var idCard = $("#idCard").val();
  186. var legal = $("#legal").val();
  187. var street = $("#street").val();
  188. var address = $("#address").val();
  189. var ephone = $("#ephone").val();
  190. var bankCard = $("#bankCard").val();
  191. var bank = $("#bank").val();
  192. var bankNetwork = $("#bankNetwork").val();
  193. break;
  194. case 'minfei':
  195. var username = $("#mf_username").val();
  196. var password = $("#mf_password").val();
  197. var rePassword = $("#mf_re_password").val();
  198. var name = $("#mf_name").val();
  199. var idCard = $("#mf_idCard").val();
  200. var legal = $("#mf_legal").val();
  201. var street = $("#mf_street").val();
  202. var address = $("#mf_address").val();
  203. var ephone = $("#mf_ephone").val();
  204. var bankCard = $("#mf_bankCard").val();
  205. var bank = $("#mf_bank").val();
  206. var bankNetwork = $("#mf_bankNetwork").val();
  207. break;
  208. case 'shiye':
  209. var username = $("#sy_username").val();
  210. var password = $("#sy_password").val();
  211. var rePassword = $("#sy_re_password").val();
  212. var name = $("#sy_name").val();
  213. var street = $("#sy_street").val();
  214. var address = $("#sy_address").val();
  215. var ephone = $("#sy_ephone").val();
  216. break;
  217. }
  218. var agentName = $("#agentName").val();
  219. var agentPhone = $("#agentPhone").val();
  220. var verificationCode = $("#verificationCode").val();
  221. if (isDis) {
  222. $("#type").removeAttr("disabled");
  223. }
  224. var agencyType = $("#agencyType").val();
  225. var agentEmail = $("#agentEmail").val();
  226. var enterpriseTag = $("#enterpriseTag").val();
  227. var enterpriseType = $("#enterpriseType").val();
  228. var industryFieldNew = $("#industryFieldNew").val();
  229. var industryFieldOld = $("#industryFieldOld").val();
  230. if (username == null || username == '') {
  231. Feng.info("请填写账号!");
  232. return;
  233. }
  234. if (username.length > 50) {
  235. Feng.info("账号最多50个字符!");
  236. return;
  237. }
  238. if (source != 2) {
  239. if (password == null || password == '') {
  240. Feng.info("请填写密码!");
  241. return;
  242. }
  243. if (!/^(?=.*\d)(?=.*[a-zA-Z]).{8,20}$/.test(password)) {
  244. Feng.info("密码格式错误,密码由字母与数字组成,且长度必须8个字符及以上!");
  245. return;
  246. }
  247. if (rePassword == null || rePassword == '') {
  248. Feng.info("请填写重复密码!");
  249. return;
  250. }
  251. if (password != rePassword) {
  252. Feng.info("两次密码填写不一致!");
  253. return;
  254. }
  255. }
  256. if (name == null || name == '') {
  257. Feng.info("请填写" + prefix + "名称!");
  258. return;
  259. }
  260. /*if (!/^([\u4E00-\u9FA5]|\(|\)|\(|\)){1,100}$/.test(name)) {
  261. Feng.info(prefix + "名称只能输入中文 !");
  262. return;
  263. }*/
  264. if (name.length > 100) {
  265. Feng.info(prefix + "名称最多100个字符!");
  266. return;
  267. }
  268. if (ephone == null || ephone == '') {
  269. Feng.info("请填写" + prefix + "电话");
  270. return;
  271. }
  272. if (street == null || street == '') {
  273. Feng.info("请选择所属街道!");
  274. return;
  275. }
  276. if (address == null || address == '') {
  277. Feng.info("请填写单位地址!");
  278. return;
  279. }
  280. switch (special) {
  281. case 'qiye':
  282. if ((idCard == null || idCard == '')) {
  283. Feng.info("请填写统一社会信用代码!");
  284. return;
  285. }
  286. if (idCard.length > 40) {
  287. Feng.info("统一社会信用代码最多40个字符!");
  288. return;
  289. }
  290. if (legal == null || legal == '') {
  291. Feng.info("请填写法人代表!");
  292. return;
  293. }
  294. if (type == null || type == '') {
  295. Feng.info("请选择申报类型!");
  296. return;
  297. }
  298. /*if (!/^[\u4e00-\u9fa5]{1,50}$/.test(legal)) {
  299. Feng.info("法人代表只能输入中文 !");
  300. return;
  301. }*/
  302. if (type == 1) {
  303. if (bankCard == null || bankCard == '') {
  304. Feng.info("请填写企业银行账号!");
  305. return;
  306. }
  307. if (bank == null || bank == '') {
  308. Feng.info("请填写企业开户银行!");
  309. return;
  310. }
  311. if (bankNetwork == null || bankNetwork == '') {
  312. Feng.info("请填写企业开户银行网点");
  313. return;
  314. }
  315. }
  316. var x = document.getElementById("imgurl").value;
  317. if (x == "") {
  318. Feng.info("请上传营业执照照片!");
  319. return;
  320. }
  321. if (!Feng.chkFileInvalid(document.getElementById("imgurl").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "营业执照只允许上传PDF或图片")) {
  322. return;
  323. }
  324. if (type == 1) {
  325. var xx = document.getElementById("bankImg").value;
  326. if (xx == "") {
  327. Feng.info("请上传开户银行许可证!");
  328. return;
  329. }
  330. if (!Feng.chkFileInvalid(document.getElementById("bankImg").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "开户银行许可证只允许上传PDF或图片")) {
  331. return;
  332. }
  333. if (agencyType == null || agencyType == '') {
  334. Feng.info("请选择机构类型");
  335. return;
  336. }
  337. switch (agencyType) {
  338. case "1":
  339. if (industryFieldNew == null || industryFieldNew == '') {
  340. Feng.info("请选择产业领域");
  341. return;
  342. }
  343. if (industryFieldOld == null || industryFieldOld == '') {
  344. Feng.info("请选择行业领域");
  345. return;
  346. }
  347. var xxx = document.getElementById("domainImg").value;
  348. if (xxx == "") {
  349. Feng.info("请上传行业领域佐证材料!");
  350. return;
  351. }
  352. if (!Feng.chkFileInvalid(document.getElementById("domainImg").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "行业领域佐证材料只允许上传PDF或图片")) {
  353. return;
  354. }
  355. break;
  356. case "2":
  357. break;
  358. }
  359. if (enterpriseTag == null || enterpriseTag == '') {
  360. Feng.info("请选择企业标签!");
  361. return;
  362. }
  363. if (enterpriseType == null || enterpriseType == '') {
  364. Feng.info("请选择企业类型!");
  365. return;
  366. }
  367. var checkType = ["guishang", "gaoxinjishu", "zhuanjingtexin"];
  368. if (checkType.indexOf(enterpriseType) > -1) {
  369. var typeImg = document.getElementById("typeImg").value;
  370. if (typeImg == "") {
  371. Feng.info("规上、高新技术、专精特新企业需要上传佐证材料!");
  372. return;
  373. }
  374. if (!Feng.chkFileInvalid(document.getElementById("typeImg").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "规上、高新技术、专精特新企业佐证材料只允许上传PDF或图片")) {
  375. return;
  376. }
  377. }
  378. }
  379. break;
  380. case 'minfei':
  381. if ((idCard == null || idCard == '')) {
  382. Feng.info("请填写统一社会信用代码!");
  383. return;
  384. }
  385. if (idCard.length > 40) {
  386. Feng.info("统一社会信用代码最多40个字符!");
  387. return;
  388. }
  389. if (legal == null || legal == '') {
  390. Feng.info("请填写法人代表!");
  391. return;
  392. }
  393. /*if (!/^[\u4e00-\u9fa5]{1,50}$/.test(legal)) {
  394. Feng.info("法人代表只能输入中文 !");
  395. return;
  396. }*/
  397. if (bankCard == null || bankCard == '') {
  398. Feng.info("请填写机构银行账号!");
  399. return;
  400. }
  401. if (bank == null || bank == '') {
  402. Feng.info("请填写机构开户银行!");
  403. return;
  404. }
  405. if (bankNetwork == null || bankNetwork == '') {
  406. Feng.info("请填写机构开户银行网点");
  407. return;
  408. }
  409. var x = document.getElementById("mf_imgurl").value;
  410. if (x == "") {
  411. Feng.info("请上传营业执照照片!");
  412. return;
  413. }
  414. if (!Feng.chkFileInvalid(document.getElementById("mf_imgurl").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "营业执照只允许上传PDF或图片")) {
  415. return;
  416. }
  417. var xx = document.getElementById("mf_bankImg").value;
  418. if (xx == "") {
  419. Feng.info("请上传开户银行许可证!");
  420. return;
  421. }
  422. if (!Feng.chkFileInvalid(document.getElementById("mf_bankImg").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "开户银行许可证只允许上传PDF或图片")) {
  423. return;
  424. }
  425. break;
  426. case 'shiye':
  427. var x = document.getElementById("sy_imgurl").value;
  428. if (x == "") {
  429. Feng.info("请上传法人证或批文!");
  430. return;
  431. }
  432. if (!Feng.chkFileInvalid(document.getElementById("sy_imgurl").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "法人证或批文只允许上传PDF或图片")) {
  433. return;
  434. }
  435. break;
  436. }
  437. if (agentName == null || agentName == '') {
  438. Feng.info("请填写人才联络员!");
  439. return;
  440. }
  441. if (agentName.length > 30) {
  442. Feng.info("人才联络员最多30个字符!");
  443. return;
  444. }
  445. if (agentPhone == null || agentPhone == '') {
  446. Feng.info("请填写人才联络员电话!");
  447. return;
  448. }
  449. if (verificationCode == null || verificationCode == '') {
  450. Feng.info("请填写手机验证码!");
  451. return;
  452. }
  453. if (agentEmail == null || agentEmail == '') {
  454. Feng.info("请填写电子邮箱!");
  455. return;
  456. }
  457. var xxxx = document.getElementById("beian").value;
  458. if (xxxx == "") {
  459. Feng.info("请上传人才联络员信息备案表!");
  460. return;
  461. }
  462. if (!Feng.chkFileInvalid(document.getElementById("beian").files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "人才联络员信息备案表只允许上传PDF或图片")) {
  463. return;
  464. }
  465. 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)) {
  466. Feng.info(prefix + "电话格式不合法!");
  467. return;
  468. }
  469. 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)) {
  470. Feng.info("人才联络员电话格式不合法!");
  471. return;
  472. }
  473. if (!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)) {
  474. Feng.info("电子邮箱格式不合法!");
  475. return;
  476. }
  477. if (!lock) {
  478. lock = true;
  479. } else {
  480. Feng.info("不能重复点击");
  481. return;
  482. }
  483. $("#ep_form")[0].submit();
  484. };
  485. Register.changeEnterpriseType = function () {
  486. var enterpriseType = $("#enterpriseType").val();
  487. switch (enterpriseType) {
  488. case "guishang":
  489. console.log("规上")
  490. $("#typeName").text("规上");
  491. $("td.typeUploader").css("display", "table-cell");
  492. break;
  493. case "gaoxinjishu":
  494. console.log("高新技术")
  495. $("#typeName").html("高新技术");
  496. $("td.typeUploader").css("display", "table-cell");
  497. break;
  498. case "zhuanjingtexin":
  499. console.log("专精特新")
  500. $("#typeName").html("专精特新");
  501. $("td.typeUploader").css("display", "table-cell");
  502. break;
  503. default:
  504. $("td.typeUploader").css("display", "none");
  505. break;
  506. }
  507. };
  508. Register.personUserRegister = function () {
  509. var source = $("#ps_source").val();
  510. var username = $("#ps_username").val();
  511. var password = $("#ps_password").val();
  512. var rePassword = $("#ps_re_password").val();
  513. var name = $("#ps_name").val();
  514. var sex = $("#ps_sex").val();
  515. var idCard = $("#ps_idCard").val();
  516. var phone = $("#ps_phone").val();
  517. var verificationCode = $("#ps_verificationCode").val();
  518. if (username == null || username == '') {
  519. Feng.info("请填写账号!");
  520. return;
  521. }
  522. if (username.length > 50) {
  523. Feng.info("账号最多20个字符!");
  524. return;
  525. }
  526. if (source != 2) {
  527. if (password == null || password == '') {
  528. Feng.info("请填写密码!");
  529. return;
  530. }
  531. if (rePassword == null || rePassword == '') {
  532. Feng.info("请填写重复密码!");
  533. return;
  534. }
  535. if (password != rePassword) {
  536. Feng.info("两次密码填写不一致!");
  537. return;
  538. }
  539. }
  540. if (name == null || name == '') {
  541. Feng.info("请填写姓名!");
  542. return;
  543. }
  544. if (name.length > 20) {
  545. Feng.info("姓名最多20个字符!");
  546. return;
  547. }
  548. if (sex == null || sex == '') {
  549. Feng.info("请选择性别!");
  550. return;
  551. }
  552. if (idCard == null || idCard == '') {
  553. Feng.info("请填写身份证号!");
  554. return;
  555. }
  556. if (phone == null || phone == '') {
  557. Feng.info("请填写手机号!");
  558. return;
  559. }
  560. if (verificationCode == null || verificationCode == '') {
  561. Feng.info("请填写手机验证码!")
  562. return;
  563. }
  564. if (!/0?(13|14|15|17|18|19)[0-9]{9}/.test(phone)) {
  565. Feng.info("手机号格式不合法!");
  566. return;
  567. }
  568. var da = {"source": source, "username": username, "password": password, "name": name, "sex": sex, "idCard": idCard, "phone": phone, "verificationCode": verificationCode};
  569. var ajax = new $ax("/common/auth/person_register", function (data) {
  570. Feng.info(data.msg);
  571. if (data.code == 200) {
  572. parent.layer.close(window.parent.Login.layerIndex);
  573. }
  574. }, function (data) {
  575. Feng.error("操作失败!" + data.responseJSON.message + "!");
  576. });
  577. ajax.set(da);
  578. ajax.start();
  579. };
  580. Register.getEnterpriseSms = function () {
  581. var agentPhone = $("#agentPhone").val();
  582. if (agentPhone == null || agentPhone == "") {
  583. Feng.info("请填写人才联络员手机号!");
  584. return;
  585. }
  586. agentPhone = $.trim(agentPhone);
  587. if (!Feng.checkMobilePhoneNum(agentPhone)) {
  588. Feng.info("手机号格式有误,请填写正确的手机号码!");
  589. return;
  590. }
  591. Register.enterpriseBtnCountDown();
  592. var ajax = new $ax(Feng.ctxPath + "/common/auth/verificationCode?phone=" + agentPhone + "&type=1", function (data) {
  593. Feng.info(data.msg);
  594. }, function (data) {
  595. Feng.error("操作失败!" + data.responseJSON.message + "!");
  596. });
  597. ajax.set(null);
  598. ajax.start();
  599. };
  600. Register.enterpriseBtnCountDown = function () {
  601. if (enterpriseCountDown == 0) {
  602. enterpriseCountDown = 60;
  603. } else if (enterpriseCountDown == 1) {
  604. enterpriseSmsBtn.removeAttr("disabled");
  605. enterpriseSmsBtn.html("获取验证码");
  606. enterpriseCountDown = 0;
  607. return;
  608. }
  609. enterpriseSmsBtn.attr("disabled", true);
  610. enterpriseSmsBtn.html(enterpriseCountDown + "秒");
  611. enterpriseCountDown--;
  612. setTimeout("Register.enterpriseBtnCountDown()", 1000);
  613. };
  614. Register.getPersionSms = function () {
  615. var phone = $("#ps_phone").val();
  616. if (phone == null || phone == "") {
  617. Feng.info("请填写手机号!");
  618. return;
  619. }
  620. phone = $.trim(phone);
  621. if (!Feng.checkMobilePhoneNum(phone)) {
  622. Feng.info("手机号格式有误,请填写正确的手机号码!");
  623. return;
  624. }
  625. Register.getPersionBtnCountDown();
  626. var ajax = new $ax(Feng.ctxPath + "/common/auth/verificationCode?phone=" + phone + "&type=1", function (data) {
  627. Feng.info(data.msg);
  628. }, function (data) {
  629. Feng.error("操作失败!" + data.responseJSON.message + "!");
  630. });
  631. ajax.set(null);
  632. ajax.start();
  633. };
  634. Register.getPersionBtnCountDown = function () {
  635. if (persionCountDown == 0) {
  636. persionCountDown = 60;
  637. } else if (persionCountDown == 1) {
  638. psSmsBtn.removeAttr("disabled");
  639. psSmsBtn.html("获取验证码");
  640. persionCountDown = 0;
  641. return;
  642. }
  643. psSmsBtn.attr("disabled", true);
  644. psSmsBtn.html(persionCountDown + "秒");
  645. persionCountDown--;
  646. setTimeout("Register.getPersionBtnCountDown()", 1000);
  647. };
  648. /**
  649. * 企业用户注册回调
  650. */
  651. Register.epCallBack = function (data) {
  652. lock = false;
  653. var nowDis = $("#type").prop("disabled");
  654. if (isDis != nowDis) {
  655. $("#type").attr("disabled", "disabled");
  656. }
  657. Feng.info(data.msg);
  658. if (data.code == 200) {
  659. parent.layer.close(window.parent.Login.layerIndex);
  660. }
  661. };
  662. Register.typeChange = function () {
  663. $("#type").removeAttr("disabled");
  664. var type = $("#type").val();
  665. if (type == 1) {
  666. $(".agencyType").attr("style", "display:block");
  667. $("#bankCard").parent().find("span").css("display", "");
  668. $("#bankNetwork").parent().find("span").css("display", "");
  669. $("#bank").parent().find("span").css("display", "");
  670. $("#bankImg").parent().find("span").css("display", "");
  671. } else {
  672. $(".agencyType").attr("style", "display:none");
  673. $("#typeGroup").attr("style", "display:none");
  674. $("#enterpriseTag,#industryFieldNew,#industryFieldOld,#enterpriseType").val("");
  675. $("#bankCard").parent().find("span").css("display", "none");
  676. $("#bankNetwork").parent().find("span").css("display", "none");
  677. $("#bank").parent().find("span").css("display", "none");
  678. $("#bankImg").parent().find("span").css("display", "none");
  679. }
  680. }
  681. Register.agencyTypeChange = function () {
  682. var agencyType = $("#agencyType").val();
  683. switch (agencyType) {
  684. case "1":
  685. $("#typeGroup").attr("style", "display:block");
  686. $(".agencyType1").attr("style", "");
  687. $(".agencyType2").attr("style", "");
  688. break;
  689. case "2":
  690. $("#typeGroup").attr("style", "display:block");
  691. $(".agencyType1").attr("style", "display:none");
  692. $(".agencyType2").attr("style", "");
  693. $("#industryFieldNew").val("");
  694. $("#industryFieldOld").val("");
  695. break;
  696. default:
  697. $("#typeGroup").attr("style", "display:none");
  698. break;
  699. }
  700. }
  701. Register.industryChange = function () {
  702. var industryNew = $("#industryFieldNew").val();
  703. var arr = [{"name": "industryFieldOld", "code": industryNew + "_field"}];
  704. Feng.findChildDictBatch(JSON.stringify(arr));
  705. }
  706. $(function () {
  707. $('#ep_form').bootstrapValidator({
  708. feedbackIcons: {
  709. valid: 'glyphicon glyphicon-ok',
  710. invalid: 'glyphicon glyphicon-remove',
  711. validating: 'glyphicon glyphicon-refresh'
  712. },
  713. group: '.rowGroup',
  714. fields: Register.validateFields,
  715. live: 'enabled',
  716. message: '该字段不能为空'
  717. });
  718. var userType = Feng.getUrlValue("userType");
  719. var username = Feng.getUrlValue("username");
  720. var name = Feng.getUrlValue("name");
  721. var idCard = Feng.getUrlValue("idCard");
  722. var type = Feng.getUrlValue("type");
  723. if (userType == 1) { //企业用户trigger
  724. $("#source").val(2);
  725. $("#username").val(username).attr("readonly", "readonly");
  726. $("#name").val(name).attr("readonly", "readonly");
  727. $("#idCard").val(idCard).attr("readonly", "readonly");
  728. $("#type").val(type).trigger("change");
  729. $("#type").attr("disabled", "disabled");
  730. $("#password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  731. $("#re_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  732. $("#personTab").css("pointer-events", "none");
  733. } else if (userType == 2) { //个人用户
  734. $("#personTab").css("pointer-events", "block");
  735. $("#personTab").children().click();
  736. $("#ps_source").val(2);
  737. $("#ps_username").val(name).attr("readonly", "readonly");
  738. $("#ps_idCard").val(idCard).attr("readonly", "readonly");
  739. $("#ps_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  740. $("#ps_re_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  741. $("#enTab").css("pointer-events", "none");
  742. } else { //无
  743. }
  744. var arr = [
  745. {"name": "street", "code": "street"},
  746. {"name": "enterpriseTag", "code": "enterprise_tag"},
  747. {"name": "organizationTag", "code": "organization_tag"},
  748. {"name": "institutionTag", "code": "institution_tag"},
  749. {"name": "industryFieldNew", "code": "industry_field"},
  750. {"name": "enterpriseType", "code": "enterprise_type"},
  751. {"name": "sy_street", "code": "street"},
  752. {"name": "mf_street", "code": "street"},
  753. {"name": "agencyType", "code": "agency_type"}];
  754. Feng.findChildDictBatch(JSON.stringify(arr));
  755. $("#imgurl,#sy_imgurl,#mf_imgurl,#bankImg,#mf_bankImg,#sy_bankImg,#beian,#domainImg,#typeImg").change(function (e) {
  756. var that = this;
  757. if (!Feng.chkFileInvalid(that.files[0], 5, 10)) {
  758. return;
  759. }
  760. var file = that.files[0];
  761. var imgSrc;
  762. var reader = new FileReader();
  763. reader.readAsDataURL(file);
  764. reader.onload = function () {
  765. if (Feng.isImg(file.type)) {
  766. imgSrc = this.result;
  767. $(that).prev("img").attr("src", imgSrc);
  768. } else {
  769. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  770. }
  771. };
  772. });
  773. });