AccountVerification.cshtml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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/vue.js"></script>
  15. </head>
  16. <body>
  17. <style>
  18. .mui-btn{
  19. line-height:0.8
  20. }
  21. .mui-bar-nav {
  22. background-color: #00aaff;
  23. }
  24. .mui-btn-positive, .mui-btn-success, .mui-btn-green {
  25. color: #fff;
  26. border: 1px solid #00aaff;
  27. background-color: #00aaff;
  28. }
  29. html,
  30. body,
  31. #vue,
  32. .mui-content{
  33. height:100%!important
  34. }
  35. .mui-input-group{
  36. top:5%;
  37. }
  38. .success{
  39. position: absolute;
  40. top: 0;
  41. font-size:40px;
  42. right: 0;
  43. }
  44. .mui-icon-clear{
  45. right:30px!important
  46. }
  47. </style>
  48. <div id="vue">
  49. <header class="mui-bar mui-bar-nav">
  50. <a class="mui-action-back mui-icon mui-icon-back mui-pull-left" style="color:white"></a>
  51. <h1 class="mui-title" style="color:white">手机号码验证</h1>
  52. <button class="mui-btn mui-btn-link mui-pull-right" style="color:white" v-on:click="Register">注册</button>
  53. </header>
  54. <div class="mui-content ">
  55. <form class="mui-input-group" >
  56. <div class="mui-input-row">
  57. <input v-model="telephone" v-on:keyup="IsAccountExist" type="number" class="mui-input-clear " placeholder="请输入手机号码">
  58. <span v-if="successStatus" class="mui-icon mui-icon-checkmarkempty mui-active success"></span>
  59. </div>
  60. <div class="mui-input-row">
  61. <input v-model="Code" type="text" style="width:60%" class="mui-input" placeholder="请输入验证码">
  62. <button v-on:click="GetSMS" v-bind:disabled="SMS!='获取验证码'" type="button" class="mui-btn mui-btn-success" style="margin-top:5px;margin-right:5px;width:110px">{{SMS}}</button>
  63. </div>
  64. <button type="button" style="margin-top: 10px;" class="mui-btn mui-btn-success mui-btn-block btn_2" v-on:click="ModifyPassword">提交</button>
  65. </form>
  66. </div>
  67. </div>
  68. <script>
  69. var vm = new Vue({
  70. el: '#vue',
  71. data: {
  72. SMS: '获取验证码',
  73. telephone: '',
  74. Code: '',
  75. successStatus:false
  76. },
  77. methods: {
  78. GetSMS: function () {
  79. var that = this;
  80. /* if (!/^(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8}|(170[059])[0-9]{6}$/i.test(this.telephone))*/
  81. 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(this.telephone)) {
  82. mui.toast('请输入正确的手机号码', { duration: 'long', type: 'div' });
  83. this.telephone = '';
  84. return;
  85. }
  86. var validCode = true;
  87. var time = 60;
  88. if (validCode) {
  89. validCode = false;
  90. var t = setInterval(function () {
  91. time--;
  92. that.SMS = '重新获取(' + time + 's)';
  93. if (time == 0) {
  94. clearInterval(t);
  95. that.SMS = '获取验证码';
  96. validCode = true;
  97. }
  98. }, 1000);
  99. }
  100. $.post("/MobileAccount/GetSMSCode", { "tele": that.telephone }, function (data) {
  101. if (data.code == "200") {
  102. mui.toast('短信发送成功', { duration: 'long', type: 'div' });
  103. } else {
  104. mui.toast('短信发送失败【' + data.msg + "】", { duration: 'long', type: 'div' });
  105. }
  106. }).error(function (xhr, type, errorThrown) {
  107. mui.toast('系统错误', { duration: 'long', type: 'div' });
  108. })
  109. },
  110. ModifyPassword: function () {
  111. var that = this;
  112. if (!this.telephone || !this.Code) {
  113. mui.toast('请填写完整信息', { duration: 'long', type: 'div' });
  114. return;
  115. }
  116. var t = mui.showLoading("验证中..", "div");
  117. $.post("/MobileAccount/WechatVerification", { telephone: that.telephone, Code: that.Code }, function (data) {
  118. mui.hideLoading(t);
  119. if (data.code == 200) {
  120. mui.showLoading("验证成功,正在跳转..", "div");
  121. window.location.href = "/MobileProblem/Home";
  122. } else {
  123. mui.toast('验证失败,'+data.msg, { duration: 'long', type: 'div' });
  124. }
  125. })
  126. },
  127. IsAccountExist: function () {
  128. var that = this;
  129. this.successStatus = false;
  130. if (this.telephone.length == 11) {
  131. var t= mui.showLoading("...", "div");
  132. $.post("/MobileAccount/IsAccountExist", { tele: this.telephone }, function (data) {
  133. mui.hideLoading(t);
  134. if (data == '1') {
  135. that.successStatus = true;
  136. } else {
  137. mui.toast('账户不存在,请联系管理员及右上角注册,或BH扫码注册!', { duration: 'long', type: 'div' });
  138. }
  139. })
  140. }
  141. },
  142. Register: function () {
  143. window.location = "/MobileAccount/Register";
  144. }
  145. },
  146. mounted: function () {
  147. mui.back = function (event) {
  148. window.location.href = '/MobileAccount/MobileProblemLogin?isOpenWechatLgoin=0';
  149. }
  150. }
  151. });
  152. </script>
  153. </body>
  154. </html>