File: /www/wwwroot//m.wfehn.com/static/js/ryzz2.js
$(function() {
$('.m-contain .sub-navs').hide()
var page = 1;
var pageSize = 20;
var award_type = 1
var award_year = 0
var loading = true
var finished = false
// $('.footer-m').hide()
new Swiper(".m-honor-navs .head", {
spaceBetween: 32,
slidesPerView: 'auto',
centeredSlides: true,
// breakpoints: {
// 765: {
// slidesPerView: 3,
// },
// 360: {
// slidesPerView: 2.5,
// },
// },
centeredSlidesBounds: true,
normalizeSlideIndex: false, //关闭标准化的Slide 索引
// slidesPerGroup: 3,
// loop: true,
// loopFillGroupWithBlank: true,
// loop: true,
// slideToClickedSlide: true,
// centeredSlides : true,
navigation: {
nextEl: '.m-honor-navs .head .swiper-button-next',
prevEl: '.m-honor-navs .head .swiper-button-prev',
},
on:{
init: function(swiper){
award_type = (this.activeIndex+1)
initFun(null)
},
slideChange: function(){
award_type = (this.activeIndex+1)
initFun(null)
},
click: function(swiper,event){
swiper.slideTo(swiper.clickedIndex);//切换到第一个slide,速度为1秒
// $('.m-honor-navs .head .swiper-slide').removeClass('swiper-slide-active')
// $('.m-honor-navs .head .swiper-slide:eq('+swiper.clickedIndex+')').addClass('swiper-slide-active')
// award_type = (swiper.clickedIndex + 1)
// initFun(null)
},
},
});
$(window).bind("scroll", function () {
if ($(window).scrollTop() + $(window).height() >= ($(document).height() - 1170)) {
if(loading && !finished){
getHonorList();
}
}
});
function initFun(year) {
page = 1
pageSize = 20
award_type = award_type
award_year = year || 0
loading = true
finished = false
$('.loadindg-mobile').show()
$('.m-contain .list').html('')
if(!year){
if(award_type == 2 || award_type == 3){
$('.m-contain .sub-navs').hide()
}
// $('.m-contain .sub-navs').show()
// } else {
// $('.m-contain .sub-navs').hide()
// }
$('.m-contain .sub-navs .times .main1 .box').removeClass('active')
if(award_type == 2){
$('.time22').show()
$('.time33').hide()
$('.time22 .box:eq(0)').addClass('active')
award_year = $('.time22 .box:eq(0)').attr('data-value')
jisuanw2(2)
} else if(award_type == 3){
$('.time33').show()
$('.time22').hide()
$('.time33 .box:eq(0)').addClass('active')
award_year = $('.time33 .box:eq(0)').attr('data-value')
jisuanw2(3)
}
}
getHonorList()
}
// 获取荣誉资质
function getHonorList() {
loading = false
langurl = langurl?langurl:'/honor';
$.ajax({
type: "get",
data: {
noQuery: 'test',
pageLimit: pageSize,
page: page,
award_type: award_type,
award_year: 0,
},
url: langurl,
success: function (data) {
var res = JSON.parse(data)
var strs = ''
res.data.forEach(function(item, index){
strs += `
<div class="item">
<div class="box">
<div class="cover pic">
<div class="img_box">
<img src="${item.img}" alt="">
</div>
</div>
<div class="info ellipsis2">
${item.title}
</div>
<div style="display:none;height:0">
${item.description}
</div>
</div>
</div>
`;
})
$('.m-contain .list').append(strs)
loading = true
if(res.data.length < pageSize) {
finished = true
$('.loadindg-mobile').hide()
// $('.footer-m').show()
} else {
page = page + 1
}
}
});
}
$(document).on('click','.m-contain .sub-navs .times .main1 .box', function(e){
var v = $(this).attr('data-value')
$('.m-contain .sub-navs .times .main1 .box').removeClass('active')
$(this).addClass('active')
initFun(v)
})
function jisuanw2(index){
if(index == 2){
var timeW = $('.m-contain .sub-navs .times .time22 .box').length * 52
$('.m-contain .sub-navs .times .time22').width(timeW)
}
if(index == 3){
var timeW = $('.m-contain .sub-navs .times .time33 .box').length * 52
$('.m-contain .sub-navs .times .time33').width(timeW)
}
}
})