edit-profile-sms.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. <!-- if {{smsNoticeSwitch}} < 1 -->
  31. <!--管理员关闭功能-->
  32. <div class="alert alert-danger">
  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="form-group">
  43. <label class="col-sm-1 control-label">添加手机</label>
  44. <div class="col-sm-2">
  45. <input class="form-control" id="mobile" name="mobile" type="text" placeholder="输入您的新手机号码"><span id="help-inline"
  46. class="help-block" style="display: none"></span>
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-1 control-label">短信校验码</label>
  51. <div class="col-sm-2">
  52. <input class="form-control" type="text" id="verifycode" name="verifycode" placeholder="输入验证码" maxlength="11"
  53. class="span2">
  54. </div>
  55. <div class="col-sm-2">
  56. <input type="button" class="btn btn-default" id="getting" value="获取验证码">
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <label class="col-sm-1 control-label"></label>
  61. <div class="col-sm-2">
  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="form-group">
  70. <label class="col-sm-1 control-label">接收手机</label>
  71. <div class="col-sm-2 ">
  72. <input class="form-control" type="text" value="{{uprofile.mobile}}" disabled="">&nbsp;<a
  73. href="{{rootUrl}}user/profile/sms/edit">修改手机</a>
  74. </div>
  75. </div>
  76. <div class="form-group">
  77. <label class="col-sm-1 control-label">通知类型</label>
  78. <div class="col-sm-5">
  79. <label class="checkbox-inline">
  80. <input type="checkbox" checked value="option1" disabled> 到我审批
  81. </label>
  82. <label class="checkbox-inline">
  83. <input type="checkbox" checked value="option1" disabled> 标段审批通过(上报人接收)
  84. </label>
  85. <label class="checkbox-inline">
  86. <input type="checkbox" checked value="option1" disabled> 标段审批不通过(上报人接收)
  87. </label>
  88. <label class="checkbox-inline">
  89. <input type="checkbox" checked value="option1" disabled> 标段审批退回(上一审批人)
  90. </label>
  91. </div>
  92. </div>
  93. <!--正常使用-->
  94. <!-- endif -->
  95. <!-- endif -->
  96. </fieldset>
  97. </form>
  98. </div>
  99. </div>
  100. <!--内容-->
  101. </div>
  102. </div>
  103. <script type="text/javascript">autoFlashHeight();</script>
  104. <script type="text/javascript">
  105. $(document).ready(function () {
  106. $("#mobile").blur(function () {
  107. $.ajax({
  108. type: "POST",
  109. dataType: "json",
  110. cache: false,
  111. data: {"mobile": $(this).val()},
  112. url: "{{rootUrl}}user/profile/check/mobile",
  113. success: function(data){
  114. if (data["mobile"] > 0) {
  115. $("#input_error").addClass('has-error');
  116. $("#help-inline").html('手机号码已被使用');
  117. $("#help-inline").show();
  118. } else {
  119. $("#input_error").removeClass('has-error');
  120. $("#help-inline").hide();
  121. }
  122. }
  123. });
  124. });
  125. /*仿刷新:检测是否存在cookie*/
  126. if ($.cookie("sms")) {
  127. var count = $.cookie("sms");
  128. var btn = $('#getting');
  129. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  130. var resend = setInterval(function () {
  131. count--;
  132. if (count > 0) {
  133. btn.val('重新获取 ' + count + 's').attr('disabled', true).css('cursor', 'not-allowed');
  134. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  135. } else {
  136. clearInterval(resend);
  137. btn.val("获取验证码").removeClass('disabled').removeAttr('disabled style');
  138. }
  139. }, 1000);
  140. }
  141. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  142. $('#getting').click(function () {
  143. var btn = $(this);
  144. if ($("#mobile").val() == '') {
  145. $("#input_error").addClass('has-error');
  146. $("#help-inline").html('手机号码不能为空');
  147. $("#help-inline").show();
  148. return false;
  149. }
  150. $.ajax({
  151. type: "POST",
  152. dataType: "json",
  153. cache: false,
  154. data: {"mobile": $("#mobile").val()},
  155. url: "{{rootUrl}}user/profile/check/mobile",
  156. success: function(data){
  157. if (data["mobile"] > 0) {
  158. $("#input_error").addClass('has-error');
  159. $("#help-inline").html('手机号码已被使用');
  160. $("#help-inline").show();
  161. return false;
  162. } else {
  163. $("#input_error").removeClass('has-error');
  164. $("#help-inline").hide();
  165. $.ajax({
  166. type: "POST",
  167. dataType: "json",
  168. cache: false,
  169. data: {"mobile": $("#mobile").val()},
  170. url: "{{rootUrl}}user/profile/sms/send/verify",
  171. success: function(data){
  172. if(data["verify"]==true){
  173. var count = 60;
  174. var resend = setInterval(function () {
  175. count--;
  176. if (count > 0) {
  177. btn.val('重新获取 ' + count + 's');
  178. $.cookie("sms", count, {path: '/', expires: (1 / 86400) * count});
  179. } else {
  180. clearInterval(resend);
  181. btn.val("获取验证码").removeAttr('disabled style');
  182. }
  183. }, 1000);
  184. btn.attr('disabled', true).css('cursor', 'not-allowed');
  185. }
  186. }
  187. });
  188. }
  189. }
  190. });
  191. });
  192. /*点击改变按钮状态,已经简略掉ajax发送短信验证的代码*/
  193. $('#addMobile').click(function () {
  194. $.ajax({
  195. type: "POST",
  196. dataType: "json",
  197. cache: false,
  198. data: {"mobile": $("#mobile").val(), "verifycode": $("#verifycode").val()},
  199. url: "{{rootUrl}}user/profile/sms",
  200. error: function (err) {
  201. alert(err);
  202. },
  203. success: function () {
  204. window.location.href = "{{rootUrl}}user/profile/sms";
  205. }
  206. });
  207. });
  208. });
  209. </script>
  210. </body>