ProblemUserVer.cshtml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta charset="utf-8">
  9. <title>中联区卫产品登记</title>
  10. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  11. <link href="~/Content/Scripts/plugins/mui/css/mui.css" rel="stylesheet" />
  12. <script src="~/Content/Scripts/jquery.min.js"></script>
  13. <script src="~/Content/Scripts/plugins/mui/js/mui.js"></script>
  14. <script src="~/Content/Scripts/jquery.min.js"></script>
  15. <script src="~/Content/Scripts/babel.min.js"></script>
  16. <script src="~/Content/Scripts/polyfill.min.js"></script>
  17. </head>
  18. <body>
  19. <style>
  20. .mui-toast-container {
  21. bottom: 50% !important;
  22. }
  23. .mui-bar-nav {
  24. background-color: #00aaff;
  25. }
  26. .mui-btn-success{
  27. color: #fff;
  28. border: 1px solid #00aaff;
  29. background-color: #00aaff;
  30. }
  31. </style>
  32. <header class="mui-bar mui-bar-nav ">
  33. <h1 class="mui-title" style="color:white">用户注册</h1>
  34. </header>
  35. <!-- 主页面内容容器 -->
  36. <div class="mui-content ">
  37. <!-- 主界面具体展示内容 -->
  38. <h5 class="mui-content-padded"><span class="mui-icon iconfont icon-p9zhonglei" style="color: #8F8F94; margin-right: 7px"></span>用户信息</h5>
  39. <ul class="mui-table-view mui-table-view-chevron" id="tab"></ul>
  40. <ul class="mui-table-view ">
  41. <li class="mui-table-view-cell">
  42. <a>机构<span class="mui-pull-right" id="InstitutionsName" style="color:#8f8f94"></span></a>
  43. </li>
  44. </ul>
  45. <form class="mui-input-group" style="margin-top:10px">
  46. <div class="mui-input-row">
  47. <label>姓名</label>
  48. <input id="name" type="text" class="mui-input-clear" placeholder="请输入姓名">
  49. </div>
  50. <div class="mui-input-row">
  51. <label>科室</label>
  52. <input id="Department" type="text" class="mui-input-clear" placeholder="请输入科室">
  53. </div>
  54. <div class="mui-input-row">
  55. <label>手机号码</label>
  56. <input id="telephone" type="text" class="mui-input-clear" placeholder="请输入手机号码">
  57. </div>
  58. <div class="mui-input-row">
  59. <label>密码</label>
  60. <input id="password" type="password" class="mui-input-clear" placeholder="请输入密码">
  61. </div>
  62. <div class="mui-input-row">
  63. <label>确认密码</label>
  64. <input id="SurePassword" type="password" class="mui-input-clear" placeholder="请输入确认密码">
  65. </div>
  66. <div class="mui-input-row">
  67. <input id="Code" type="password" style="width:60%" class="mui-input" placeholder="请输入验证码">
  68. <button id="GetCode" type="button" class="mui-btn mui-btn-success" style="margin-top:5px;margin-right:5px;width:110px">获取验证码</button>
  69. </div>
  70. </form>
  71. <button type="button" style="margin-top: 10px;" class="mui-btn mui-btn-success mui-btn-block btn_2" onclick="UserRegist()">注册</button>
  72. </div>
  73. <script type="text/babel">
  74. var PersonResource_id = "@ViewBag.PersonResource_id";
  75. var InstitutionsSorId = "@ViewBag.InstitutionsSorId";
  76. var InstitutionsID;
  77. $(document).ready(function () {
  78. mui.init();
  79. findUser();
  80. });
  81. function findUser() {
  82. if (!PersonResource_id || !InstitutionsSorId) {
  83. mui.alert("找不到资源信息,请重新扫描二维码,或者联系管理员!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin" }, 'div');
  84. return;
  85. }
  86. UserCheck();
  87. }
  88. ///获取站点信息
  89. function GetInstitutions() {
  90. $.post("/MobileAccount/GetInstitutions", { "InstitutionsSorID": InstitutionsSorId }, function (data) {
  91. if (!data||data.length==0) {
  92. mui.alert("找不到机构信息,请联系管理员!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin" }, 'div');
  93. return;
  94. } else {
  95. InstitutionsID = data[0].ID;
  96. $("#InstitutionsName").html(data[0].名称);
  97. }
  98. })
  99. }
  100. ///用户校验
  101. function UserCheck() {
  102. $.post("/MobileAccount/UserCheck", { "PersonResource_id": PersonResource_id }, function (data) {
  103. if (data.code == 200) {
  104. if (data.msg == "2") {
  105. window.location.href = "/MobileAccount/MobileProblemLogin" ;
  106. }
  107. else if (data.msg == "0") {
  108. GetInstitutions();
  109. } else if (data.msg == "1" ) {
  110. GetInstitutions();
  111. GetExistInfo();
  112. }
  113. } else {
  114. mui.toast(data.msg, { duration: 'long', type: 'div' });
  115. }
  116. })
  117. }
  118. ///获取用户已存在信息
  119. function GetExistInfo() {
  120. $.post("/MobileAccount/GetExistInfo", { "PersonResource_id": PersonResource_id }, function (data) {
  121. $("#name").val(data[0].姓名);
  122. $("#Department").val(data[0].部门名);
  123. $("#telephone").val(data[0].联系电话);
  124. });
  125. }
  126. ///获取验证码
  127. document.getElementById('GetCode').addEventListener('tap', function () {
  128. // if (!/^(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8}|(170[059])[0-9]{6}$/i
  129. if (!/^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/.test($('#telephone').val())) {
  130. mui.toast('请输入正确的手机号码', { duration: 'long', type: 'div' });
  131. $('#telephone').val('');
  132. $('#telephone').focus();
  133. return;
  134. }
  135. var obj = $('#GetCode');
  136. // 重新发送倒计时
  137. var validCode = true;
  138. var time = 60;
  139. if (validCode) {
  140. validCode = false;
  141. var t = setInterval(function () {
  142. time--;
  143. $(obj).html('重新获取(' + time + 's)');
  144. $('#GetCode').attr('disabled', 'disabled');
  145. if (time == 0) {
  146. clearInterval(t);
  147. $(obj).html("重新获取");
  148. validCode = true;
  149. sms_flag = true;
  150. $('#GetCode').removeAttr('disabled');
  151. }
  152. }, 1000);
  153. }
  154. var tele = $('#telephone').val();
  155. $.post("/MobileAccount/GetSMSCode", { "tele": tele }, function (data) {
  156. if (data.code == "200") {
  157. mui.toast('短信发送成功', { duration: 'long', type: 'div' });
  158. } else {
  159. mui.toast('短信发送失败', { duration: 'long', type: 'div' });
  160. }
  161. }).error(function (xhr, type, errorThrown) {
  162. mui.toast('系统错误', { duration: 'long', type: 'div' });
  163. })
  164. });
  165. ///用户注册按钮
  166. function UserRegist() {
  167. var name = $("#name").val();
  168. var Department = $("#Department").val();
  169. var telephone = $("#telephone").val();
  170. var password = $("#password").val();
  171. var SurePassword = $("#SurePassword").val();
  172. var SMSCode = $("#Code").val();
  173. ///校验
  174. if (name == "" || name == null || Department == "" || Department == null || telephone == "" || telephone == null || password == "" || password == null || SMSCode == "" || SMSCode == null) {
  175. mui.toast('请填写完整信息', { duration: 'long', type: 'div' });
  176. return (false);
  177. }
  178. if (password != SurePassword) {
  179. mui.toast('两次密码不相等', { duration: 'long', type: 'div' });
  180. $('#password').focus();
  181. return (false);
  182. }
  183. var t = mui.showLoading("注册中...");
  184. $.post("/MobileAccount/UserRegist",
  185. { "name": name, "Department": Department, "telephone": telephone, "password": password, "SiteID": InstitutionsID, "UserGetId": PersonResource_id, "SMSCode": SMSCode }, function (data) {
  186. mui.hideLoading(t);
  187. if (data.msg == "3") {
  188. mui.alert("注册成功!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin?Tele=" + telephone; }, 'div');
  189. } else if (data.msg == "2") {
  190. mui.alert("验证码错误!", "提示", "确定", function () {
  191. $("#Code").val('');
  192. $("#Code").focus();
  193. return;
  194. }, 'div');
  195. } else if (data.msg == "1") {
  196. mui.toast('注册发生异常', { duration: 'long', type: 'div' });
  197. } else if (data.msg == "0") {
  198. mui.toast('验证码过期', { duration: 'long', type: 'div' });
  199. $("#Code").val('');
  200. $("#Code").focus();
  201. } else if (data.msg == "4") {
  202. mui.alert("账户已存在!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin?Tele=" + telephone; }, 'div');
  203. }
  204. else {
  205. mui.alert("注册失败!请查看日志", "提示", "确定", function () { }, 'div');
  206. }
  207. })
  208. }
  209. </script>
  210. </body>
  211. </html>