Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

bind_email.htm 6.5KB

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