register.js 41 KB

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