锘?/鍙傛暟 var pageIndex = 1; var pageIndex2 = 0; var pageSize = 5; var allPage = 0; var allPage2 = 0; var _index = 0; $(function () { BindData(); // BindData2(); handleSwiper(); }); //鑾峰彇鏁版嵁 function BindData() { var datas = { cate: 1, page: pageIndex, PageSize: pageSize, }; console.log(datas) $.zmdAjax("apiNews.html", "get", datas, false, function (obj) { if (obj.result == true) { var str = ""; $.each(obj.data.news_list, function (i, e) { str += '
  • '; str += ''; str += '
    '; str += '
    '; //str += ' '; str += '
    '; str += '
    '; str += '
    ' + e.title + '
    '; str += '
    ' + e.time + '
    '; str += '
    '; str += '
    '; str += '
    ' str += '
  • '; }); allPage = Math.ceil(obj.count / pageSize); console.log(allPage, pageIndex); if ((pageIndex + 1) == allPage) { getPagerMsg2($('#news1_btn')) } else { getPagerBtn2($('#news1_btn'), 'BindNext(1)') } $("#news1>ul").append(str); setTimeout(function () { heightNum(); }, 50) } else { getErrorMsg(obj.message); //閿欒鎻愮ず } }, function (obj) { getErrorMsg(obj.message); //閿欒鎻愮ず }); } //鑾峰彇鏁版嵁 function BindData2() { var datas = { LanguageType: LanguageId, CId: 4, PageIndex: pageIndex2, PageSize: pageSize }; $.zmdAjax("InformationList", "POST", datas, false, function (obj) { if (obj.code == 0) { var str = ""; $.each(obj.data, function (i, e) { str += '
  • '; str += ''; str += '
    '; str += '
    '; //str += ' '; str += '
    '; str += '
    '; str += '
    ' + e.Title + '
    '; str += '
    ' + e.PubDate + '
    '; str += '
    '; str += '
    '; str += '
    ' str += '
  • '; }); allPage2 = Math.ceil(obj.count / pageSize); if ((pageIndex2 + 1) == allPage2) { getPagerMsg2($('#news2_btn')) } else { getPagerBtn2($('#news2_btn'), 'BindNext(2)') } $("#news2>ul").append(str); setTimeout(function () { heightNum(); }, 50) } else { getErrorMsg(obj.message); //閿欒鎻愮ず } }, function (obj) { getErrorMsg(obj.message); //閿欒鎻愮ず }); } function handleSwiper(params) { // clearInterval(_timer); var tabsSwiper; tabsSwiper = new Swiper('.swiper-container', { autoHeight: true, speed: 500, onSlideChangeStart: function () { $(".tabs .active").removeClass('active'); $(".tabs span").eq(tabsSwiper.activeIndex).addClass('active'); }, on: { slideChangeTransitionStart: function () { _index = this.activeIndex; $(".tabs .active").removeClass('active'); $($(".tabs>span")[this.activeIndex]).addClass('active'); //鍒囨崲缁撴潫鏃讹紝鍛婅瘔鎴戠幇鍦ㄦ槸绗嚑涓猻lide }, } }); setTimeout(function () { heightNum(); }, 100) $(".tabs span").on('touchstart mousedown', function (e) { e.preventDefault() $(".tabs .active").removeClass('active'); $(this).addClass('active'); tabsSwiper.slideTo($(this).index()); }); $(".tabs span").click(function (e) { e.preventDefault(); }); } function heightNum() { $(".swiper-wrapper").css({ "height": $($(".swiper-slide")[_index]).height() }); } function BindNext(type) { if (type == 1) { pageIndex++; BindData(); } else { pageIndex2++; BindData2(); } }