edit-profile-sms-edit.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!DOCTYPE html>
  2. <html lang=zh-cn>
  3. <head>
  4. <meta charset=utf-8>
  5. <title>纵横计量支付系统</title>
  6. <meta name=description content=计量支付>
  7. <meta name=copyright content=smartcost.com.cn>
  8. <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
  9. <link rel=stylesheet href={{rootUrl}}global/css/style.css>
  10. <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
  11. <script src={{rootUrl}}global/js/bootstrap.js></script>
  12. <script src={{rootUrl}}global/js/jl.js></script>
  13. <script src={{rootUrl}}global/js/jquery.cookie.min.js></script>
  14. </head>
  15. <body>
  16. <!-- include "top" -->
  17. <div class="wrapContent">
  18. <!-- include "left" -->
  19. <div class="mainContainer">
  20. <!--内容-->
  21. <div class="mainContent">
  22. <div class="title clearfix">
  23. <div class="fR">
  24. <a class="btn btn-link" href="http://smartcost.com.cn/product/19" target="_blank"><i class="icon-question-sign"></i>&nbsp;帮助</a>
  25. </div>
  26. </div>
  27. <div class="form">
  28. <form class="form-horizontal">
  29. <legend>短信通知-修改手机</legend>
  30. <div class="form-group">
  31. <label class="col-sm-1 control-label">当前手机</label>
  32. <div class="col-sm-2">
  33. <input class="form-control" type="text" placeholder="{{uprofile.mobile}}" disabled="">
  34. </div>
  35. </div>
  36. <div id="input_error" class="form-group">
  37. <label class="col-sm-1 control-label">新手机</label>
  38. <div class="col-sm-2">
  39. <input class="form-control" id="mobile" name="mobile" type="text" placeholder="输入您的新手机号码"><span id="help-inline"
  40. class="help-block" style="display: none"></span>
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label class="col-sm-1 control-label">短信校验码</label>
  45. <div class="col-sm-2">
  46. <input class="form-control" type="text" id="verifycode" name="verifycode" placeholder="输入验证码" maxlength="11"
  47. class="span2">
  48. <!--<button class="btn">获取验证码</button>-->
  49. <!--<button class="btn" disabled>重新获取 60s</button>-->
  50. </div>
  51. <div class="col-sm-2">
  52. <input type="button" class="btn btn-default" id="getting" value="获取验证码">
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. <label class="col-sm-1 control-label"></label>
  57. <div class="col-sm-2">
  58. <i class="icon-ok icon-white"></i><input type="button" id="addMobile"
  59. class="btn btn-primary" value="确定修改"/>
  60. </div>
  61. </div>
  62. </fieldset>
  63. </form>
  64. </div>
  65. </div>
  66. <!--内容-->
  67. </div>
  68. </div>
  69. <script type="text/javascript">autoFlashHeight();</script>
  70. <script type="text/javascript">
  71. $(document).ready(function () {
  72. $("#mobile").blur(function () {
  73. $.ajax({
  74. type: "POST",
  75. dataType: "json",
  76. cache: false,
  77. data: {"mobile": $(this).val()},
  78. url: "{{rootUrl}}user/profile/check/mobile"
  79. }).done(function (data) {
  80. if (data['mobile'] > 0) {
  81. $("#input_error").addClass('has-error');
  82. $("#help-inline").html('手机号码已被使用');
  83. $("#help-inline").show();
  84. } else {
  85. $("#input_error").removeClass('has-error');
  86. $("#help-inline").hide();
  87. }
  88. });
  89. });
  90. /*仿刷新:检测是否存在cookie*/
  91. if ($.cookie("sms")) {
  92. var count = $.cookie("sms");
  93. var btn = $('#getting');
  94. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  95. var resend = setInterval(function () {
  96. count--;
  97. if (count > 0) {
  98. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  99. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  100. } else {
  101. clearInterval(resend);
  102. btn.val("获取验证码").removeClass('disabled').removeAttr('disabled style');
  103. }
  104. }, 1000);
  105. }
  106. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  107. $('#getting').click(function () {
  108. var btn = $(this);
  109. if ($("#mobile").val() == '') {
  110. $("#input_error").addClass('has-error');
  111. $("#help-inline").html('手机号码不能为空');
  112. $("#help-inline").show();
  113. return false;
  114. }
  115. $.ajax({
  116. type: "POST",
  117. dataType: "json",
  118. cache: false,
  119. data: {"mobile": $("#mobile").val()},
  120. url: "{{rootUrl}}user/profile/check/mobile"
  121. }).done(function (data) {
  122. if (data['mobile'] > 0) {
  123. $("#input_error").addClass('has-error');
  124. $("#help-inline").html('手机号码已被使用');
  125. $("#help-inline").show();
  126. return false;
  127. } else {
  128. $("#input_error").removeClass('has-error');
  129. $("#help-inline").hide();
  130. $.ajax({
  131. type: "POST",
  132. dataType: "json",
  133. cache: false,
  134. data: {"mobile": $("#mobile").val()},
  135. url: "{{rootUrl}}user/profile/sms/send/verify"
  136. }).done(function (data) {
  137. });
  138. var count = 60;
  139. var resend = setInterval(function () {
  140. count--;
  141. if (count > 0) {
  142. btn.val('重新获取 ' + count + 's');
  143. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  144. } else {
  145. clearInterval(resend);
  146. btn.val("获取验证码").removeAttr('disabled style');
  147. }
  148. }, 1000);
  149. btn.attr('disabled', true).css('cursor', 'not-allowed');
  150. }
  151. });
  152. });
  153. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  154. $('#addMobile').click(function () {
  155. $.ajax({
  156. type: "POST",
  157. dataType: "json",
  158. cache: false,
  159. data: {"mobile": $("#mobile").val(), "verifycode": $("#verifycode").val()},
  160. url: "{{rootUrl}}user/profile/sms/edit"
  161. }).done(function (data) {
  162. window.location.reload(true);
  163. });
  164. });
  165. });
  166. </script>
  167. </body>