This commit is contained in:
cxt 2018-09-14 15:45:10 +08:00
parent ceaf977e87
commit f23d611bd2
4 changed files with 61 additions and 39 deletions

View File

@ -67,7 +67,11 @@
$("#user_email_show").html(data.email);
// 更改邮箱地址后,直接给用户发送邮件
$.ajax({
url: "<%= resendmail_path(:user => @user) %>"
url: "<%= resendmail_path(:user => @user) %>",
type: 'get',
success:function(data){
task = setInterval(get_email_info(<%= @user.try(:id) %>, "用户注册帐号激活通知"), 1000);
}
});
hideModal();
return;

View File

@ -42,22 +42,7 @@
$(".email_verify_btn").replaceWith("<p class='email_verify_p mt30 ml30'>激活邮件已发送至您的注册邮箱("+mail+"),请及时登录邮箱进行验证。</p>");
$.ajax({
url:'<%= account_get_email_info_path(:user_id => @user.try(:id), :subject => "用户注册帐号激活通知") %>',
type:'get',
success:function(data){
if(data.result == "succuss"){
$("#email_log_detail").html("邮件概况:"+data.message);
} else{
$("#email_log_detail").html("邮件概况:无法查询邮件概况");
}
$("#email_log_detail").parent().show();
},
error:function(){
$("#email_log_detail").html("邮件概况:无法查询邮件概况");
$("#email_log_detail").parent().show();
}
});
get_email_info(<%= @user.try(:id) %>, "用户注册帐号激活通知");
}
);
}

View File

@ -9,7 +9,7 @@
</p>
<p>
<a href="http://mail.<%= email %>" class="btn btn-blue" target="_blank"><%= l(:label_check_email)%></a>
&nbsp; &nbsp; <%= link_to "<input class='btn btn-blue' type='button' id='btn' value='重新发送激活邮件' onclick='settime(this)' />".html_safe, { :controller => 'account', :action => 'resendmail', :user => @user}, :remote => true, :method => 'get' %>
<a href="javascript:void(0);" onclick="resendMail('<%= resendmail_path(@user) %>','<%= @user.id %>');"><input class='btn btn-blue' type='button' id='btn' value='重新发送激活邮件'/></a>
</p>
<div class="mt10 mb10 email_info_box">
@ -27,20 +27,7 @@
<script>
$(document).ready(function(){
$.ajax({
url:'<%= account_get_email_info_path(:user_id => @user.try(:id), :subject => "用户注册帐号激活通知") %>',
type:'get',
success:function(data){
if(data.result == "succuss"){
$("#email_log_detail").html("邮件概况:"+data.message);
} else{
$("#email_log_detail").html("邮件概况:无法查询邮件概况");
}
},
error:function(){
$("#email_log_detail").html("邮件概况:无法查询邮件概况");
}
});
get_email_info(<%= @user.try(:id) %>, "用户注册帐号激活通知");
$("#change_email").click(function(){
$.ajax({
@ -52,6 +39,26 @@
})
});
function resendMail(url,id)
{
$.get(
url,
{user: id },
function (data) {
//邮箱@之前用a**b格式显示
var mail = data.email;
var pos = mail.indexOf("@");
var restr = mail.substring(1,pos-1);
if( mail.split("@")[0].length > 2 ){
mail = mail.replace(restr,"***");
}
settime(document.getElementById("btn"));
get_email_info(<%= @user.try(:id) %>, "用户注册帐号激活通知");
}
);
}
function regex_mv_name()
{
var name = $.trim($("#subject").val());
@ -111,13 +118,6 @@
myTips("反馈成功","success");
});
$("#scrollsidebar").fix({
float: 'right', //default.left or right
minStatue: cookieget('minStatue'),
skin: 'green', //default.gray or blue
durationTime: 600
});
$("#subject").keydown(function(){
alert("2222");
var curLength=$("#subject").val().length;

View File

@ -2348,3 +2348,36 @@ function toggle_student_score(id){
$("#toggle_score_" + id).html("展开评阅详情");
}
}
function get_email_info(id, subject) {
task = setInterval(search_email_status, 2000);
var count = 0;
function search_email_status() {
count = count + 1;
if(count > 3){
clearInterval(task);
} else {
$.ajax({
url: '/account/get_email_info?user_id=' + id + '&subject=' + subject,
type: 'get',
success: function (data) {
$("#email_log_detail").parent().show();
if (data.result == "succuss") {
$("#email_log_detail").html("邮件概况:" + data.message);
if (data.message != "未查询到相关数据" && data.message != "发信中") {
clearInterval(task);
}
} else {
$("#email_log_detail").html("邮件概况:无法查询邮件概况");
clearInterval(task);
}
},
error: function () {
$("#email_log_detail").html("邮件概况:无法查询邮件概况");
$("#email_log_detail").parent().show();
clearInterval(task);
}
});
}
}
}