register.js 24 KB

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