var Jiagle = Jiagle || {}; Jiagle.config = Jiagle.config || {}; Jiagle.required = function (args) { if (args.ext == 'js') { $('head').append(''); } else if (args.ext == 'css') { $('head').append(''); } } $(function () { $('#info div').each(function () { if (/^is/.test(this.className)) { Jiagle.config[this.className] = this.innerHTML != 0; } else { Jiagle.config[this.className] = this.innerHTML; } }); Jiagle.config.baseURL = Jiagle.config.baseURL || '/'; var link = window.location.href; var linkarray = link.split("/"); actionlink = link.replace(linkarray[linkarray.length - 1], ''); $('#jiagleform').attr("action", actionlink); //var reCat = new RegExp(""); var reCat = /www.+\.com\/[a-z]+_/; var arrdata = link.match(reCat); var linkSite = ""; if (arrdata) { linkSite = arrdata[0].substr(0, arrdata[0].length - 1); } if (!linkSite) { var linkArray = link.split("/"); var linkCat = /www.+\.com/; var linkHome = linkArray[2].match(linkCat); if (linkHome) { linkSite = linkArray[2] + "/" + linkArray[3] + "_"; } else { linkSite = linkArray[2] + "/"; } } else { linkSite = linkSite + "_"; } Jiagle.config.baseSiteURL = linkSite ? linkSite : "/"; if (window.btoa) Jiagle.config.returnURL = window.btoa(window.location.pathname); $.ajax({ url: '/index.php', type: 'post', dataType: 'json', data: { option: 'com_k2', view: 'ajax', task: 'islogin' }, success: function (data) { Jiagle.config.isLogin = data; var em = $('.topschfr').find('.em2'); if (data) { em.eq(0).html('个人中心'); em.eq(1).html('退出'); }else { em.eq(0).html('登录'); em.eq(1).html('注册'); } } }); $('.sq-hover').hover(function () { $(this).find('.j-nav-menu-link').show(); }, function () { $(this).find('.j-nav-menu-link').hide(); }) new Swiper('.cp_01_slide.swiper-container-horizontal', { slidesPerView: 1, effect: 'slide', paginationClickable: true, pagination: { el: '.cp_01_sp.swiper-pagination-bullets', clickable: true, }, }); new Swiper('.cpxq_05b_slide', { slidesPerView: 3, effect: 'slide', spaceBetween: 10, paginationClickable: true, pagination: { el: '.cpxq_05b_sp ', clickable: true, }, }); new Swiper('.cpxq_01_slide', { slidesPerView: 1, effect: 'slide', spaceBetween: 10, paginationClickable: true, pagination: { el: '.cpxq_01_sp', clickable: true, }, }); //首页轮播图 new Swiper('.banner_slide ', { slidesPerView: 1, effect: 'fade', paginationClickable: true, pagination: { el: '.banner_sp', clickable: true, }, // loop: true, autoplay: { delay: 6000, stopOnLastSlide: false, disableOnInteraction: true, }, }); //首页产品推荐 var swiper_product = new Swiper('.in_02t_slide ', { slidesPerView: 'auto', spaceBetween: 10, paginationClickable: true, }); //求购 new Swiper('.swiper-purchase', { autoplay: true, loop: false, pagination: { el: '.purchase_pagination', clickable: true, }, }); //热门推荐 new Swiper('.in_02_t.recommend', { slidesPerView: 2, spaceBetween: 15, autoplay: true, loop: false, pagination: { el: '.recommend_pagination', clickable: true, }, }); //行业展会 new Swiper('.trade_slide', { autoplay: false, loop: false, spaceBetween: 0, navigation: { nextEl: '#trade_next', prevEl: '#trade_prev', }, }); $('.in_02_t.trade a').each(function (i,el) { if ($(this).attr('href')){ if ($(this).attr('href').length < 3){ $(this).attr('href','https://www.hotelex.cn/') } } }) setTimeout(function () { var clone = $('.trade_slide .swiper-slide').eq(0).clone(1); $('.trade_slide .swiper-wrapper').append(clone); }, 2000); $('a.yingxiaoshouce').click(function () { $('.popup.yingxiaoshouce').show(); }) //底部adv new Swiper('.slide1 .swiper-bottomSlide', { autoplay:true, loop:true, pagination: { el: '.bottomSlide_box .bottomSlide-pagination', clickable: true, }, navigation: { nextEl: '#bottomSlide_next', prevEl: '#bottomSlide_prev', }, }); $('.bottomSlide_nav span').click(function () { var index = $('.bottomSlide_nav span').index($(this)); $('.bottomSlide_nav span').removeClass('forcus'); $(this).addClass('forcus'); $('.bottom_slide_item').hide(); $('.bottom_slide_item').eq(index).show(); var slide = '.slide'+ (index + 1); new Swiper(slide+ ' .swiper-bottomSlide', { autoplay:true, loop:true, pagination: { el: '.bottomSlide_box .bottomSlide-pagination', clickable: true, }, navigation: { nextEl: '#bottomSlide_next', prevEl: '#bottomSlide_prev', }, }); }) $('.bottom_slide_item.slide2').hide(); $('.bottom_slide_item.slide3').hide(); $(".in_02t_slide .swiper-slide").click(function () { $('.in_02t_slide').find('a').removeClass('on'); $(this).find('a').addClass('on') var index = $(this).index(); swiper_product.slideTo(index, 1000, false); var num = $(this).find('a').data('num') if (!$(this).hasClass('read')){ $(this).addClass("read"); $('.in_02c_slide').find('.product_box').eq(num).find('img').each(function (i,el){ var img = $(this).data('src'); $(this).attr('src',img); }) } $('.in_02c_slide').find('.product_box').css('display', 'none').removeClass('focus'); $('.in_02c_slide').find('.product_box').eq(num).css('display', 'block').addClass('focus'); var alias = $(this).data('alias'); if (alias){ alias = 'cat_'+alias } $('#product_more').attr('href','/chanpin/'+alias); new Swiper('.product_box.focus', { slidesPerView: 1, paginationClickable: true, pagination: { el: '.in_02c_pagination', clickable: true, }, loop: true, autoplay: true, }); }) $(".in_02t_slide .swiper-slide").eq(0).click(); new Swiper('.in_06c_slide', { slidesPerView: 1, paginationClickable: true, navigation: { nextEl: '#live_next', prevEl: '#live_prev', }, }); var curtop = $(window).scrollTop(); $(window).scroll(function () { curtop = $(window).scrollTop(); scorig(curtop); }); scorig(curtop); function scorig(_curtop) { if (_curtop > 50) { $(".rightfr .scrollTop").css('opacity', '1'); } else { $(".rightfr .scrollTop").css('opacity', '0'); } } $(".rightfr .scrollTop").click(function () { $('body,html').animate({scrollTop: "0px"}, 500); return false; }); $(".cp_07_t>a").click(function(){ var more = $(this).text(); if (more == "更多 >>") { $(this).html("收起 >>"); $(this).parent().next().css('height', "auto"); } else { $(this).text("更多 >>"); $(this).parent().next().css({height: "44px"}); } }) //厂商页面海外直采 $('#country').change(function () { var country_id = $(this).val(); window.location.href = getSelectAddressUrl('country', country_id); }) $('#provice').change(function () { var provice_id = $(this).val(); window.location.href = getSelectAddressUrl('province', provice_id); }) //厂商查看更多按钮 var sc_flag = 1, limitStart_changshang = 4, sc_over = 0; $(".companyProduct_addmore").click(function () { var data = { limitStart: limitStart_changshang, uid: $('[name=first_company_uid]').val(), option: 'com_jiudian_mobile', view: 'changshang', task: 'changshang.getProducts' }; addmoreProduct(data, $('.companyProduct_addmore'), $(".companyProduct dl"), sc_flag, limitStart_changshang, sc_over, 'cp'); limitStart_changshang = limitStart_changshang + 4; return false; }); $("#hotProduct_addmore").click(function () { var data = { limitStart: limitStart_changshang, option: 'com_jiudian_mobile', view: 'changshang', task: 'changshang.gethotProducts' }; addmoreProduct(data, $("#hotProduct_addmore"), $("#hotproduct ul"), sc_flag, limitStart_changshang, sc_over, 'hot_cp'); limitStart_changshang = limitStart_changshang + 4; return false; }); var limitstart = 3; $("#sp_addmore").click(function () { var data = { limitstart: limitstart, option: 'com_jiudian_mobile', view: 'changshang', task: 'changshang.getcompany' }; addmoreProduct(data, $("#sp_addmore"), $("#sp ul"), sc_flag, limitstart, sc_over, 'sp'); limitstart = limitstart + 3; return false; }); //产品页面查看更多产品 var limitStart_chanpin = 20; $(".cpmore_click").click(function () { var data = { limitStart: limitStart_chanpin, option: 'com_jiudian_mobile', view: 'chanpin', task: 'chanpin.getProducts' }; addmoreProduct(data, $('.cpmore_click'), $(".cpmore_frame ul"), sc_flag, limitStart_chanpin, sc_over, 'hot_cp'); limitStart_chanpin = limitStart_chanpin + 20; return false; }); //手机商铺 $(".cp_03_c li").click(function () { if ($(this).hasClass("on")) { $(this).removeClass("on") } else { $(this).addClass("on"); $(this).siblings().removeClass("on") } }) //产品详情 $(".cqxq_03_t a").click(function () { $('.cqxq_03_t').find('a').removeClass("on"); $(this).addClass("on"); var index = $(this).index() - 1; $(".cqxq_03fr").find(".cqxq_03_c").css("display", "none"); $(".cqxq_03fr").find(".cqxq_03_c").eq(index).css("display", "block"); $(window).scrollTop() return false; }); $(".cpxq_05_c a").click(function () { $(".cpxq_05_c").find('a').css('color', "#000") $(this).css("color", "#9a1b5a") var id = this.id; var company_id = $("[name=company_id]").val(); var html=''; j.submit({ 'data': { 'option': 'com_jiudian_mobile', 'view': 'chanpin_detail', 'task': 'chanpin_detail.getother', 'cid': id, 'company_id': company_id }, 'success': function (data) { $.each(data, function(i, item){ html+='
'; }); console.log('html',html) document.getElementById("product_silde").innerHTML=html; new Swiper('.cpxq_05b_slide', { slidesPerView: 3, effect: 'slide', spaceBetween: 10, paginationClickable: true, pagination: { el: '.cpxq_05b_sp ', clickable: true, }, }); return false; }, 'failure': function (e) { console.log(e) return false; } }) }); $(".cslb_03_down>img").click(function () { if ($(this).parent().parent().parent().parent().parent().hasClass('on')) { $(this).parent().parent().parent().parent().parent().removeClass('on') } else { $(this).parent().parent().parent().parent().parent().addClass('on') } }); $(".enquiry").each(function () { MobileEnquiry({btn: $(this), id: this.id, item: 'enquiry'}); }) $(".lease_product").each(function () { MobileLease({btn: $(this), id: this.id, item: 'lease_product'}); }) $(".sample_product").each(function () { MobileSample({btn: $(this), id: this.id, item: 'sample_product'}); }); $(".agency_product").each(function () { MobileAgency({btn: $(this), id: this.id, item: 'agency_product'}); }); //产品/公司收藏 $('.fav_company').each(function () { Jiagle.doCookie('fav_returnurl', window.location.href) var id = this.id, title = this.title; MobileFavorite({btn: $(this), id: id, item: 'changshang'}); // clab_tracker.ready(function(){ // this.track("sygle_store_fav", {"c_storename": title}); // }); }); $('.fav_product').each(function () { console.log("收藏了") Jiagle.doCookie('fav_returnurl', window.location.href) var id = this.id, title = this.title; MobileFavorite({btn: $(this), id: id, item: 'product'}); // clab_tracker.ready(function(){ // this.track("sygle_product_fav", {"c_productname": title}); // }); }); $('.like_company').each(function () { Jiagle.doCookie('fav_returnurl', window.location.href) var id = this.id, title = this.title; MobileFavorite({btn: $(this), id: id, item: 'changshang'}); // clab_tracker.ready(function(){ // this.track("sygle_store_fav", {"c_storename": title}); // }); }); $('.like_product').each(function () { Jiagle.doCookie('fav_returnurl', window.location.href) var id = this.id, title = this.title; MobileFavorite({btn: $(this), id: id, item: 'product'}); // clab_tracker.ready(function(){ // this.track("sygle_product_fav", {"c_productname": title}); // }); }); $('.like_product_detail').each(function () { Jiagle.doCookie('fav_returnurl', window.location.href) var id = this.id, title = this.title; MobileFavorite({btn: $(this), id: id, item: 'product_p'}); }); }); function addmoreProduct(data, obj1, obj2, sc_flag, limitStart, sc_over, type, url = null) { if (sc_flag !== 1) { return; } if (sc_over) { return; } // 准备 sc_flag = 0; obj1.html('正在加载数据...'); // 收集结果 var html = ''; j.submit({ 'data': data, 'success': function (data) { if (!data || data.length === 0) { sc_over = 1; obj1.html('没有更多数据!'); return; } if (type == "cp") { for (var i = 0; i < data.length; i++) { html += '' + data[i].title;
if (data[i].isVIP){
html += '';
}
if (data[i].isVR ){
if (!data[i].isVIP){
html +='
';
}
html += '
';
}
if (data[i].hotel_ezbuy_mp == 2){
if (!data[i].isVIP || !data[i].isVR){
html +='
';
}
html += '
';
}
html += '
成立时间:' + data[i].ext[52] + '年
' + '业务类型:' + data[i].com_type + '
' + '地址:' + data[i].province + '-' + data[i].city + '
' + '公司网址:' + data[i].ext[51] + '
' + '在售产品:' + data[i].num + '
'; if (data[i].brand){ html +='直营品牌:' + data[i].brand + '
'; } html += '主要产品:' + data[i].ext[58] + '
' + '
' +
'' + data[i].title + '
'; html += data[i].introtext; html += '地址: " + companyAddress + "
" + "