${_data[i].day}
${_data[i].yea_month}
`
}
_total = data.meta.pagination.total;
pageCount = data.meta.pagination.total_pages
$('.news-lists').append(_item)
console.log('_total', _total)
console.log('pageCount', pageCount)
console.log(data)
}
})
}
function initPagination() {
$(".pages-div").pagination({
totalData: _total,
pageCount: pageCount,
showData: 10,
coping: true,
callback: function (api) {
$('.news-lists').empty()
$('html, body').animate({scrollTop: 300}, 500)
getNews(api.getCurrent(), _state)
}
});
}
$('.news-state').click(function () {
$(this).addClass("news-active")
$(this).siblings().removeClass("news-active")
const _state = $(this).attr('data-state')
changeState(_state)
initPagination()
// console.log(_state)
})
var changeState = function (state) {
console.log(state)
_state = state;
$('.news-lists').empty()
$('html, body').animate({scrollTop: 300}, 500)
getNews(1, state)
}
function slideList() {
const _params = {
include: 'class',
page: 1,
per_page: 10,
title: title,
class: 'news'
}
$.ajax({
url: _url + 'api/articles',
method: 'get',
// async: false,
data: _params,
success: function (data) {
const _data = data.data
var _item = ''
for (var i = 0; i < _data.length; i++) {
_item += ``
}
$('.swiper-wrapper').append(_item)
var swiper = new Swiper('.swiper-container', {
slidesPerView: 4,
// spaceBetween: 10,
slidesPerGroup: 4,
loop: true,
// loopFillGroupWithBlank: true,
direction: 'vertical',
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
}
})
}
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]);
return null; //返回参数值
}
})