ModifyPassword.cshtml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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-bar-nav {
  19. background-color: #00aaff;
  20. }
  21. .mui-btn-positive, .mui-btn-success, .mui-btn-green {
  22. color: #fff;
  23. border: 1px solid #00aaff;
  24. background-color: #00aaff;
  25. }
  26. </style>
  27. <div id="vue">
  28. <header class="mui-bar mui-bar-nav">
  29. <a class="mui-action-back mui-icon mui-icon-back mui-pull-left" style="color:white"></a>
  30. <h1 class="mui-title" style="color:white">修改密码</h1>
  31. </header>
  32. <div class="mui-content ">
  33. <form class="mui-input-group" style="margin-top:2rem">
  34. <div class="mui-input-row">
  35. <input v-model="telephone" type="text" class="mui-input-clear" placeholder="请输入手机号码">
  36. </div>
  37. <div class="mui-input-row">
  38. <input v-model="password" type="password" class="mui-input-password" placeholder="请输入密码">
  39. </div>
  40. <div class="mui-input-row">
  41. <input v-model="passwordQ" type="password" class="mui-input-password" placeholder="请输入确认密码">
  42. </div>
  43. <div class="mui-input-row">
  44. <input v-model="Code" type="password" style="width:60%" class="mui-input" placeholder="请输入验证码">
  45. <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>
  46. </div>
  47. <button type="button" style="margin-top: 10px;" class="mui-btn mui-btn-success mui-btn-block btn_2" v-on:click="ModifyPassword">提交</button>
  48. </form>
  49. </div>
  50. </div>
  51. <script>
  52. var vm = new Vue({
  53. el: '#vue',
  54. data: {
  55. SMS: '获取验证码',
  56. telephone: '',
  57. password: '',
  58. passwordQ: '',
  59. Code: ''
  60. },
  61. methods: {
  62. GetSMS: function () {
  63. var that = this;
  64. 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)) {
  65. mui.toast('请输入正确的手机号码', { duration: 'long', type: 'div' });
  66. this.telephone = '';
  67. return;
  68. }
  69. var validCode = true;
  70. var time = 60;
  71. if (validCode) {
  72. validCode = false;
  73. var t = setInterval(function () {
  74. time--;
  75. that.SMS = '重新获取(' + time + 's)';
  76. if (time == 0) {
  77. clearInterval(t);
  78. that.SMS = '获取验证码';
  79. validCode = true;
  80. }
  81. }, 1000);
  82. }
  83. $.post("/MobileAccount/GetSMSCode", { "tele": that.telephone }, function (data) {
  84. if (data.code == "200") {
  85. mui.toast('短信发送成功', { duration: 'long', type: 'div' });
  86. } else {
  87. mui.toast('短信发送失败', { duration: 'long', type: 'div' });
  88. }
  89. }).error(function (xhr, type, errorThrown) {
  90. mui.toast('系统错误', { duration: 'long', type: 'div' });
  91. })
  92. },
  93. ModifyPassword: function () {
  94. var that = this;
  95. if (!this.telephone || !this.password || !this.Code) {
  96. mui.toast('请填写完整信息', { duration: 'long', type: 'div' });
  97. return;
  98. }
  99. if (this.password != this.passwordQ) {
  100. mui.toast('两次密码不相等', { duration: 'long', type: 'div' });
  101. return;
  102. }
  103. var t = mui.showLoading("修改中..", "div");
  104. $.post("/MobileAccount/PasswordModifySubmit", { "telephone": that.telephone, "Code": that.Code, "password": that.password }, function (data) {
  105. mui.hideLoading(t);
  106. if (data.code == "200") {
  107. mui.toast('修改成功,正在跳转...', { duration: 'long', type: 'div' });
  108. mui.later(function () {
  109. window.location = "/MobileAccount/MobileProblemLogin?Tele=" + that.telephone;
  110. }, 1000)
  111. } else {
  112. mui.toast(data.msg, { duration: 'long', type: 'div' });
  113. }
  114. }).error(function (xhr, type, errorThrown) {
  115. mui.hideLoading(t);
  116. mui.toast('系统错误', { duration: 'long', type: 'div' });
  117. })
  118. }
  119. },
  120. mounted: function () {
  121. }
  122. });
  123. </script>
  124. </body>
  125. </html>