农燊高科官方网站
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

249 řádky
9.1 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "echarts", 'register', 'swiper'], function ($, template, Tools, echarts, swiper) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. type: 1
  9. },
  10. };
  11. var tools = new Tools();
  12. module.init = function (page) {
  13. //底部友情链接
  14. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  15. //点击注册
  16. $('#register-submit').on('click', module.register)
  17. //点击图形验证码
  18. $('#graphicImgBtn').on('click', module.verificationCode)
  19. //图形验证码加载
  20. module.verificationCode()
  21. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  22. tools.getWebConfig();
  23. module.getType();
  24. tools.doGet(Dictionaries+'/economic_type', {}, module.economicTypeDictionaries,true);
  25. };
  26. //底部友情链接
  27. module.bottomFriendsLinks = function (data) {
  28. if (data.code == 200) {
  29. var content = data.data;
  30. console.log(content)
  31. module.data.friendsLinksList = content;
  32. var friendsLinksData = template('friendsLinksData', module.data);
  33. $("#friendsLinksContent").html(friendsLinksData);
  34. }
  35. }
  36. //获取地址栏参数
  37. function getQueryVariable(variable){
  38. var query = window.location.search.substring(1);
  39. var vars = query.split("&");
  40. for (var i=0;i<vars.length;i++) {
  41. var pair = vars[i].split("=");
  42. if(pair[0] == variable){return pair[1];}
  43. }
  44. return(false);
  45. }
  46. //经济类型
  47. module.economicTypeDictionaries = function (data) {
  48. if (data.code == 200) {
  49. var content = data.data;
  50. console.log(content)
  51. module.data.outProjectInformationDetail = content;
  52. var outProjectInformationData = template('outProjectInformationData', module.data);
  53. $("#economicType").html(outProjectInformationData);
  54. }
  55. }
  56. module.getType = function(){
  57. var type = getQueryVariable("type");
  58. if (type == 1){
  59. document.getElementById("userBtn").className = "active";
  60. document.getElementById("companyBtn").className = "";
  61. tabCheck('user');
  62. module.data.type = type;
  63. }else if(type == 2){
  64. document.getElementById("userBtn").className = "";
  65. document.getElementById("companyBtn").className = "active";
  66. tabCheck('company');
  67. module.data.type = type;
  68. }
  69. }
  70. tabCheck = function(type,typeNum){
  71. document.getElementById("userBtn").className = "";
  72. document.getElementById("companyBtn").className = "";
  73. document.getElementById("userTable").style.display = "none";
  74. document.getElementById("companyTable").style.display = "none";
  75. module.data.type = typeNum;
  76. document.getElementById(type+'Btn').className = 'active';
  77. document.getElementById(type+'Table').style.display = 'block';
  78. }
  79. //图形验证码
  80. module.verificationCode = function () {
  81. tools.doGet(captchaImage_get, {}, module.verificationAjax, true)
  82. }
  83. module.verificationAjax = function (data) {
  84. if (data.code == 200) {
  85. $('#graphicImg').attr('src', 'data:image/gif;base64,' + data.img)
  86. module.uuid = data.uuid;
  87. }
  88. }
  89. //用户注册
  90. module.register = function (data) {
  91. var data = {};
  92. if(module.check()){
  93. if (module.data.type == 1){
  94. var phone = $('#phone').val();
  95. var passwordVal = $('#password').val();
  96. var codeVal = $('#code').val();
  97. var realName = $('#realName').val();
  98. var idCardNum = $('#idCardNum').val();
  99. var address = $('#address').val();
  100. var memberType = 1 ;
  101. data['phone'] = phone;
  102. data['password'] = passwordVal;
  103. data['code'] = codeVal;
  104. data['realname'] = realName;
  105. data['idCardNum'] = idCardNum;
  106. data['address'] = address;
  107. data['economicType'] = 1;
  108. }
  109. if (module.data.type == 2){
  110. var phone = $('#phone').val();
  111. var passwordVal = $('#password').val();
  112. var codeVal = $('#code').val();
  113. var companyName = $('#companyName').val();
  114. var realName = $('#companyRealName').val();
  115. var idCardNum = $('#companyIdCardNum').val();
  116. var address = $('#companyAddress').val();
  117. var companyLicense = $('#companyLicense').val();
  118. var companyCode = $('#companyCode').val();
  119. var economicType = $('#economicType').val();
  120. data['phone'] = phone;
  121. data['password'] = passwordVal;
  122. data['code'] = codeVal;
  123. data['realname'] = realName;
  124. data['idCardNum'] = idCardNum;
  125. data['address'] = address;
  126. data['companyName'] = companyName;
  127. data['companyLicense'] = companyLicense;
  128. data['companyCode'] = companyCode;
  129. data['economicType'] = economicType;
  130. }
  131. data['memberType'] = module.data.type;
  132. tools.doPost(userRegister, data, module.registerData, true)
  133. }
  134. }
  135. //注册校验
  136. module.registerData = function (data) {
  137. console.log(data)
  138. if (data.code == 500) {
  139. module.verificationCode()
  140. }
  141. if (data.code == 200){
  142. tools.initError("注册成功");
  143. setTimeout(function(){
  144. tools.skip('login.html')
  145. },2000)
  146. }
  147. }
  148. //手动验证表单
  149. module.check = function () {
  150. var phone = $('#phone').val();
  151. var passwordVal = $('#password').val();
  152. var codeVal = $('#code').val();
  153. var realName = $('#realName').val();
  154. var idCardNum = $('#idCardNum').val();
  155. var address = $('#address').val();
  156. var companyRealName = $('#companyRealName').val();
  157. var companyIdCardNum = $('#companyIdCardNum').val();
  158. var companyAddress = $('#companyAddress').val();
  159. /* 手机号 */
  160. if (phone == '') {
  161. $('#phone')[0].focus()
  162. tools.initTips('请输入手机号', 'right', $('#phone')[0], 2000)
  163. return false;
  164. }
  165. if (module.data.type == 1) {
  166. /* 姓名 */
  167. if (realName == '') {
  168. $('#realName')[0].focus()
  169. tools.initTips('请输入姓名', 'right', $('#realName')[0], 2000)
  170. return false;
  171. }
  172. /* 身份证号 */
  173. if (idCardNum == '') {
  174. $('#idCardNum')[0].focus()
  175. tools.initTips('请输入身份证号', 'right', $('#idCardNum')[0], 2000)
  176. return false;
  177. }
  178. /* 地址 */
  179. if (address == '') {
  180. $('#address')[0].focus()
  181. tools.initTips('请输入地址', 'right', $('#address')[0], 2000)
  182. return false;
  183. }
  184. }
  185. if (module.data.type == 2){
  186. /* 姓名 */
  187. if (companyRealName == '') {
  188. $('#companyRealName')[0].focus()
  189. tools.initTips('请输入姓名', 'right', $('#companyRealName')[0], 2000)
  190. return false;
  191. }
  192. /* 身份证号 */
  193. if (companyIdCardNum == '') {
  194. $('#companyIdCardNum')[0].focus()
  195. tools.initTips('请输入身份证号', 'right', $('#companyIdCardNum')[0], 2000)
  196. return false;
  197. }
  198. /* 地址 */
  199. if (companyAddress == '') {
  200. $('#companyAddress')[0].focus()
  201. tools.initTips('请输入地址', 'right', $('#companyAddress')[0], 2000)
  202. return false;
  203. }
  204. }
  205. /* 密码 */
  206. if (passwordVal == '') {
  207. $('#password')[0].focus()
  208. tools.initTips('请输入密码', 'right', $('#password')[0], 2000)
  209. return false;
  210. } else if (parseInt(passwordVal.length) < 6 || parseInt(passwordVal.length) > 18) {
  211. $('#password')[0].focus()
  212. tools.initTips('请输入正确格式密码', 'right', $('#password')[0], 2000)
  213. return false;
  214. }else if($('#password').val() != $('#passwordAgain').val()){
  215. $('#password')[0].focus()
  216. tools.initTips('两次密码输入不一致', 'right', $('#password')[0], 2000)
  217. return false;
  218. }
  219. /*图形验证码*/
  220. if (module.uuid == '' || codeVal == '') {
  221. $('#code')[0].focus()
  222. tools.initTips('请输入图形验证码', 'right', $('#code')[0], 2000)
  223. return false;
  224. }
  225. console.log($('#iAgree:checked').val())
  226. if ($('#iAgree:checked').val() == undefined){
  227. tools.initTips('请选择我已同意', 'right', $('#iAgree')[0], 2000)
  228. return false;
  229. }
  230. return true;
  231. }
  232. return module;
  233. });