enterprise_edit.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. var Register = {};
  2. var enterpriseCountDown = 0;
  3. var enterpriseSmsBtn = $("#enterprise_sms_btn");
  4. var persionCountDown = 0;
  5. var psSmsBtn = $("#ps_sms_btn");
  6. Register.enterpriseUserRegister = function () {
  7. $("#agentPhone").removeAttr("disabled");
  8. var type = $("#type").val();
  9. var special = $("#special").val();
  10. var enterpriseTypeName = "学校";
  11. var idCardName = "统一社会信用代码";
  12. var username = $("#username").val();
  13. var name = $("#name").val();
  14. var idCard = $("#idCard").val();
  15. var legal = $("#legal").val();
  16. var province = $("#province").val();
  17. var city = $("#city").val();
  18. var county = $("#county").val();
  19. var address = $("#address").val();
  20. var ephone = $("#ephone").val();
  21. var agentName = $("#agentName").val();
  22. var agentPhone = $("#agentPhone").val();
  23. var agentEmail = $("#agentEmail").val();
  24. if (username == null || username == '') {
  25. Feng.info("请填写账号!");
  26. return;
  27. }
  28. if (username.length > 50) {
  29. Feng.info("账号最多50个字符!");
  30. return;
  31. }
  32. if (name == null || name == '') {
  33. Feng.info("请填写" + enterpriseTypeName + "名称!");
  34. return;
  35. }
  36. if (name.length > 100) {
  37. Feng.info(enterpriseTypeName + "名称最多100个字符!");
  38. return;
  39. }
  40. if (idCard == null || idCard == '') {
  41. Feng.info("请填写" + idCardName + "!");
  42. return;
  43. }
  44. if (idCard.length > 40) {
  45. Feng.info(idCardName + "最多40个字符!");
  46. return;
  47. }
  48. if (legal == null || legal == '') {
  49. Feng.info("请填写法人代表!");
  50. return;
  51. }
  52. if (ephone == null || ephone == '') {
  53. Feng.info("请填写" + enterpriseTypeName + "电话");
  54. return;
  55. }
  56. if (province == null || province == '') {
  57. Feng.info("请选择" + enterpriseTypeName + "所在省份!");
  58. return;
  59. }
  60. if (city == null || city == '') {
  61. Feng.info("请选择" + enterpriseTypeName + "所在市!");
  62. return;
  63. }
  64. if ((county == null || county == '') && $("#county option").length > 1 && !$("#county").val()) {
  65. Feng.info("请选择" + enterpriseTypeName + "所在县\区!");
  66. return;
  67. }
  68. if (address == null || address == '') {
  69. Feng.info("请填写" + enterpriseTypeName + "地址!");
  70. return;
  71. }
  72. if (agentName == null || agentName == '') {
  73. Feng.info("请填写人才联络员!");
  74. return;
  75. }
  76. if (agentName.length > 30) {
  77. Feng.info("人才联络员最多30个字符!");
  78. return;
  79. }
  80. if (agentPhone == null || agentPhone == '') {
  81. Feng.info("请填写人才联络员电话!");
  82. return;
  83. }
  84. if (agentEmail == null || agentEmail == '') {
  85. Feng.info("请填写电子邮箱!");
  86. return;
  87. }
  88. 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)) {
  89. Feng.info(enterpriseTypeName + "电话格式不合法!");
  90. return;
  91. }
  92. 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)) {
  93. Feng.info("人才联络员电话格式不合法!");
  94. return;
  95. }
  96. if (!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)) {
  97. Feng.info("电子邮箱格式不合法!");
  98. return;
  99. }
  100. $("#ep_form")[0].submit();
  101. };
  102. /**
  103. * 企业用户注册回调
  104. */
  105. Register.epCallBack = function (data) {
  106. $("#agentPhone").prop("disabled", true);
  107. Feng.info(data.msg);
  108. if (data.code == 200) {
  109. setInterval(function () {
  110. window.location.href = Feng.ctxPath + "/";
  111. }, 3000);
  112. }
  113. };
  114. $("#imgurl,#bankImg,#beian,#domainImg,#typeImg").change(function (e) {
  115. var that = this;
  116. if (!Feng.chkFileInvalid(that.files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "只允许上传PDF或图片")) {
  117. return;
  118. }
  119. var file = that.files[0];
  120. var imgSrc;
  121. var reader = new FileReader();
  122. reader.readAsDataURL(file);
  123. reader.onload = function () {
  124. if (Feng.isImg(file.type)) {
  125. imgSrc = this.result;
  126. $(that).prev("img").attr("src", imgSrc);
  127. } else {
  128. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  129. }
  130. };
  131. });
  132. Register.setFieldDisabled = function () {
  133. //注释注册驳回$("#ep_form :input").not("button").prop("disabled", true);
  134. var fields = $("#fields").val().split(",");
  135. for (var i in fields) {
  136. $("#" + fields[i]).removeAttr("disabled");
  137. }
  138. var files = $("#files").val().split(",");
  139. for (var i in files) {
  140. switch (files[i]) {
  141. case "imgurl":
  142. $("#imgurl").removeAttr("disabled");
  143. var html = $("#imgurl").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  144. $("#imgurl").parent().find("label").html(html);
  145. break;
  146. case "bankImg":
  147. $("#bankImg").removeAttr("disabled");
  148. var html = $("#bankImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  149. $("#bankImg").parent().find("label").html(html);
  150. break;
  151. case "domainImg":
  152. $("#domainImg").removeAttr("disabled");
  153. var html = $("#domainImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  154. $("#domainImg").parent().find("label").html(html);
  155. break;
  156. case "typeImg":
  157. $("#typeImg").removeAttr("disabled");
  158. var html = $("#typeImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  159. $("#typeImg").parent().find("label").html(html);
  160. break;
  161. case "beian":
  162. $("#beian").removeAttr("disabled");
  163. var html = $("#beian").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  164. $("#beian").parent().find("label").html(html);
  165. break;
  166. }
  167. }
  168. }
  169. Register.afterSelectProvince = function () {
  170. var province = $("#province").val();
  171. $("#city").empty();
  172. $("#county").empty();
  173. if (province == null || province == '') {
  174. return;
  175. }
  176. Feng.addAjaxSelect({
  177. "id": "city",
  178. "displayCode": "code",
  179. "displayName": "name",
  180. "type": "GET",
  181. "url": Feng.ctxPath + "/common/tool/findCityByProvinceSelect/code/" + province
  182. });
  183. }
  184. /**
  185. * 加载县
  186. */
  187. Register.afterSelectCity = function () {
  188. var city = $("#city").val();
  189. $("#county").empty();
  190. if (city == null || city == '') {
  191. return;
  192. }
  193. Feng.addAjaxSelect({
  194. "id": "county",
  195. "displayCode": "code",
  196. "displayName": "name",
  197. "type": "GET",
  198. "url": Feng.ctxPath + "/common/tool/findCountyByCitySelect/code/" + city
  199. });
  200. }
  201. $(function () {
  202. //加载省份
  203. Feng.addAjaxSelect({
  204. "id": "province",
  205. "displayCode": "code",
  206. "displayName": "name",
  207. "type": "GET",
  208. "url": Feng.ctxPath + "/common/tool/getProvinceSelect"
  209. });
  210. $("select").each(function () {
  211. $(this).val($(this).attr("value"));
  212. $(this).trigger("change");
  213. });
  214. Register.setFieldDisabled();
  215. });