enterprise_edit.js 7.2 KB

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