enterprise_edit.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 username = $("#username").val();
  9. var name = $("#name").val();
  10. var idCard = $("#idCard").val();
  11. var agentName = $("#agentName").val();
  12. var agentPhone = $("#agentPhone").val();
  13. var legal = $("#legal").val();
  14. var street = $("#street").val();
  15. var address = $("#address").val();
  16. var type = $("#type").val();
  17. var special = $("#special").val();
  18. var agentEmail = $("#agentEmail").val();
  19. var ephone = $("#ephone").val();
  20. var bankCard = $("#bankCard").val();
  21. var bank = $("#bank").val();
  22. var bankNetwork = $("#bankNetwork").val();
  23. if (username == null || username == '') {
  24. Feng.info("请填写账号!");
  25. return;
  26. }
  27. if (username.length > 50) {
  28. Feng.info("账号最多50个字符!");
  29. return;
  30. }
  31. if (name == null || name == '') {
  32. Feng.info("请填写单位名称!");
  33. return;
  34. }
  35. if (name.length > 100) {
  36. Feng.info("单位名称最多100个字符!");
  37. return;
  38. }
  39. if (idCard == null || idCard == '') {
  40. Feng.info("请填写统一社会信用代码!");
  41. return;
  42. }
  43. if (type == null || type == '') {
  44. Feng.info("请选择申报类型!");
  45. return;
  46. }
  47. if (idCard.length > 40) {
  48. Feng.info("统一社会信用代码最多40个字符!");
  49. return;
  50. }
  51. if (agentName == null || agentName == '') {
  52. Feng.info("请填写人才联络员!");
  53. return;
  54. }
  55. if (agentName.length > 30) {
  56. Feng.info("人才联络员最多30个字符!");
  57. return;
  58. }
  59. if (agentPhone == null || agentPhone == '') {
  60. Feng.info("请填写人才联络员电话!");
  61. return;
  62. }
  63. if (ephone == null || ephone == '') {
  64. Feng.info("请填写单位电话");
  65. return;
  66. }
  67. if (legal == null || legal == '') {
  68. Feng.info("请填写法人代表!");
  69. return;
  70. }
  71. if (street == null || street == '') {
  72. Feng.info("请选择所属街道!");
  73. return;
  74. }
  75. if (address == null || address == '') {
  76. Feng.info("请填写单位地址!");
  77. return;
  78. }
  79. if (bankCard == null || bankCard == '') {
  80. Feng.info("请填写企业银行账号!");
  81. return;
  82. }
  83. if (bank == null || bank == '') {
  84. Feng.info("请填写企业开户银行!");
  85. return;
  86. }
  87. if (bankNetwork == null || bankNetwork == '') {
  88. Feng.info("请填写企业开户银行网点!");
  89. return;
  90. }
  91. if (type == null || type == '') {
  92. Feng.info("请选择企业类别");
  93. return;
  94. }
  95. if (agentEmail == null || agentEmail == '') {
  96. Feng.info("请填写电子邮箱!");
  97. return;
  98. }
  99. if (special == 0 && type == 1) {
  100. var industryFieldNew = $("#industryFieldNew").val();
  101. var industryFieldOld = $("#industryFieldOld").val();
  102. var domainImg = $("#domainImg").val();
  103. var enterpriseTag = $("#enterpriseTag").val();
  104. var enterpriseType = $("#enterpriseType").val();
  105. if (enterpriseTag == null || enterpriseTag == '') {
  106. Feng.info("请选择企业标签!");
  107. return;
  108. }
  109. if (industryFieldNew == null || industryFieldNew == '') {
  110. Feng.info("请选择产业领域");
  111. return;
  112. }
  113. if (industryFieldOld == null || industryFieldOld == '') {
  114. Feng.info("请选择行业领域");
  115. return;
  116. }
  117. if (enterpriseType == null || enterpriseType == '') {
  118. Feng.info("请选择企业类型!");
  119. return;
  120. }
  121. }
  122. 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)) {
  123. Feng.info("单位电话格式不合法!");
  124. return;
  125. }
  126. 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)) {
  127. Feng.info("人才联络员电话格式不合法!");
  128. return;
  129. }
  130. if (!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)) {
  131. Feng.info("电子邮箱格式不合法!");
  132. return;
  133. }
  134. $("#ep_form")[0].submit();
  135. };
  136. /**
  137. * 企业用户注册回调
  138. */
  139. Register.epCallBack = function (data) {
  140. $("#agentPhone").prop("disabled", true);
  141. Feng.info(data.msg);
  142. if (data.code == 200) {
  143. setInterval(function () {
  144. window.location.href = Feng.ctxPath + "/";
  145. }, 3000);
  146. }
  147. };
  148. Register.typeChange = function () {
  149. var type = $("#type").val();
  150. if (type == 1) {
  151. $("#typeGroup").attr("style", "display:block");
  152. } else {
  153. $("#typeGroup").attr("style", "display:none");
  154. }
  155. }
  156. Register.industryChange = function () {
  157. var industryNew = $("#industryFieldNew").val();
  158. var arr = [{"name": "industryFieldOld", "code": industryNew + "_field"}];
  159. Feng.findChildDictBatch(JSON.stringify(arr));
  160. }
  161. $("#imgurl,#bankImg,#beian,#domainImg").change(function (e) {
  162. var that = this;
  163. if (!Feng.chkFileInvalid(that.files[0], 10, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "只允许上传PDF或图片")) {
  164. return;
  165. }
  166. var file = that.files[0];
  167. var imgSrc;
  168. var reader = new FileReader();
  169. reader.readAsDataURL(file);
  170. reader.onload = function () {
  171. if (Feng.isImg(file.type)) {
  172. imgSrc = this.result;
  173. $(that).prev("img").attr("src", imgSrc);
  174. } else {
  175. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  176. }
  177. };
  178. });
  179. $(function () {
  180. var industryNew = $("#industryFieldNew").attr("value");
  181. var arr = [
  182. {"name": "street", "code": "street"},
  183. {"name": "enterpriseTag", "code": "enterprise_tag"},
  184. {"name": "enterpriseType", "code": "enterprise_type"},
  185. {"name": "industryFieldNew", "code": "industry_field"},
  186. {"name": "industryFieldOld", "code": industryNew + "_field"}];
  187. Feng.findChildDictBatch(JSON.stringify(arr));
  188. $("select").each(function () {
  189. $(this).val($(this).attr("value"));
  190. $(this).trigger("change");
  191. });
  192. });