//人才招聘职位搜索 function searchJob(pageNum, recruitType) { var _city = $('#city').find('p[class="active"]').data('keys'); var _jobtype = $('#jobtype').find('p[class="active"]').data('keys'); var _keyword = $('#searchput').val(); if (_keyword.includes(``)) { alert('您的请求中有违反安全规则的元素') return; } var data = { workCity: _city != '0' ? _city : '', jobTypeId: _jobtype, keyWord: _keyword, skipCount: (pageNum - 1) * 8, pageCount: 8, recruitType }; $('#searchput').blur(); $.ajax({ type: 'POST', url: '/job/all', data: JSON.stringify(data), dataType: 'json', contentType: 'application/json;charset=utf-8', success: function ({ data }) { let pcJobHtmlArr = ''; geiKkpager(Math.ceil(data.count / 8), data.count, pageNum, 'kkpager'); if (data.list && data.list.length > 0) { data.list.map((x, i) => { const ma = x.salary_range.match(/\d+(.\d+)?/g); let mna = []; if (ma && ma.length) mna = ma[0].split('~'); x.money = !mna.length ? '面议' : `${mna[0] / 1000}${mna[1] ? '-' + mna[1] / 1000 : ''}K`; const tips = x.welfare_introduce ? x.welfare_introduce.split(',') : []; x.th = ''; tips.map((t) => { x.th += `${t}`; }); x.desc = ` ${x.work_city ? `${~x.work_city.indexOf('-') ? x.work_city.split('-')[1] : x.work_city}` : ''} ${x.education ? `${x.education}` : ''} ${x.worktime ? `${x.worktime}` : ''} `; pcJobHtmlArr += `
${x.job_name}
${x.desc}
${x.th}
`; }); const curcount = data.list.length; const empty = curcount > 4 && curcount < 8 ? 8 - curcount : curcount < 4 ? 4 - curcount : 0; for (let i = 0; i < empty; i++) { pcJobHtmlArr += "
"; } $('#pcjob').html(pcJobHtmlArr); // 职位详情 $('.jobitem').click(function () { const idx = $(this).data('idx'); const x = data.list[idx]; $('#lmc').html(`

${x.job_name}

${x.th}

${x.desc}

`); $('.lzy-modal-content .head').click(function () { $('.lzy-modal.job').hide(); $('html,body').css('overflow', 'visible'); }); getJobDetail(x.id); }); } else { $('#pcjob').html("

暂无符合搜索条件的结果

"); } }, error: function (e) { // alert(e); }, }); function getJobDetail(id) { let requestCount = 0 const getData = (id) => $.ajax({ type: 'POST', url: '/job/detail', data: JSON.stringify({ id }), dataType: 'json', contentType: 'application/json;charset=utf-8', success: function ({ data }) { requestCount += 1 const getImg = (code) => { if (code && code.startsWith('/')) { return ``; } else { if (requestCount <= 19) { setTimeout(() => { getData(id); }, 500) return ``; } else { return ``; } } } $('#job_detail').html(`
${getImg(data.wxacode_base64)} 微信扫码应聘该职位
职位描述
${data.job_require}
职位要求
${data.job_describe}
`); $('.lzy-modal.job').css('display', 'flex'); $('html,body').css('overflow', 'hidden'); } }); getData(id); } //$('#pcjob').load("/include/ajax/jobs.aspx", data, function (response, status, xhr) { }) function geiKkpager(totalpage, dataCount, pageNo, id) { var totalRecords = dataCount; //var pageNo = getParameter('pno'); if (!pageNo) { pageNo = 1; } var winname = id; //page_id为容器id window[winname] = kk(id, winname); //生成分页 //有些参数是可选的,比如lang,若不传有默认值 window[winname].generPageHtml( { pno: pageNo, //当前页数 total: totalpage, //总页数 totalRecords: totalRecords, //总数居条数 isGoPage: false, //是否显示跳转到 isShowTotalPage: false, //是否显示总页码 isShowFirstPageBtn: false, //是否显示首页按钮 isShowLastPageBtn: false, //是否显示尾页按钮 isShowPrePageBtn: true, //是否显示上一页按钮 isShowNextPageBtn: true, //是否显示下一页按钮 lang: { prePageText: '<', nextPageText: '>', }, mode: 'click', lang: {}, click: function (n) { this.selectPage(n); searchJob(n, recruitType); return false; }, }, true ); } } //截取字符串 function stringNum(str, num) { return str.substring(0, num); } function searchJobmobile(pageNum, recruitType) { var _workplace = $('#workplaceM').find('p[class="active"]').data('keys'); var _job = $('#jobM').find('p[class="active"]').data('keys'); var _keyword = $('#searchput').val(); var data = { workplace: _workplace !== 'all_data' ? _workplace : '', category: _job !== 'all_data' ? _job : '', keyword: _keyword, pageNum: pageNum, pageSize: 10, recruitType }; //console.log('data:' + data['workplace'] + ',' + data["job"]); var saerchUrl = window._apiRecruitPostUrl; $.ajax({ type: 'get', url: saerchUrl, data: data, dataType: 'json', success: function (data) { let mbJobHtmlArr = []; geiKkpager(data.pages, data.total, pageNum, 'kkpager'); if (data.list && data.list.length > 0) { for (let i = 0; i < data.list.length; i++) { let field = data.list[i]; let liHtml = `

${field.name}

${field.area} | ${field.categray}

${field.range}

${field.create_time}

`; mbJobHtmlArr.push(liHtml); } if (pageNum == 1) { $('#mpjob').html('
加载中,请稍候...
'); $('#mpjob').html(mbJobHtmlArr.join('')); } else { $('#mpjob').append(mbJobHtmlArr.join('')); } $('#loadmore').attr('pagenum', pageNum).attr('totalPage', data.pages); } else { $('#loadmore').text('下面没有了..'); } }, error: function (e) { //alert(e); }, }); //$('#pcjob').load("/include/ajax/jobs.aspx", data, function (response, status, xhr) { }) function geiKkpager(totalpage, dataCount, pageNo, id) { var totalRecords = dataCount; //var pageNo = getParameter('pno'); if (!pageNo) { pageNo = 1; } var winname = id; //page_id为容器id window[winname] = kk(id, winname); //生成分页 //有些参数是可选的,比如lang,若不传有默认值 window[winname].generPageHtml( { pno: pageNo, //当前页数 total: totalpage, //总页数 totalRecords: totalRecords, //总数居条数 mode: 'click', click: function (n) { this.selectPage(n); searchJob(n); return false; }, }, true ); } } function searchContent(flag, nodeid, addTime, keyword) { //console.log('2222222222'); } //新闻手机端列表ajax function search_news(pagenum, pagesize, keywords, newsUrl, nodeid, searchCall) { var data = { keyword: keyword, pagenum: pagenum, pagesize: pagesize, nodeid: nodeid, }; $.ajax({ url: newsUrl, data: data, contentType: 'json', success: function (json) { searchCall(eval('(' + json + ')')); }, }); } function payatten(colum, itemid) { data = { contentid: itemid, jobid: itemid, colum: colum, }; $.ajax({ type: 'POST', url: '/include/ajax/payatten.ashx', data: data, success: function (backdata) { console.log('++:' + backdata); if (backdata == 'ok') { if (colum == 'content') { var act = $('#payatten').attr('class'); if (act == 'active') { $('#payatten').removeClass('active'); } else { $('#payatten').addClass('active'); } } else { $('#payatten').text('已收藏'); } } else if ((backdata = 'nologin')) { alert('请登录后再收藏,点击"确定"跳转到登录页面'); window.location.href = '/lxwm/hyzx/login.aspx'; } }, }); } function weixin(url) { //var apiurl = "http://pan.baidu.com/share/qrcode?w=150&h=150&url=" + url; var apiurl = 'http://qr.topscan.com/api.php?text=' + url; return apiurl; //var qrcode = new QRCode('qrcode', { // text: "http://rtdl.yestem.com", // width: 54, // height: 54 //}); //$.ajax({ // type: "get", // url: "http://pan.baidu.com/share/qrcode", // //jsonp: 'jsoncallback', // data: { // 'w': 150, // 'h': 150, // "url": url // }, // dataType: 'jsonp', // beforeSend: function (xhr) { xhr.setRequestHeader("User-Agent", "headertest"); }, // //crossDomain: true, // success: function (data) { // //console.log(data); // } //}) } /** * 格式化json时间 * @param strTime * @returns {*} * @constructor */ function FormatDate(strTime, str) { return new Date(strTime).Format(str); } /** * 注入日期格式 * @param fmt * @returns {*} * @constructor */ Date.prototype.Format = function (fmt) { var o = { 'M+': this.getMonth() + 1, //月份 'd+': this.getDate(), //日 'h+': this.getHours(), //小时 'm+': this.getMinutes(), //分 's+': this.getSeconds(), //秒 'q+': Math.floor((this.getMonth() + 3) / 3), //季度 S: this.getMilliseconds(), //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)); return fmt; }; var url = window.location.href; $('a[name="weixin"]').click(function () { apiurl = weixin(url); $('#weixinimg').attr('src', apiurl); $('.qrcode-popup').show(); }); $('img[name="weibo"]').click(function () { apiurl = 'http://service.weibo.com/share/share.php?url='; $(this) .parent() .attr('href', apiurl + url); }); // function checkstr(num) { // var str = num.value; // //var str = document.getElementById("userName").value; // var value = str.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\@\.\,\。\,]/g, ""); // num.value = value; // } function close_share(myself) { $(myself).hide(); }