阜外心血管项目前端

register.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. var openid = helper.cookies.get("openid");
  2. // var type = helper.request.queryString("type");
  3. //项目名称
  4. $(function() {
  5. //返回上一步
  6. $("#login-last").on('tap', function() {
  7. $(".progress-img1").show();
  8. $(".progress-img2").hide();
  9. $(".progress-div1").show();
  10. $(".progress-div2").hide();
  11. $("#login-submit").hide();
  12. $("#login-next").show();
  13. $("#login-last").hide();
  14. })
  15. //登陆验证
  16. $("#login-next").on('tap', function() {
  17. var identityCard= /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; //身份证号
  18. var userNameReg= /^[\u4E00-\u9FA5\uf900-\ufa2d(·|•)s]{2,20}$/;//2-20位包含少数名族
  19. // alert(IDcard);
  20. // if (!$("#nickname").val()) {
  21. // mui.alert("昵称不能为空");
  22. // } else if(!$("#fullname").val()){
  23. // mui.alert("姓名不能为空");
  24. // }else if(!userNameReg.test($("#fullname").val())){
  25. // mui.alert("姓名为2到20个字符");
  26. // } else if(!$("#idcard").val()){
  27. // mui.alert("身份证号不能为空");
  28. // } else if(!identityCard.test($("#idcard").val())){
  29. // mui.alert("身份证号格式错误");
  30. // }else if($(!"#order_rengin").val()){
  31. // mui.alert("项目不能为空");
  32. // }else if (!$("#room").val()){
  33. // mui.alert("房间号不能为空");
  34. // }else{
  35. //
  36. //
  37. // }
  38. $(".progress-img2").show();
  39. $(".progress-img1").hide();
  40. $(".progress-div2").show();
  41. $(".progress-div1").hide();
  42. $("#login-next").hide();
  43. $("#login-submit").show();
  44. $("#login-last").show();
  45. })
  46. $("#login-submit").on('tap', function() {
  47. if ($("#usercode").val()=="") {
  48. mui.alert("手机号不能为空");
  49. } else if($("#password").val()==""){
  50. mui.alert("密码不能为空");
  51. } else if($("#passwordrep").val()==""){
  52. mui.alert("确认密码不能为空");
  53. }else{
  54. $.ajax({
  55. type: "post",
  56. url: huayi.config.callcenter_url + 'WxLogin/Register',
  57. async: true,
  58. dataType: 'json',
  59. data: {
  60. nickname: $("#nickname").val(), //昵称
  61. fullname: $("#fullname").val(), //姓名
  62. usercode: $("#usercode").val(), //手机号
  63. password: $("#password").val(), //密码
  64. passwordrep: $("#passwordrep").val(), //重复密码
  65. project: $("#order_rengin").attr('data-index'), //项目ID
  66. room: $("#room").val(), //房间号
  67. idcard: $("#idcard").val(), //身份证号
  68. openid: openid,
  69. openid: 'oXF5e1mWpX5DajW5_yjNLPKb8ThE', //微信openid 测试用
  70. },
  71. success: function(data) {
  72. if(data.state.toLowerCase() == "success") {
  73. var UserType = data.data.usertype;
  74. var UserCode = data.data.usercode;
  75. UserWord = $("#password").val();
  76. var FullName = data.data.fullname;
  77. var NickName = data.data.nickname;
  78. helper.cookies.set("usercode", UserCode, 7);
  79. helper.cookies.set("usertype", UserType, 7);
  80. helper.cookies.set("userword", UserWord, 7);
  81. helper.cookies.set("fullname", FullName, 7);
  82. helper.cookies.set("nickname", NickName, 7);
  83. debugger
  84. mui.alert("注册成功");
  85. window.location.href = "user/client_index.html";
  86. // var btnArray = ['否', '是'];
  87. // mui.confirm( '完成注册', btnArray, function(e) {
  88. // if (e.index == 1) {
  89. // window.location.href = "user/client_index.html";
  90. // }
  91. // })
  92. } else {
  93. mui.alert(data.message);
  94. }
  95. }
  96. })
  97. }
  98. })
  99. var areaList = [];
  100. $.ajax({
  101. type: "get",
  102. url: huayi.config.callcenter_url + 'CusRegionCategory/GetListTreeDrop',
  103. async: false,
  104. data: {},
  105. dataType: 'json',
  106. success: function(data) {
  107. console.log(data)
  108. areaList = data.data;
  109. // alert(JSON.stringify(data));
  110. }
  111. });
  112. (function($, doc) {
  113. //项目名称
  114. var ZTiPickers = new $.PopPicker({
  115. layer: 3
  116. });
  117. var ZXs = doc.getElementById('project');
  118. var ZXResults = doc.getElementById('order_rengin');
  119. var ZXResults2 = doc.getElementById('order_pro');
  120. var ZXResults3 = doc.getElementById('order_floor');
  121. ZXs.addEventListener('tap', function(event) {
  122. ZTiPickers.setData(areaList);
  123. ZTiPickers.show(function(items) {
  124. console.log(items)
  125. if (items[2].text==undefined) {
  126. ZXResults.value = items[0].text + "-" + items[1].text;
  127. } else if (items[1].text==undefined) {
  128. ZXResults.value = items[0].text;
  129. } else{
  130. ZXResults.value = items[0].text + "-" + items[1].text + "-" + items[2].text
  131. }
  132. ZXResults.setAttribute("data-index", items[1].id);
  133. //返回 false 可以阻止选择框的关闭
  134. //return false;
  135. });
  136. }, false);
  137. })(mui, document);
  138. })