/** * Created by yuanweihai on 2017/4/17. */ $(function () { var scrollA = new alan.scrollAnimate(); var $window = $(window); var window_width = $window.width(); var window_height = $window.height(); var $body = $('body'); var $jobnum = null; $('.TpicBox').each(function(index,e){ var wid=$(this).width(), hei=wid*($(this).attr('data-hei')); $(this).css('height',hei+"px"); }); $(window).resize(function() { $('.TpicBox').each(function(){ var wid=$(this).width(), hei=wid*($(this).attr('data-hei')); $(this).css('height',hei+"px"); }); }); if(navigator.appName == "Microsoft Internet Explorer"&&parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE",""))<12){ } // 仅在PC端执行 if(window_width > 800){ if($('.p-banner').length > 0){ $('.p-banner').addClass('on'); } } if(window_width <= 800){ $('.getAppNav').on('click',function(){ if($(this).hasClass('menuActive')){ $(this).removeClass('menuActive').html(''); $('.appItem').slideUp(); $('.appMask').hide(); }else{ $(this).addClass('menuActive').html(''); $('.appItem').slideDown(); $('.appMask').show(); } }); $('.appItem').find('.navDown').on('click',function(){ var _this = $(this).siblings('.navDown'); if($(this).hasClass('active')){ $(this).removeClass('active'); $(this).find('.childNav').slideUp(); }else{ $(this).addClass('active'); $(this).find('.childNav').slideDown(); _this.removeClass('active').find('.childNav').slideUp(); } }); } //必发bifa88手机版登入改11.15 $('.jobDown').on('click',function(){ var item = $('.job-detail'), btnItem = $('.jobDown') _this = $(this), num = _this.attr('data-num'); if(num!=$jobnum){ item.slideUp(); btnItem.removeClass('active'); item.eq((num-1)).slideToggle(); _this.toggleClass('active'); $jobnum = num; }else{ item.eq((num-1)).slideToggle(); _this.toggleClass('active'); } }); $('.fileBtn').on('click',function(e){ $('#responds').html('请上传3M以内word文件'); $("#jobid").val(this.id); e.stopPropagation(); $('.pop .cv').slideDown(); }); $('.pop .cv .box').on('click',function(e){ e.stopPropagation(); }) $(window).on('click',function(){ $('.pop .cv').slideUp(); }); $('.pop .cv .close').on('click',function(){ $(this).parents('.cv').slideUp(); }); if($body.hasClass('index')){ // banner轮播 var $banner_li = $('.banner ul li'); $('.banner ul').bxSlider({ mode:'horizontal', touchEnabled:false, speed:1000, auto:true, pause:3000, controls:false, pager:false, onSliderLoad:function (currentIndex) { $banner_li.eq(currentIndex).addClass('on').siblings().removeClass('on'); }, onSlideAfter:function($slideElement, oldIndex, newIndex){ $banner_li.eq(newIndex).addClass('on').siblings().removeClass('on'); } }); // tab $('.tt-about').on('click',function () { $(this).addClass('on'); $('.tt-news').removeClass('on'); $('.tab-box ul').removeClass('on'); }); $('.tt-news').on('click',function () { $(this).addClass('on'); $('.tt-about').removeClass('on'); $('.tab-box ul').addClass('on'); }); //logo list if(window_width <= 800){ $('.logo-list ul').bxSlider({ slideWidth: ((window_width-10)/2), minSlides: 2, maxSlides: 2, slideMargin: 10, pager:false, controls: true, prevText: '', nextText: '', nextSelector:'.logo-list .next', prevSelector:'.logo-list .prev' }); }else{ $('.logo-list ul').bxSlider({ slideWidth: 180, minSlides: 6, maxSlides: 6, slideMargin: 10, pager:false, controls: true, prevText: '', nextText: '', nextSelector:'.logo-list .next', prevSelector:'.logo-list .prev' }); } } if($body.hasClass('culture')){ $('.list ul .pic-box').on('mouseenter',function () { $(this).parent().addClass('on').siblings().removeClass('on'); }); $('.list ul').on('mouseleave',function () { $('.list ul li').eq(2).addClass('on').siblings().removeClass('on'); }); } if($body.hasClass('honor')){ if(window_width <= 800){ var slide = $('.pic-box ul').bxSlider({ slideWidth: 280, minSlides: 1, maxSlides: 1, slideMargin: 10, infiniteLoop:false, pager:false, touchEnabled:false, controls: true, prevText: '', nextText: '', nextSelector:'.pic-box .next', prevSelector:'.pic-box .prev' }); }else{ var slide = $('.pic-box ul').bxSlider({ slideWidth: 280, minSlides: 4, maxSlides: 4, slideMargin: 10, infiniteLoop:false, pager:false, touchEnabled:false, controls: true, prevText: '', nextText: '', nextSelector:'.pic-box .next', prevSelector:'.pic-box .prev' }); } var $ul = $('.pic-box ul'); $('.year-list').on('click','a',function(){ $(this).addClass('on').parent().siblings().find('a').removeClass('on'); var year = parseInt($(this).text()); $.post('honor.html', {year:year}, function(data,textStatus){ var html = ''; if(textStatus == "success"){ //console.log(data); var _data = eval(data); $.each(_data,function (index,item) { var li = '
  • ' + '
    ' + '
    ' + '
    ' + '

    ' + '
    ' + '
    ' + '
    ' + '

    '+item.description+'

    ' + '
  • '; html += li; }); $ul.html(html); slide.reloadSlider(); } } ); }); $('.pic-box ul').on('click','.layout-table',function () { var img = $(this).attr('data-img'); if(!img) return; var str = ''; sharonTips.alert({ title:' ', html:str, width:600 }); }); } if($body.hasClass('contact')){ /* $('#chose').change(function () { var v = $(this).val(); if (v == '') return; getData(); });*/ $('.down > li').click(function () { var v = $(this).find('span').text(); getData(v); }); var self = this, downBox = $('.layout-down'), ishave = downBox.length<=0 ? true : false; if(ishave) return false; if(self.isAnimating) return false; self.isAnimating = true; downBox.on('click',function(e){ var isAni = $(this).hasClass('father'), txtBox = $(this).find('.downTxt'), down = $(this).find('ul'), downLi = down.find('li'), showAni = down.attr('data-effect'), hideAni = down.attr('data-hideAni'); var isActive = $(this).hasClass('active'); console.log(isActive); if(isActive){ downLi.removeClass(showAni).addClass(hideAni); setTimeout(function(){ down.hide(); self.isAnimating = false; },self.aniTime); downBox.removeClass('active'); }else{ down.show(); downLi.removeClass(hideAni).addClass(showAni); setTimeout(function(){ self.isAnimating = false; },self.aniTime); downBox.addClass('active'); } downLi.on('click',function(){ var txt = $(this).html(); txtBox.html(txt); }); }); //var province_json = [{"shengfen":"福建省"},{"shengfen":"\u9ed1\u9f99\u6c5f\u7701"},{"shengfen":"\u5c71\u4e1c\u7701"},{"shengfen":"\u56db\u5ddd\u7701"}]; $("svg circle").each(function(){ var self = $(this); var _top = self.offset().top; var _left = self.offset().left; var _name = self.attr('data-title'); // 根据后台返回的data,判断是否显示该省份 $.each(province_json,function (index,item) { if (item.shengfen === self.attr('data-title')){ if(item.shengfen=='福建省'){ $("body").append('
    '+item.shengfen+'
    '); }else{ $("body").append('
    '+item.shengfen+'
    '); } } }) }); $(window).resize(function() { $('.map-province').remove(); $("svg circle").each(function(){ var self = $(this); var _top = self.offset().top; var _left = self.offset().left; var _name = self.attr('data-title'); // 根据后台返回的data,判断是否显示该省份 $.each(province_json,function (index,item) { if (item.shengfen === self.attr('data-title')){ $("body").append('
    '+item.shengfen+'
    '); } }) }); }); $('i.icon-search').on('click',function(){ getData(); }); function getData(v){ /*var v = $('#chose').val();*/ var _place = $('#searchTxt').val(); $.get('contact.html', {department:v,place:_place}, function(data,textStatus){ if(textStatus == "success"){ var _data = eval(data); if(true){ var html = ''; $.each(_data,function (index,item) { var li = '
  • ' + '' + '

    '+item.title+'

    ' + '

    电话:'+item.description+'

    ' + '

    地址:'+item.content+'

    ' + '
  • '; html +=li; }); } $('.map-txt ul:not(.down)').html(html); } } ); } $("body").on('click','polygon',function () { var a = $(this).attr('data-title'); $.get('contact.html', {province:a}, function(data,textStatus){ if(textStatus == "success"){ console.log(data); var _data = eval(data); if(true){ var html = ''; $.each(_data,function (index,item) { var li = '
  • ' + '' + '

    '+item.title+'

    ' + '

    电话:'+item.description+'

    ' + '

    地址:'+item.content+'

    ' + '
  • '; html +=li; }); } $('.map-txt ul:not(.down)').html(html); } } ); }); //地图初始化时,在地图上添加一个marker标记,鼠标点击marker可弹出自定义的信息窗体 var map = new AMap.Map("container", { resizeEnable: true, center: [118.191307,24.473987], zoom: 16, zoomEnable:false, }); addMarker(); //添加marker标记 function addMarker() { map.clearMap(); var marker = new AMap.Marker({ map: map, position: [118.191307,24.473987] }); }; AMap.plugin(['AMap.ToolBar','AMap.Scale'], function(){ map.addControl(new AMap.ToolBar()); map.addControl(new AMap.Scale()); }); } if($body.hasClass('event')){ var Tnum = $('.year ul li').length; var bgSlide = $('.bg-slide ul').bxSlider({ mode:'fade', touchEnabled:false, speed:400, auto:false, controls:false, pager:false, startSlide:Tnum-1, }); var imgSlide = $('.img-slide ul').bxSlider({ mode:'horizontal', touchEnabled:false, speed:400, auto:false, controls:false, pager:false, startSlide:Tnum, }); var eventSlide = $('.list-slide ul').bxSlider({ mode:'horizontal', touchEnabled:false, speed:400, auto:false, controls:false, pager:false, startSlide:Tnum, }); // 滑动 var $year_ul = $('.year ul'); var $year_li = $year_ul.find('li'); $year_ul.width($year_li.length * 160); move(Tnum-1); var _index = Tnum-1; // 当前激活的年份是4; $year_ul.on('click','span',function () { _index = $(this).parent('li').index(); move(_index); bgSlide.goToSlide(_index); imgSlide.goToSlide(_index); eventSlide.goToSlide(_index); }); $year_ul.on('click','ins',function () { _index = $(this).parent('li').index(); move(_index); bgSlide.goToSlide(_index); imgSlide.goToSlide(_index); eventSlide.goToSlide(_index); }); $('.event-list').on('click',function (event) { var target = event.target; if($(target).hasClass('prev')){ if(_index-1 < 0){ return false; }else{ _index--; move(_index); bgSlide.goToSlide(_index); imgSlide.goToSlide(_index); eventSlide.goToSlide(_index); } } if($(target).hasClass('next')){ if(_index+1 > $year_li.length-1){ return false; }else{ _index++; move(_index); bgSlide.goToSlide(_index); imgSlide.goToSlide(_index); eventSlide.goToSlide(_index); } } event.stopPropagation(); }); function move(index) { console.log(index); var left = -((index-3) * 160) + 'px'; $year_ul.css({ 'transform':'translateX('+left+')', '-webkit-transform': 'translateX('+left+')' }); } } if($body.hasClass('job-old')){ var $cover = $('.alert-cover'); var $alert = $('.alert-box'); function close() { $cover.hide(); $alert.hide(); } function open() { $cover.show(); $alert.show(); } $('.job-list').on('click','span',function () { open(); }); $alert.find('.close').on('click',function () { close(); }); } if($body.hasClass('news')){ var $newsUl = $('.news-list ul'); var $loadMore = $('.loadMore'); var currentYear = 2017; var currentKey = parseInt($body.attr('data-num')); var getData = function (page) { $.post('news.html', {year:currentYear,key:currentKey,page:page}, function(data,textStatus){ var html = ''; if(textStatus === "success"){ var _data = eval(data); console.log(_data); if(_data.length > 0){ $.each(_data,function (index,item) { var li = '
  • \n' + ' \n' + '
    \n' + '
    \n' + ' '+item.cdate+'
    \n' + ' /
    \n' + ' '+item.cmonth+'月\n' + '
    \n' + '
    \n' + '
    \n' + ' \n' + ' \n' + ' \n' + '
    \n' + '
    \n' + '
    \n' + '

    '+item.ktitle+'

    \n' + '

    '+item.kdescription+'

    \n' + '
    \n' + '
    \n' + '
    \n' + '
  • '; html += li; }) $newsUl.append(html).attr("data-page",page); $loadMore.removeClass('disable'); }else{ sharonTips.toast('没有更多数据') } } }); } $loadMore.on('click',function () { if($(this).hasClass('disable')){ return false; }else{ $(this).addClass('disable'); } var page = parseInt($newsUl.attr("data-page")) + 1; getData(page); }); $('.news-type').on('click','a',function () { var year = parseInt($(this).text()); if(year === currentYear){ //sharonTips.toast(1111); return false; }else{ //sharonTips.toast(222); $(this).addClass('on').siblings().removeClass('on'); $newsUl.html('').attr('data-page',0); currentYear = year; $loadMore.removeClass('disable'); $loadMore.click(); } }); } });