register.js 41 KB

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