123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- /* ============================================================
- * jquery.jobslist.js 职位搜索列表页面js集合
- * ============================================================
- * Copyright aix.
- * ============================================================ */
- !function($) {
- // 搜索类型切换
- $('.J_sli').click(function() {
- $(this).addClass('select').siblings().removeClass('select');
- var indexValue = $('.J_sli').index(this);
- var typeValue = $.trim($(this).data('type'));
- $('input[name="search_type"]').val(typeValue);
- });
- // 收起、展开筛选条件
- foldAction('.J_showbtn', '.J_so_condition');
- function foldAction(trigger, performer) {
- $(trigger).click(function() {
- $(this).addClass('none').siblings().removeClass('none');
- var indexValue = $(trigger).index(this);
- if (indexValue) {
- $(performer).slideUp();
- } else {
- $(performer).slideDown();
- }
- })
- }
- $('.J_showJobConditions').off().on('click', function(event) {
- $(this).addClass('none').siblings().removeClass('none');
- var indexValue = $('.J_showJobConditions').index(this);
- if (indexValue) {
- $('.for_up').slideDown();
- } else {
- $('.for_up').slideUp();
- }
- });
- // 列表详细和简易切换
- $('.J_detailList').click(function() {
- $(this).addClass('select').siblings('.J_detailList').removeClass('select');
- var indexValue = $('.J_detailList').index(this),
- type = $(this).attr('show_type');
- if (indexValue) {
- $('.J_allListBox').find('.detail').hide();
- $('.J_allListBox').find('.J_jobsStatus').addClass('show');
- } else {
- $('.J_allListBox').find('.detail').show();
- $('.J_allListBox').find('.J_jobsStatus').removeClass('show');
- }
- $.getJSON(list_show_type_url,{action:'jobs',type:type});
- });
- // 周边职位和热门职位切换
- $('.J_job_hotnear').click(function() {
- $(this).addClass('select').siblings('.J_job_hotnear').removeClass('select');
- var indexValue = $('.J_job_hotnear').index(this);
- $('.J_job_hotnear_show').removeClass('show');
- $('.J_job_hotnear_show').eq(indexValue).addClass('show');
- });
- // 列表详细展开收起
- $('.J_jobsStatus').click(function(){
- if($(this).hasClass('show')){
- $(this).removeClass('show');
- $(this).closest('.J_jobsList').find('.detail').show();
- }else{
- $(this).addClass('show');
- $(this).closest('.J_jobsList').find('.detail').hide();
- }
- });
- // 全选、反选
- $('.J_allSelected').click(function() {
- var isChecked = $(this).hasClass('select');
- var listArray = $('.J_allListBox .J_allList');
- if (isChecked) {
- $(this).removeClass('select');
- $.each(listArray, function(index, val) {
- $(this).removeClass('select');
- });
- $('.J_jobsList').removeClass('select');
- } else {
- $(this).addClass('select');
- $.each(listArray, function(index, val) {
- $(this).addClass('select');
- });
- $('.J_jobsList').addClass('select');
- }
-
- });
- $('.J_allList').click(function(){
- var isChecked = $(this).hasClass('select');
- if (isChecked) {
- $(this).removeClass('select');
- $(this).closest('.J_jobsList').removeClass('select');
- $('.J_allSelected').removeClass('select');
- } else {
- $(this).addClass('select');
- $(this).closest('.J_jobsList').addClass('select');
- var listArray = $('.J_allListBox .J_allList');
- var listCheckedArray = $('.J_allListBox .J_allList.select');
- if (listArray.length == listCheckedArray.length) {
- $('.J_allSelected').addClass('select');
- }
- }
- });
- var qrcode_bind_time,
- waiting_weixin_bind = function(){
- $.getJSON(qscms.root+"?m=Home&c=Members&a=waiting_weixin_bind");
- };
-
- // 申请、收藏职位
- jobSomething('.J_applyForJob', '申请成功!', true);
- jobSomething('.J_collectForJob', '收藏成功!', false);
- function jobSomething (trigger, successMsg, iscreate) {
- $(trigger).click(function() {
- var hasFavor = false;
- if (trigger =='.J_applyForJob' && $(this).hasClass('has-deliver')) {
- return false;
- }
- if (trigger =='.J_collectForJob' && $(this).hasClass('has-favor')) {
- // return false;
- hasFavor = true;
- }
- var that = this;
- var batch = eval($(this).data('batch'));
- var url = $(this).data('url');
- var hasAllowance = false;
- var jidValue = '';
- if (batch) { // 是否是批量
- if (listCheckEmpty()) {
- disapperTooltip('remind','您还没有选择职位!');
- return false;
- } else {
- var listCheckedObjs = $('.J_allListBox .J_allList.select');
- var jidArray = new Array();
- $.each(listCheckedObjs, function(index, val) {
- jidArray[index] = $(this).closest('.J_jobsList').data('jid');
- if ($(this).closest('.J_jobsList').find('.i-m').length) {
- hasAllowance = true;
- }
- });
- jidValue = jidArray.join(',');
- }
- } else {
- jidValue = $(this).closest('.J_jobsList').data('jid');
- }
- if (visitor_log == 'per') {
- ajaxFroJob(hasFavor);
- }else if (visitor_log == 'com') {
- disapperTooltip("remind", '请登录个人账号!');
- } else {
- trigger_login('per');
- }
- function ajaxFroJob(hasFavor) {
- if (iscreate) {
- var qsDialog = $(this).dialog({
- title:'申请职位',
- loading: true,
- footer: false,
- border: false,
- backdrop: true
- });
- $.ajax({
- url: url,
- type: 'POST',
- dataType: 'json',
- data: {jobs_id: jidValue,_token:csrf_token}
- }).done(function(data) {
- qsDialog.hide();
- if (parseInt(data.status) == 2) { //多份简历,选择简历弹窗
- var qsDialogSon = $(this).dialog({
- title: '选择投递简历',
- border: false,
- content:data.html,
- yes:function(){
- qsDialogSon.setCloseDialog(false);
- //获取所选简历id
- var resume_id = $('#resume_id').val();
- //申请职位
- var apply_url = url;
- $.post(url,{jobs_id:jidValue,resume_id:resume_id,_token:csrf_token},function(res){
- var dail_jids = res.fail_jids;
- //简历完善度不够
- qsDialogSon.hide();
- if (res.status == 0) {
- if(res.resume_id){
- var qsDialogSon1 = $(this).dialog({
- title: '申请职位',
- content: res.html,
- yes: function () {
- location.href = resume_update_url+'/'+res.resume_id;
- },
- btns: ['完善简历', '放弃申请']
- });
- }
- } else {
- //申请职位的最后弹出信息
- var qsDialogSons1 = $(this).dialog({
- title: '申请职位',
- content: res.html
- });
- //清除选中效果、修改收藏按钮效果
- var listArray = $('.J_allListBox .J_jobsList.select .J_allList');
- $('.J_allSelected').removeClass('select');
- $.each(listArray, function(index, val) {
- $(this).removeClass('select');
- if (dail_jids.length <1) {
- $(this).parent().parent().find('.detail .rbtn .deliver').text("已申请").addClass('has-deliver');
- } else {
- if (dail_jids.indexOf($(this).parent().parent().data('jid').toString()) == -1) {
- $(this).parent().parent().find('.detail .rbtn .deliver').text("已申请").addClass('has-deliver');
- }
- }
- });
- $('.J_jobsList').removeClass('select');
- if (!batch) {
- if (dail_jids.length <1) {
- $(that).text("已申请").addClass('has-deliver');
- }
- }
- }
- });
- }
- });
- } else {
- //只有一份审核通过的简历
- if (data.status == 0) {
- if(data.resume_id){
- var qsDialogSon1 = $(this).dialog({
- title: '申请职位',
- content: data.html,
- yes: function () {
- var url = resume_update_url+'/'+data.resume_id;
- location.href = url;
- },
- btns: ['完善简历', '放弃申请']
- });
- }
- } else {
- //申请职位的最后弹出信息
- var qsDialogSons1 = $(this).dialog({
- title: '申请职位',
- content: data.html
- });
- //清除选中效果、修改收藏按钮效果
- var listArray = $('.J_allListBox .J_jobsList.select .J_allList');
- $('.J_allSelected').removeClass('select');
- var dail_jids = data.fail_jids;
- $.each(listArray, function(index, val) {
- $(this).removeClass('select');
- if (dail_jids.length <1) {
- $(this).parent().parent().find('.detail .rbtn .deliver').text("已申请").addClass('has-deliver');
- } else {
- if (dail_jids.indexOf($(this).parent().parent().data('jid').toString()) == -1) {
- $(this).parent().parent().find('.detail .rbtn .deliver').text("已申请").addClass('has-deliver');
- }
- }
- });
- $('.J_jobsList').removeClass('select');
- if (!batch) {
- if (dail_jids.length <1) {
- $(that).text("已申请").addClass('has-deliver');
- }
- }
- }
- }
- }).error(function(result){
- qsDialog.hide();
- if(result.status == 500 || result.status == 400){
- disapperTooltip('remind',result.responseJSON.message);
- } else {
- disapperTooltip('remind','操作失败!');
- }
- });
- }else {
- if (hasFavor) {
- $.ajax({
- url: url,
- type: 'POST',
- dataType: 'json',
- data: {jid: jidValue,_token:csrf_token}
- }).done(function(data) {
- if(data.status==1){
- disapperTooltip('success','取消收藏成功!');
- //清除选中效果、修改已收藏按钮效果
- var listArray = $('.J_allListBox .J_jobsList.select .J_allList');
- $('.J_allSelected').removeClass('select');
- $.each(listArray, function(index, val) {
- $(this).removeClass('select');
- $(this).parent().parent().find('.detail .rbtn .favorites').text("收藏").removeClass('has-favor');
- });
- $('.J_jobsList').removeClass('select');
- if (!batch) {
- if($(that).text().length>0){
- $(that).text("收藏");
- }
- $(that).removeClass('has-favor');
- }
- } else {
- disapperTooltip('remind',data.msg);
- }
- }).error(function(result){
- if(result.status == 500 || result.status == 400){
- disapperTooltip('remind',result.responseJSON.message);
- } else {
- disapperTooltip('remind','操作失败!');
- }
- });
- } else {
- $.ajax({
- url: url,
- type: 'POST',
- dataType: 'json',
- data: {jid: jidValue,_token:csrf_token}
- }).done(function(data) {
- if(data.status==1){
- disapperTooltip('success',data.msg);
- //清除选中效果、修改收藏按钮效果
- var listArray = $('.J_allListBox .J_jobsList.select .J_allList');
- $('.J_allSelected').removeClass('select');
- $.each(listArray, function(index, val) {
- $(this).removeClass('select');
- $(this).parent().parent().find('.detail .rbtn .favorites').text("已收藏").addClass('has-favor');
- });
- $('.J_jobsList').removeClass('select');
- if (!batch) {
- if($(that).text().length>0){
- $(that).text("已收藏");
- }
- $(that).addClass('has-favor');
- }
- } else {
- disapperTooltip('remind',data.msg);
- }
- }).error(function(result){
- if(result.status == 500 || result.status == 400){
- disapperTooltip('remind',result.responseJSON.message);
- } else {
- disapperTooltip('remind','操作失败!');
- }
- });
- }
- }
- }
- });
- }
- function trigger_login(type){
- var qsDialog = $(this).dialog({
- loading: true,
- footer: false,
- header: false,
- border: false,
- backdrop: true
- });
- $.post(login_dig_url, {_token:csrf_token,type:type,redirect_url:redirect_url},function(result){
- if(result.status==1){
- qsDialog.hide();
- if (type == 'per') {
- var type_title = '个人会员登录';
- }else{
- var type_title = '企业会员登录';
- }
- var qsDialogSon = $(this).dialog({
- title: type_title,
- footer: false,
- border: false
- });
- qsDialogSon.setInnerPadding(false);
- qsDialogSon.setContent(result.html)
- } else {
- qsDialog.hide();
- disapperTooltip('remind','操作失败');
- }
- });
- }
- // 判断列表中是否有选中的项目
- function listCheckEmpty() {
- var listCheckedArray = $('.J_allListBox .J_allList.select');
- if (listCheckedArray.length) {
- return false;
- } else {
- return true;
- }
- }
- // 关键字改变,搜索条件清空
- $('#ajax_search_location').submit(function(){
- var nowKeyValue = $.trim($('input[name="key"]').val());
- var orgKeyValue = $.trim($('input[name="key"]').data('original'));
- if(nowKeyValue.length && nowKeyValue.length<2){
- disapperTooltip("remind",'关健字长度需大于2个字!');
- return !1;
- }
- if (!(nowKeyValue == orgKeyValue)) {
- $('.J_forclear').val('');
- }
- $('input[name="key"]').val(htmlspecialchars($('input[name="key"]').val()));
- var post_data = $('#ajax_search_location').serialize();
- if(qscms.keyUrlencode==1){
- post_data = encodeURI(post_data);
- }
- $.post($('#ajax_search_location').attr('action'),post_data,function(result){
- window.location=result.data;
- },'json');
- return false;
- });
-
- }(window.jQuery);
|