edit-profile-sms.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. success: 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. });
  116. /*仿刷新:检测是否存在cookie*/
  117. if ($.cookie("sms")) {
  118. var count = $.cookie("sms");
  119. var btn = $('#getting');
  120. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  121. var resend = setInterval(function () {
  122. count--;
  123. if (count > 0) {
  124. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  125. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  126. } else {
  127. clearInterval(resend);
  128. btn.val("获取验证码").removeClass('disabled').removeAttr('disabled style');
  129. }
  130. }, 1000);
  131. }
  132. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  133. $('#getting').click(function () {
  134. var btn = $(this);
  135. if ($("#mobile").val() == '') {
  136. $("#input_error").addClass('error');
  137. $("#help-inline").html('手机号码不能为空');
  138. $("#help-inline").show();
  139. return false;
  140. }
  141. $.ajax({
  142. type: "POST",
  143. dataType: "json",
  144. cache: false,
  145. data: {"mobile": $("#mobile").val()},
  146. url: "{{rootUrl}}user/profile/check/mobile",
  147. success: function(data){
  148. if (data["mobile"] > 0) {
  149. $("#input_error").addClass('error');
  150. $("#help-inline").html('手机号码已被使用');
  151. $("#help-inline").show();
  152. return false;
  153. } else {
  154. $("#input_error").removeClass('error');
  155. $("#help-inline").hide();
  156. $.ajax({
  157. type: "POST",
  158. dataType: "json",
  159. cache: false,
  160. data: {"mobile": $("#mobile").val()},
  161. url: "{{rootUrl}}user/profile/sms/send/verify",
  162. success: function(data){
  163. if(data["verify"]==true){
  164. var count = 60;
  165. var resend = setInterval(function () {
  166. count--;
  167. if (count > 0) {
  168. btn.val('重新获取 ' + count + 's');
  169. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  170. } else {
  171. clearInterval(resend);
  172. btn.val("获取验证码").removeAttr('disabled style');
  173. }
  174. }, 1000);
  175. btn.attr('disabled', true).css('cursor', 'not-allowed');
  176. }
  177. }
  178. });
  179. }
  180. }
  181. });
  182. });
  183. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  184. $('#addMobile').click(function () {
  185. $.ajax({
  186. type: "POST",
  187. dataType: "json",
  188. cache: false,
  189. data: {"mobile": $("#mobile").val(), "verifycode": $("#verifycode").val()},
  190. url: "{{rootUrl}}user/profile/sms",
  191. error: function (err) {
  192. alert(err);
  193. },
  194. success: function () {
  195. window.location.href = "{{rootUrl}}user/profile/sms";
  196. }
  197. });
  198. });
  199. });
  200. </script>
  201. </body>