/*** Created by bd2010141 on 2018/9/28. */ //var t = 5; //var timer; var validator;//表单验证对象 $(document).ready(function(){ _DoAjaxAsyncTrue('GET',{},'/webapi/v1/getSlideshow',function(res){ if(!isempty(res)){ $(".imgPlayer").html(res); //$(".imgPlayer").imgPlayer({}); $('.imgPlayer').owlCarousel({ loop: true, margin: 0, nav:false, dots:true, autoplay:true, autoplayTimeout:4000, autoplayHoverPause:true, animateOut: 'fadeOut', items: 1 }) } }); // 初始化轮播图 $('#featured_carousel').owlCarousel({ margin: 0, nav:false, dots:true, responsive: { 0: { items: 2 }, 580: { items: 3 }, 780: { items: 4 }, 1024:{ items: 5 } } }); var _items = 0; var _width = $(document).width(); var _len = $('.item').length; // 上页 $('#prev').on('click', function (e) { e.preventDefault(); $(this).siblings('#next').css({ cursor:'pointer', opacity:'0.8', filter:'alpha(opacity=80)' }); _items -= 1; if ( _items <= 0) { _items = 0; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } $('#featured_carousel').trigger('to.owl.carousel', [_items, 300]); }); // 下页 $('#next').on('click', function(e) { e.preventDefault(); $(this).siblings('#prev').css({ cursor:'pointer', opacity:'0.8', filter:'alpha(opacity=80)' }); _items += 1; if ( _width >= 1024 ) { if ( _items >= Math.ceil(_len/5) - 1 ) { _items = Math.ceil(_len/5) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } else if ( 780 <= _width && _width < 1024 ) { if ( _items >= Math.ceil(_len/4) - 1 ) { _items = Math.ceil(_len/4) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } else if ( 580 <= _width && _width < 780 ) { if ( _items >= Math.ceil(_len/3) - 1 ) { _items = Math.ceil(_len/3) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } else if ( _width < 580 ) { if ( _items >= Math.ceil(_len/2) - 1 ) { _items = Math.ceil(_len/2) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } $('#featured_carousel').trigger('to.owl.carousel', [_items, 300]); }); //添加自定义检查密码的方法 validator=$('#login_form').validate({ rules:{ email:{ required: true }, password:{ required: true, minlength: 6, maxlength:18 } }, messages:{ email:{ required:"请输入邮箱地址或手机号" }, password:{ required:"请输入密码", minlength:"密码最少为6个字符", maxlength:"密码最多为18个字符" } } }); try{ $("#email")[0].focus(); } catch (e){} //tab 切换 $('.index_tab_title li').click(function() { var idx = $(this).index(); $(this).addClass('current').siblings().removeClass('current'); $('.tab_content').eq(idx).show().siblings().hide(); }); _loadIndexNews(); }); function _loadIndexNews(){ _DoAjaxAsyncTrue("GET",{},"/webapi/v1/index/huodongNewsList",function(res){ //加载首页展会 if(res.huodong.length>0){ var aListHtml = '
\

\ 资讯 更多 +\

\
'; $.each(res.huodong, function(idx, item){ aListHtml += ''; }) aListHtml += '
'; $(".activity-area").html(aListHtml); }else{ $(".activity-area").remove(); } //加载首页新闻 if(res.news.length>0){ var aListHtml = ''; var newsTypeList = ['新品速递', '展会会议', 'taptap188官网入口大促', '产品资料', '智在taptap188官网入口', "公司动态"]; $.each(res.news, function(idx, item){ var newsType = '新闻'; var h_news_type = parseInt(item.h_news_type); if(h_news_type<=(newsTypeList.length-1)){ newsType = newsTypeList[h_news_type]; } aListHtml += '['+newsType+'] '+ item.h_title +''.format(item); }) $(".bide-news-con").html(aListHtml); }else{ $(".bide-news-con").html('暂无新闻'); } }) } //预览视频 function _openVideoBox(){ layer.open({ type: 2, area: ['930px','530px'], fix: false, //不固定 btnAlign: 'c', title: false, content: "/video", shadeClose:true, resize:false }); } function _openLoginBox(){ if(isempty(getCookie("access_token"))) { $(".common_mask").remove(); var html = '
\
\

会员登录

\
\ \
\
\
'; $("body").append(html); }else{ window.location.href='/suggestion.html'; } } function _login(){ $(".errorBox").hide(); var flag = $("#login_form").valid(); if(!flag){ validator.focusInvalid(); return false; } var isSave=$(".input_check").is(":checked"); var email=$("#email").val(); var password=$("#password").val(); // var userid=''; // if(!$('.company').hasClass('hide')){ // userid=$('.company option:selected').val(); // } var params={"email":email,"password":password,"isSave":isSave}; _DoAjaxAsyncTrue('POST',params, '/webapi/v1/user/login', function () { window.location.href='/suggestion.html'; }); } _domKey13(_login); function _close(obj){ $(obj).parents('.common_mask').hide(); } function _toUrl(){ window.location.href='/suggestion.html'; } /*20230911首页移动端视频*/ function _openVideoPhone(){ $('#video_content').html(''); $('#video_box').show(); } function _closeVideo(){ $('#video_content').html(''); $('#video_box').hide(); }