Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

bind_email.htm 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>绑定邮箱-{eyou:global name='web_name' /}</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
  9. {eyou:static file="users/skin/css/basic.css" /}
  10. {eyou:static file="users/skin/css/eyoucms.css" /}
  11. {eyou:include file="users/skin/css/diy_css.htm" /}
  12. {eyou:static file="/public/static/common/js/jquery.min.js"/}
  13. {eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
  14. {eyou:static file="/public/static/common/js/tag_global.js"/}
  15. {eyou:static file="/public/static/common/js/mobile_global.js"/}
  16. <style type="text/css">
  17. #theForm .form-group{
  18. margin:20px 0px 10px;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <div class="changepass">
  24. <form name='theForm' id="theForm" method="post">
  25. <div class="modal-body">
  26. <div class="form-group">
  27. <div class="input-group">
  28. <input type="text" name="email" id="email" {eyou:eq name='$users.is_email' value='0'} value="{$users.email}" {/eyou:eq} required class="form-control" placeholder="新的邮箱地址">
  29. </div>
  30. </div>
  31. <div class="form-group">
  32. <div class="input-group yxrz">
  33. <input type="text" class="form-control" id="email_code" name="email_code" placeholder="邮箱验证码">
  34. <input type="button" id="email_button" onclick="get_email_code();" class="btn btn-primary" value="点击发送" />
  35. </div>
  36. </div>
  37. </div>
  38. <div class="modal-footer">
  39. <button type="button" class="btn btn-primary" style="width: 100%;" onclick="SubmitData();">确定</button>
  40. </div>
  41. </form>
  42. </div>
  43. <script type="text/javascript">
  44. function get_email_code()
  45. {
  46. var email = $("#email").val();
  47. var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
  48. // 邮箱格式不正确
  49. if(!reg.test(email)){
  50. layer.msg('请正确输入邮箱地址!', {time: 2000});
  51. return false;
  52. }
  53. $("#email_button").val('发送中…');
  54. $("#email_button").attr('disabled', 'disabled');
  55. var title = '{$title}';
  56. layer_loading('正在处理');
  57. $.ajax({
  58. url: "{eyou:url link='user/Smtpmail/send_email' /}",
  59. data: {email:email,title:title,type:'bind_email',scene:3},
  60. type:'post',
  61. dataType:'json',
  62. success:function(res){
  63. if(res.code == 1){
  64. countdown();
  65. layer.msg(res.msg, {time: 2000});
  66. }else{
  67. $("#email_button").val('点击发送');
  68. $("#email_button").removeAttr("disabled");
  69. showErrorAlert(res.msg);
  70. }
  71. },
  72. error : function(e) {
  73. $("#email_button").val('点击发送');
  74. $("#email_button").removeAttr("disabled");
  75. showErrorAlert(e.responseText);
  76. }
  77. });
  78. }
  79. function SubmitData()
  80. {
  81. var email = $("#email").val();
  82. var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
  83. // 邮箱格式不正确
  84. if(!reg.test(email)){
  85. layer.msg('请正确输入邮箱地址!', {time: 2000});
  86. return false;
  87. }
  88. var email_code = $("#email_code").val();
  89. if(!email_code){
  90. layer.msg('邮箱验证码不能为空!', {time: 2000});
  91. return false;
  92. }
  93. var _parent = parent;
  94. var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  95. layer_loading('正在处理');
  96. $.ajax({
  97. url: "{eyou:url link='user/Users/bind_email' /}",
  98. data: $('#theForm').serialize(),
  99. type:'post',
  100. dataType:'json',
  101. success:function(res){
  102. layer.closeAll();
  103. if(res.code == 1){
  104. parent.layer.close(parentObj);
  105. parent.layer.msg(res.msg, {time: 1500}, function(){
  106. _parent.window.location.reload();
  107. });
  108. }else{
  109. showErrorAlert(res.msg);
  110. }
  111. },
  112. error : function(e) {
  113. layer.closeAll();
  114. showErrorAlert(e.responseText);
  115. }
  116. });
  117. };
  118. function countdown(){
  119. // 倒计时
  120. var setTime;
  121. var time = {php}echo config('global.email_send_time');{/php};
  122. setTime = setInterval(function(){
  123. if(0 >= time){
  124. clearInterval(setTime);
  125. return;
  126. }
  127. time--;
  128. $("#email_button").val(time+'秒');
  129. $("#email_button").attr('disabled', 'disabled');
  130. if(time == 0){
  131. $("#email_button").val('点击发送');
  132. $("#email_button").removeAttr("disabled");
  133. }
  134. },1000);
  135. };
  136. </script>
  137. </body>
  138. </html>