var sendmailtimes = 1;
$(document).ready(function () {
$(window).resize(function () { adjust_banner_buttons(); });
$("#banner").kinmaxshow({
height: 200
});
adjust_banner_buttons();
$(".block-top-content").each(function () {
$(this).html($(this).text());
});
showjob();
loadjob();
$("#doc_button").click(function () {
doc_button_click();
});
//$("#mail_subject_tr").hide();
//$("#mail_body_tr").hide();
//settimeout(cleansendmailtimes(), 60000) //单位毫秒
//发送邮件
$("#btn_send_mail").click(function () {
if (sendmailtimes < 3) {
sendmail();
} else {
alert("发送邮件过于频繁");
}
});
});
function adjust_banner_buttons() {
var buttons = $(".kmsprefix_banner_button");
if (!buttons) return;
var width = $(window).width();
if (width > 1500) {
buttons.css("right", (width - 1500) / 2 + 10 + "px");
} else {
buttons.css("right", "10px");
}
}
var global_pagenumber = 1;
function loadjob() {
$.post("/job/listpagejob/", { page: global_pagenumber, size: 10 }, function (data) {
//alert(data.success);
if (data.success) {
$("#jobtable").datagrid('loaddata', data.data);
var pager = $("#jobtable").datagrid('getpager');
pager.pagination({
pagenumber: global_pagenumber,
pagesize: 15,
showpagelist: false,
onselectpage: function (pagenumber, pagesize) {
global_pagenumber = pagenumber;
loadjob();
},
onrefresh: function (pagenumber, pagesize) {
global_pagenumber = pagenumber;
loadjob();
}
});
}
});
}
function showjob() {
$("#jobtable").datagrid({
//methord: 'post',
//fit: true,
striped: true, //奇偶行是否区分
singleselect: true,
//toolbar: [{
// text: '添加', iconcls: 'icon-myadd', handler: function () {
// parent.location.href = "/baseinfo/studentinfo/";
// }
//},
//{
// text: '导出excel', iconcls: 'icon-myoutexcel', handler: function () {
// export_click();
// }
//},
//{
// text: '导入excel', iconcls: 'icon-myinexcel', handler: function () {
// import_excel();
// }
//}],
columns: [[
{
field: 'number', title: '序号', width: 30, align: 'center', styler: function (value, row, index) {
if (value < 20) {
return 'height:40px;';
}
}
},
{
field: 'jobname', title: '招聘岗位', width: 70, align: 'center', formatter: function (value, row, index) {
if (row.id) {
return "" + value + "";
} else {
return value;
}
}
},
{ field: 'jobcount', title: '人数', width: 40, align: 'center' },
{ field: 'jobeducation', title: '具体要求', width: 110, align: 'center' },
{ field: 'jobadddate', title: '发布日期', width: 80, align: 'center' },
{ field: 'jobvaliddate', title: '截止日期', width: 80, align: 'center' },
{
field: 'id', title: '投简历', align: 'center', width: 50,padding:10, formatter: function (value, row, index) {
if (row.id) {
return "";
} else {
return "";
}
}
}
]]
});
}
function opendialog(id) {
$.post("/job/findjobbyid/", { id: id }, function (data) {
if (data.success) {
$("#job_type_dialog_id").val(data.job_type_dialog);
$("#job_name").val(data.name_dialog);
$("#mail_subject").val("应聘" + data.name_dialog);
$("#mail_body").val("应聘" + data.name_dialog + ",简历见附件");
$('#dialog_mail').dialog('open');
}
});
}
var fujianpath = "";
function sendmail() {
//var from = $("#mail_from").val();
//var fromname = $("#mail_from_name").val();
//var to = $("#mail_to").val();
//var subject = $("#mail_subject").val();
//var body = $("#mail_body").val();
//var username = $("#mail_username").val();
//var password = $("#mail_password").val();
var from = "";
var fromname = "";
var to = "";
var username = "";
var password = "";
var server = "";
var subject = $("#mail_subject").val();;
var body = $("#mail_body").val();
var fujian = fujianpath;
$.post("/job/sendmail/", { from: from, fromname: fromname, to: to, subject: subject, body: body, username: username, password: password, server: server, fujian: fujian }, function (data) {
if (data.success) {
alert("邮件发送成功");
$("#doc").html("请点击左边的按钮上传简历");
fujianpath = "";
sendmailtimes++;
$('#dialog_mail').dialog('close');
} else {
alert("邮件发送失败," + data.message);
}
});
}
function doc_button_click() {
uploadresume(function (file_path) {
//上传文件成功后,显示上传的路径
fujianpath = file_path;
$("#doc").html("上传成功!");
});
}
function cleansendmailtimes() {
sendmailtimes = 1;
}