File: /web/data/www.tbbprovision.com/static/manage/js/mail.js
/**
* author : liaoyaping
* createTime : 2017/5/12 11:21
* description :
*/
var mailobj = {
newsletter : function(){
var $bootstrapTable = $('#table2').bootstrapTable({
url:'/admin/mail/newsletter_json/',
method:'post',
striped:true,
search:true,
height:'530',
toolbar:'#toolbar',
sortOrder:'desc',
showColumns:true,
showRefresh:true,
pageSize:50,
pageList:[50,200,500],
idField:'nid',
showToggle:false,
sidePagination:'server',
selectItemName:'nid',
clickToSelect:true,
totalRows:5,
queryParams:function(data){
data.cate_id = $('#cate_id').val();
return data;
},
columns: [{
field: 'nid',
title: 'ID',
checkbox:true,
formatter: function(value,row){
row['post_id'] = value;
}
},{
field: 'email',
title: '邮箱',
formatter:function(value,row,index){
return value;
}
},{
field: 'acc_time',
title: '添加时间',
sortable:true
},{
field: 'ip',
title: 'IP地址',
formatter: function(value,row){
return value + "<br />["+row['ip_area']+']';
}
}],
onClickRow: function (row, $element) {
curRow = row;
}
});
//删除
$('#remove').click(function(){
//询问框
layer.confirm('确定删除此记录?', {
skin:'layui-layer-molv',
'title':'<strong class="">提示</strong>',
btn: ['删除','关闭'] //按钮
}, function(){
jQuery.ajax({
method:'post',
url:'/admin/mail/newsletter_del/',
data:global.get_selected_str('input[name="nid"]:checked','id'),
dataType:'json',
timeout:10000,
beforeSend:function(){
layer.closeAll('confirm');
layer.msg('数据处理中',{icon:16,time:0,shade:[0.8,'#000']});
},
success:function($d){
$bootstrapTable.bootstrapTable('refresh');
layer.msg($d.response_content, {icon: 1,time:1000});
},
error:function(xhrData){
layer.msg(errorMessage(xhrData.responseText),{time:2000,icon:7});
}
});
});
});
//导出
$('#export').click(function(){
//询问框
layer.confirm('确定导出选中记录?', {
skin:'layui-layer-molv',
'title':'<strong class="">提示</strong>',
btn: ['导出','关闭'] //按钮
}, function(){
$('#export_form').remove();
var html = "<form action='/admin/mail/newsletter_export/' target='_blank' method='post' class='hide' id='export_form'>";
html += "<input type='hidden' name='id' value='"+global.get_selected_str('input[name="nid"]:checked','').replace('=','')+"' />";
html += "<input type='submit' value='提交' class='submit-export-btn'/>";
$('body').append(html);
$('body .submit-export-btn').click();
layer.closeAll();
});
});
}
};