register.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  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. console.log("规上")
  382. $("#typeName").text("规上");
  383. $("td.typeUploader").css("display", "table-cell");
  384. break;
  385. case "gaoxinjishu":
  386. console.log("高新技术")
  387. $("#typeName").html("高新技术");
  388. $("td.typeUploader").css("display", "table-cell");
  389. break;
  390. case "zhuanjingtexin":
  391. console.log("专精特新")
  392. $("#typeName").html("专精特新");
  393. $("td.typeUploader").css("display", "table-cell");
  394. break;
  395. default:
  396. $("td.typeUploader").css("display", "none");
  397. break;
  398. }
  399. };
  400. Register.personUserRegister = function () {
  401. var source = $("#ps_source").val();
  402. var username = $("#ps_username").val();
  403. var password = $("#ps_password").val();
  404. var rePassword = $("#ps_re_password").val();
  405. var name = $("#ps_name").val();
  406. var sex = $("#ps_sex").val();
  407. var idCard = $("#ps_idCard").val();
  408. var phone = $("#ps_phone").val();
  409. var verificationCode = $("#ps_verificationCode").val();
  410. if (username == null || username == '') {
  411. Feng.info("请填写账号!");
  412. return;
  413. }
  414. if (username.length > 50) {
  415. Feng.info("账号最多20个字符!");
  416. return;
  417. }
  418. if (source != 2) {
  419. if (password == null || password == '') {
  420. Feng.info("请填写密码!");
  421. return;
  422. }
  423. if (rePassword == null || rePassword == '') {
  424. Feng.info("请填写重复密码!");
  425. return;
  426. }
  427. if (password != rePassword) {
  428. Feng.info("两次密码填写不一致!");
  429. return;
  430. }
  431. }
  432. if (name == null || name == '') {
  433. Feng.info("请填写姓名!");
  434. return;
  435. }
  436. if (name.length > 20) {
  437. Feng.info("姓名最多20个字符!");
  438. return;
  439. }
  440. if (sex == null || sex == '') {
  441. Feng.info("请选择性别!");
  442. return;
  443. }
  444. if (idCard == null || idCard == '') {
  445. Feng.info("请填写身份证号!");
  446. return;
  447. }
  448. if (phone == null || phone == '') {
  449. Feng.info("请填写手机号!");
  450. return;
  451. }
  452. if (verificationCode == null || verificationCode == '') {
  453. Feng.info("请填写手机验证码!")
  454. return;
  455. }
  456. if (!/0?(13|14|15|17|18|19)[0-9]{9}/.test(phone)) {
  457. Feng.info("手机号格式不合法!");
  458. return;
  459. }
  460. var da = {"source": source, "username": username, "password": password, "name": name, "sex": sex, "idCard": idCard, "phone": phone, "verificationCode": verificationCode};
  461. var ajax = new $ax(Feng.ctxPath + "/api/personalUser/register", function (data) {
  462. Feng.info(data.msg);
  463. if (data.code == 200) {
  464. parent.layer.close(window.parent.Login.layerIndex);
  465. }
  466. }, function (data) {
  467. Feng.error("操作失败!" + data.responseJSON.message + "!");
  468. });
  469. ajax.set(da);
  470. ajax.start();
  471. };
  472. Register.getEnterpriseSms = function () {
  473. var agentPhone = $("#agentPhone").val();
  474. if (agentPhone == null || agentPhone == "") {
  475. Feng.info("请填写人才联络员手机号!");
  476. return;
  477. }
  478. agentPhone = $.trim(agentPhone);
  479. if (!Feng.checkMobilePhoneNum(agentPhone)) {
  480. Feng.info("手机号格式有误,请填写正确的手机号码!");
  481. return;
  482. }
  483. Register.enterpriseBtnCountDown();
  484. var ajax = new $ax(Feng.ctxPath + "/common/auth/verificationCode?phone=" + agentPhone + "&type=1", function (data) {
  485. Feng.info(data.msg);
  486. }, function (data) {
  487. Feng.error("操作失败!" + data.responseJSON.message + "!");
  488. });
  489. ajax.set(null);
  490. ajax.start();
  491. };
  492. Register.enterpriseBtnCountDown = function () {
  493. if (enterpriseCountDown == 0) {
  494. enterpriseCountDown = 60;
  495. } else if (enterpriseCountDown == 1) {
  496. enterpriseSmsBtn.removeAttr("disabled");
  497. enterpriseSmsBtn.html("获取验证码");
  498. enterpriseCountDown = 0;
  499. return;
  500. }
  501. enterpriseSmsBtn.attr("disabled", true);
  502. enterpriseSmsBtn.html(enterpriseCountDown + "秒");
  503. enterpriseCountDown--;
  504. setTimeout("Register.enterpriseBtnCountDown()", 1000);
  505. };
  506. Register.getPersionSms = function () {
  507. var phone = $("#ps_phone").val();
  508. if (phone == null || phone == "") {
  509. Feng.info("请填写手机号!");
  510. return;
  511. }
  512. phone = $.trim(phone);
  513. if (!Feng.checkMobilePhoneNum(phone)) {
  514. Feng.info("手机号格式有误,请填写正确的手机号码!");
  515. return;
  516. }
  517. Register.getPersionBtnCountDown();
  518. var ajax = new $ax(Feng.ctxPath + "/common/auth/verificationCode?phone=" + phone + "&type=1", function (data) {
  519. Feng.info(data.msg);
  520. }, function (data) {
  521. Feng.error("操作失败!" + data.responseJSON.message + "!");
  522. });
  523. ajax.set(null);
  524. ajax.start();
  525. };
  526. Register.getPersionBtnCountDown = function () {
  527. if (persionCountDown == 0) {
  528. persionCountDown = 60;
  529. } else if (persionCountDown == 1) {
  530. psSmsBtn.removeAttr("disabled");
  531. psSmsBtn.html("获取验证码");
  532. persionCountDown = 0;
  533. return;
  534. }
  535. psSmsBtn.attr("disabled", true);
  536. psSmsBtn.html(persionCountDown + "秒");
  537. persionCountDown--;
  538. setTimeout("Register.getPersionBtnCountDown()", 1000);
  539. };
  540. /**
  541. * 企业用户注册回调
  542. */
  543. Register.epCallBack = function (data) {
  544. lock = false;
  545. var nowDis = $("#type").prop("disabled");
  546. if (isDis != nowDis) {
  547. $("#type").attr("disabled", "disabled");
  548. }
  549. Feng.info(data.msg);
  550. if (data.code == 200) {
  551. parent.layer.close(window.parent.Login.layerIndex);
  552. }
  553. };
  554. Register.typeChange = function () {
  555. $("#type").removeAttr("disabled");
  556. var type = $("#type").val();
  557. if (type == 1) {
  558. $("#typeGroup").attr("style", "display:block");
  559. } else {
  560. $("#typeGroup").attr("style", "display:none");
  561. $("#enterpriseTag,#industryFieldNew,#industryFieldOld").val("");
  562. }
  563. }
  564. Register.industryChange = function () {
  565. var industryNew = $("#industryFieldNew").val();
  566. var arr = [{"name": "industryFieldOld", "code": industryNew + "_field"}];
  567. Feng.findChildDictBatch(JSON.stringify(arr));
  568. }
  569. $(function () {
  570. $('#ep_form').bootstrapValidator({
  571. feedbackIcons: {
  572. valid: 'glyphicon glyphicon-ok',
  573. invalid: 'glyphicon glyphicon-remove',
  574. validating: 'glyphicon glyphicon-refresh'
  575. },
  576. group: '.rowGroup',
  577. fields: Register.validateFields,
  578. live: 'enabled',
  579. message: '该字段不能为空'
  580. });
  581. var userType = Feng.getUrlValue("userType");
  582. var username = Feng.getUrlValue("username");
  583. var name = Feng.getUrlValue("name");
  584. var idCard = Feng.getUrlValue("idCard");
  585. var type = Feng.getUrlValue("type");
  586. if (userType == 1) { //企业用户trigger
  587. $("#source").val(2);
  588. $("#username").val(username).attr("readonly", "readonly");
  589. $("#name").val(name).attr("readonly", "readonly");
  590. $("#idCard").val(idCard).attr("readonly", "readonly");
  591. $("#type").val(type).trigger("change");
  592. $("#type").attr("disabled", "disabled");
  593. $("#password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  594. $("#re_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  595. $("#personTab").css("pointer-events", "none");
  596. } else if (userType == 2) { //个人用户
  597. $("#personTab").css("pointer-events", "block");
  598. $("#personTab").children().click();
  599. $("#ps_source").val(2);
  600. $("#ps_username").val(name).attr("readonly", "readonly");
  601. $("#ps_idCard").val(idCard).attr("readonly", "readonly");
  602. $("#ps_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  603. $("#ps_re_password").val("").attr("placeholder", "密码为聚才网账号密码").attr("readonly", "readonly");
  604. $("#enTab").css("pointer-events", "none");
  605. } else { //无
  606. }
  607. var arr = [
  608. {"name": "street", "code": "street"},
  609. {"name": "enterpriseTag", "code": "enterprise_tag"},
  610. {"name": "industryFieldNew", "code": "industry_field"},
  611. {"name": "enterpriseType", "code": "enterprise_type"},
  612. {"name": "sy_street", "code": "street"}];
  613. Feng.findChildDictBatch(JSON.stringify(arr));
  614. $("#imgurl,#sy_imgurl,#bankImg,#sy_bankImg,#beian,#domainImg,#typeImg").change(function (e) {
  615. var that = this;
  616. if (!Feng.chkFileInvalid(that.files[0], 5, 10)) {
  617. return;
  618. }
  619. var file = that.files[0];
  620. var imgSrc;
  621. var reader = new FileReader();
  622. reader.readAsDataURL(file);
  623. reader.onload = function () {
  624. if (Feng.isImg(file.type)) {
  625. imgSrc = this.result;
  626. $(that).prev("img").attr("src", imgSrc);
  627. } else {
  628. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  629. }
  630. };
  631. });
  632. });