let mobile_flag;
let resumeFileUrl = "";
var jobIds = "";
var baseUrl = "https://custproj00011-2.ceydz.com/front/"
// var baseUrl = "http://localhost:8081/front/"
let comIndex = 0;
$(function() {
//对encodeURI()编码过的 URI 进行解码。
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return decodeURI(r[2]);
}
return ""; //如果此处只写return;则返回的是undefined
};
//获取地址头后的参数职位id集合,以,隔开
jobIds = getUrlParam("jobIds")
// mobile_flag = isMobile();
initData()
//初始进入页面时若有职位id,则根据职位id进行查询,若没有职位id,则查询所有
// 文件上传
layui.use('upload', function() {
let upload = layui.upload;
//执行实例
upload.render({
elem: '.hyjt_resumeFile', //绑定元素
url: 'https://custproj00011-2.ceydz.com/ksyun/global/upload/v2?tenantId=hyjt', //上传接口
accept: 'file',
done: function(res) {
console.log(res);
},
error: function() {
//请求异常回调
}
});
});
})
function getJobByComId(obj, id) {
let liLength = $('.dz_liOne').length;
for (let i = 0; i < liLength; i++) {
if (obj == $('.dz_liOne')[i]) {
$('.dz_line-two')[i].style.display = '';
} else {
$('.dz_line-two')[i].style.display = 'none';
}
}
console.log(id)
$.ajax({
url: baseUrl + "hyjt/getJobByComId?comId=" + id,
method: "get",
success: function(data) {
setJobList(data)
},
})
}
function setJobList(data) {
var jobListHtml = "";
let lists = data.content;
if (lists && lists.length) {
lists.forEach(item => {
let jobReqList = JSON.parse(item.jobReq);
var jobReq = ""
let index = 0;
// let mydate = item.updateTime.substring(0, 11)
// console.log(mydate);
for (const key in jobReqList) {
index++
jobReq += '
' + index + "、" + jobReqList[key] + ''
}
jobListHtml += `
`
})
}
$("#hyjtJobList").html(jobListHtml)
isPhone()
}
//初始化页面数据
function initData() {
//查询公司集合
$.ajax({
url: baseUrl + "hyjt/company/getAllCompany",
method: "get",
success: function(data) {
var comListHtml = `全部
`
let lists = data.content;
if (lists && lists.length) {
lists.forEach(item => {
comListHtml += `${item.companyName}
`
})
$("#dz_ulOne").html(comListHtml)
}
},
})
//查询职位集合
$.ajax({
url: baseUrl + "hyjt/getJobByJobIds?jobIds=" + jobIds,
method: "get",
success: function(data) {
setJobList(data)
},
})
}
//打开职位叙述
function dakai(id) {
var str = "kuang" + id
var imgDown = "imgDown" + id
let kuangObj = document.getElementById(str);
let imgDownObj = document.getElementById(imgDown);
if (kuangObj.className != 'dz_cls') {
console.log(imgDownObj.innerHTML);
// imgDownObj.className = 'iconfont icon-xiangxia2'
imgDownObj.src = './img/xia.png'
// imgDownObj.attr('class', 'glyphicon glyphicon-menu-down');
kuangObj.className = 'dz_cls';
// console.log(kuangObj.className);
imgDownObj.value = 'yc';
} else {
// imgDownObj.className = 'iconfont icon-xiangshang2'
// imgDownObj.attr('class', 'glyphicon glyphicon-menu-up');
imgDownObj.src = './img/shang.png'
kuangObj.className = '';
imgDownObj.value = 'xs';
}
}
// 多个分享
function fxxuanzhong() {
var jobId = '';
let allCheck = document.getElementsByName("interest");
for (let i = 0; i < allCheck.length; i++) {
console.log(allCheck[i].checked);
if (allCheck[i].checked) {
console.log(allCheck[i].id);
jobId += allCheck[i].id + ',';
}
}
$.ajax({
url: "https://custproj00011-2.ceydz.com/front/hxzcnew/cert/qrCode",
method: "get",
data: {
txt: '/dz_zhaopin.html?jobIds=' + jobId,
logoUrl: 'hmxdz/_04a90c8e65f9d46dc64e65e7cba613fb_KxUR9KM6TfKpGCjUcfBF3w.jpg',
},
success: function(data) {
if (data.code == 200 || data.code == '200') {
// alert("分享职位成功")
layer.open({
title: "分享二维码",
type: 1,
content: `
`
});
} else {
alert("分享职位失败,请联系管理员")
}
},
})
console.log(jobId);
}
var jobId = '';
// 文件上传
layui.use('upload', function() {
let upload = layui.upload;
//执行实例
upload.render({
elem: '#importModel', //绑定元素
url: 'https://custproj00011-2.ceydz.com/ksyun/global/upload/v2?tenantId=hyjt', //上传接口
accept: 'file',
done: function(res) {
console.log(res);
var params = {
"jobId": jobId,
"file": res.realSavePath
}
$.ajax({
url: baseUrl + "hyjt/addResume",
method: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: JSON.stringify(params),
success: function(data) {
if (data.code == 200 || data.code == '200') {
alert("简历提交成功")
} else {
alert("简历提交失败,请联系管理员")
}
},
})
},
error: function() {
//请求异常回调
layer.alert("导入中出现错误,请重新尝试!");
}
});
});
function importWaypointModel(obj, id) {
jobId = id;
console.log(obj);
window.location.href = "applyForm.html?jobId=" + id
// $("#importModel").click();
}
var jobId = '';
// 单个分享
function dangefenxiang(job, id) {
jobId = id;
console.log(id);
$.ajax({
url: "https://custproj00011-2.ceydz.com/front/hxzcnew/cert/qrCode",
method: "get",
data: {
txt: '/dz_zhaopin.html?jobIds=' + jobId,
logoUrl: 'hmxdz/_04a90c8e65f9d46dc64e65e7cba613fb_KxUR9KM6TfKpGCjUcfBF3w.jpg',
},
success: function(data) {
if (data.code == 200 || data.code == '200') {
// alert("分享职位成功")
layer.open({
title: "分享二维码",
type: 1,
content: `
`
// hmxdz/_04a90c8e65f9d46dc64e65e7cba613fb_KxUR9KM6TfKpGCjUcfBF3w.jpg
});
} else {
alert("分享职位失败,请联系管理员")
}
},
})
}
// 跳转到详情页
function xiangqing(obj, id) {
for (let i = 0; i < $('.dz_name').length; i++) {
if (obj == $('.dz_name')[i]) {
location.href = 'dz_position.html?jobId=' + id;
}
}
}
// 判断是否为手机
function isPhone() {
// navigator.userAgent获取浏览器信息(类型及系统)
let ua = navigator.userAgent;
console.log(ua);
let ipad = ua.match(/(iPad).*OS\s([\d]+)/),
isIphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
isAndroid = ua.match(/(Android)\s+[\d.]+/),
isMobile = isIphone || isAndroid;
// 判断
if (isMobile) {
$('#dz_left').css({
'font-size': '11px',
});
$('#navigation').css({
'width': '96%',
'overflow': 'scroll auto',
'touch-action': 'auto',
});
$('#dz_ulOne').css({
'font-size': '12px',
'width': '1000px',
});
$('.dz_liOne').css({
'font-size': '12px',
'width': '110px',
'margin': '5px'
});
$('.dz_liOne:nth-child(1)').css({
'font-size': '12px',
'width': '30px',
'margin': '5px'
});
$('.dz_kuang').css({
'overflow': 'scroll auto',
'text-align': 'justify',
'touch-action': 'auto',
'width': '96%',
});
$('.dz_ulTwo').css({
'width': '400px'
});
$('.dz_ulThree').css({
'width': '400px',
});
$('.dz_dingwei').css({
'position': 'relative',
});
$('.dz_department').css({
'display': 'none',
});
$('.dz_name').css({
'width': '120px',
'margin': '5px'
});
$('.dz_select').css({
'width': '8px',
'margin': '5px'
});
$('.dz_time').css({
'width': '65px',
});
$('.dz_person').css({
'width': '48px',
});
$('.dz_address').css({
'width': '48px',
});
$('.dz_xiala1').css({
'margin-top': '-20px',
'position': 'absolute',
'right': '-20px',
});
}
}
isPhone()