edit-profile-sms.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. <button class="btn btn-link" type="button"><i class="icon-question-sign"></i>&nbsp;帮助</button>
  25. </div>
  26. </div>
  27. <div class="form">
  28. <form class="form-horizontal">
  29. <legend>短信通知</legend>
  30. <!-- if {{smsNoticeSwitch}} < 1 -->
  31. <!--管理员关闭功能-->
  32. <div class="alert alert-error">
  33. 短信通知功能已被关闭。
  34. </div>
  35. <!--管理员关闭功能-->
  36. <!-- else -->
  37. <!-- if {{uprofile.isnotice}} < 1 -->
  38. <!--初次使用-->
  39. <div class="alert alert-info">
  40. 初次使用,请先添加用于接收通知的手机号码。
  41. </div>
  42. <div id="input_error" class="control-group">
  43. <label class="control-label" for="inputEmail">添加手机</label>
  44. <div class="controls">
  45. <input id="mobile" name="mobile" type="text" placeholder="输入您的新手机号码"><span id="help-inline"
  46. class="help-inline hide"></span>
  47. </div>
  48. </div>
  49. <div class="control-group">
  50. <label class="control-label" for="inputEmail">短信校验码</label>
  51. <div class="controls">
  52. <input type="text" id="verifycode" name="verifycode" placeholder="输入验证码" maxlength="11"
  53. class="span2">
  54. <!--<button class="btn">获取验证码</button>-->
  55. <!--<button class="btn" disabled>重新获取 60s</button>-->
  56. <input type="button" class="btn" id="getting" value="获取验证码">
  57. </div>
  58. </div>
  59. <div class="control-group">
  60. <label class="control-label"></label>
  61. <div class="controls">
  62. <i class="icon-ok icon-white"></i><input type="button" id="addMobile"
  63. class="btn btn-primary" value="确定添加"/>
  64. </div>
  65. </div>
  66. <!--初次使用-->
  67. <!-- else -->
  68. <!--正常使用-->
  69. <div class="control-group">
  70. <label class="control-label" for="inputEmail">接收手机</label>
  71. <div class="controls">
  72. <input type="text" value="{{uprofile.mobile}}" disabled="">&nbsp;<a
  73. href="{{rootUrl}}user/profile/sms/edit">修改手机</a>
  74. </div>
  75. </div>
  76. <div class="control-group">
  77. <label class="control-label" for="inputEmail">通知类型</label>
  78. <div class="controls">
  79. <label class="checkbox inline">
  80. <input type="checkbox" checked value="option1" disabled> 到我审批
  81. </label>
  82. </div>
  83. </div>
  84. <!--正常使用-->
  85. <!-- endif -->
  86. <!-- endif -->
  87. </fieldset>
  88. </form>
  89. </div>
  90. </div>
  91. <!--内容-->
  92. </div>
  93. </div>
  94. <script type="text/javascript">autoFlashHeight();</script>
  95. <script type="text/javascript">
  96. $(document).ready(function () {
  97. $("#mobile").blur(function () {
  98. $.ajax({
  99. type: "POST",
  100. dataType: "json",
  101. cache: false,
  102. data: {"mobile": $(this).val()},
  103. url: "{{rootUrl}}user/profile/check/mobile",
  104. }).done(function (data) {
  105. if (data['mobile'] > 0) {
  106. $("#input_error").addClass('error');
  107. $("#help-inline").html('手机号码已被使用');
  108. $("#help-inline").show();
  109. } else {
  110. $("#input_error").removeClass('error');
  111. $("#help-inline").hide();
  112. }
  113. });
  114. });
  115. /*仿刷新:检测是否存在cookie*/
  116. if ($.cookie("sms")) {
  117. var count = $.cookie("sms");
  118. var btn = $('#getting');
  119. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  120. var resend = setInterval(function () {
  121. count--;
  122. if (count > 0) {
  123. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  124. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  125. } else {
  126. clearInterval(resend);
  127. btn.val("获取验证码").removeClass('disabled').removeAttr('disabled style');
  128. }
  129. }, 1000);
  130. }
  131. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  132. $('#getting').click(function () {
  133. var btn = $(this);
  134. if ($("#mobile").val() == '') {
  135. $("#input_error").addClass('error');
  136. $("#help-inline").html('手机号码不能为空');
  137. $("#help-inline").show();
  138. return false;
  139. }
  140. $.ajax({
  141. type: "POST",
  142. dataType: "json",
  143. cache: false,
  144. data: {"mobile": $("#mobile").val()},
  145. url: "{{rootUrl}}user/profile/check/mobile",
  146. }).done(function (data) {
  147. if (data['mobile'] > 0) {
  148. $("#input_error").addClass('error');
  149. $("#help-inline").html('手机号码已被使用');
  150. $("#help-inline").show();
  151. return false;
  152. } else {
  153. $("#input_error").removeClass('error');
  154. $("#help-inline").hide();
  155. $.ajax({
  156. type: "POST",
  157. dataType: "json",
  158. cache: false,
  159. data: {"mobile": $("#mobile").val()},
  160. url: "{{rootUrl}}user/profile/sms/send/verify",
  161. }).done(function (data) {
  162. });
  163. var count = 60;
  164. var resend = setInterval(function () {
  165. count--;
  166. if (count > 0) {
  167. btn.val('重新获取 ' + count + 's');
  168. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  169. } else {
  170. clearInterval(resend);
  171. btn.val("获取验证码").removeAttr('disabled style');
  172. }
  173. }, 1000);
  174. btn.attr('disabled', true).css('cursor', 'not-allowed');
  175. }
  176. });
  177. });
  178. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  179. $('#addMobile').click(function () {
  180. $.ajax({
  181. type: "POST",
  182. dataType: "json",
  183. cache: false,
  184. data: {"mobile": $("#mobile").val(), "verifycode": $("#verifycode").val()},
  185. url: "{{rootUrl}}user/profile/sms",
  186. }).done(function (data) {
  187. // window.location.href = "{{rootUrl}}user/profile/sms";
  188. window.location.reload();
  189. });
  190. });
  191. });
  192. </script>
  193. </body>