register.js 27 KB

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