|
@@ -2,28 +2,37 @@ $(function () {
|
|
|
// 图片懒加载
|
|
|
$("img").lazyload();
|
|
|
// 显示区高度
|
|
|
- let ch = document.documentElement.clientHeight || document.body.clientHeight;
|
|
|
- let lock = false;
|
|
|
- // 加载 数据
|
|
|
- let currentPage = 3, totalPage = 3;
|
|
|
+ let ch = document.documentElement.clientHeight || document.body.clientHeight,
|
|
|
+ lock = false,
|
|
|
+ // 加载 数据
|
|
|
+ currentPage = 3, totalPage = 3,
|
|
|
+ // 判断请求参数
|
|
|
+ url = window.location.href,
|
|
|
+ path = lxd.parseUrl(url).pathname
|
|
|
+ , reg = /(?<=zt).*?(?=.html)/, special_category = !path.match(reg) ? '' : path.match(reg)[0];
|
|
|
$(window).scroll(function () {
|
|
|
if (lock) return false;
|
|
|
// 滑动区高度
|
|
|
- let sh = document.documentElement.scrollHeight || document.body.scrollHeight;
|
|
|
- // 滑动位置
|
|
|
- let st = document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
- let c = sh * 1 - ch * 1 - st * 1;
|
|
|
+ let sh = document.documentElement.scrollHeight || document.body.scrollHeight,
|
|
|
+ // 滑动位置
|
|
|
+ st = document.documentElement.scrollTop || document.body.scrollTop,
|
|
|
+ c = sh * 1 - ch * 1 - st * 1;
|
|
|
if (c == 0 && currentPage <= totalPage) {
|
|
|
lock = true;
|
|
|
$(".my-loading").show();
|
|
|
- data({ currentPage }).then(res => { totalPage = res.totalPage; currentPage++; lock = res.lock; $(".my-loading").hide(); })
|
|
|
+
|
|
|
+ data({ currentPage, special_category }).then(res => { totalPage = res.totalPage; currentPage++; lock = res.lock; $(".my-loading").hide(); })
|
|
|
+ }
|
|
|
+ if (c == 0 && currentPage > totalPage) {
|
|
|
+
|
|
|
+ $(".my-loading").html("已经没有可以加载的数据了").show();
|
|
|
}
|
|
|
})
|
|
|
// 加载数据
|
|
|
function data (data) {
|
|
|
return new Promise(resolve => {
|
|
|
$.ajax({
|
|
|
- url: "http://api.gaokaoapp.net/member/news/",
|
|
|
+ url: "http://api.gaokaoapp.net/news/h/",
|
|
|
data: {
|
|
|
...data,
|
|
|
pageSize: 10
|