<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>资讯</title> <meta name="robots" content="noindex,nofollow"> <meta name="full-screen" content="yes"> <meta name="x5-fullscreen" content="true"> <meta name="x5-orientation" content="portrait"> <meta name="x5-page-mode" content="app"> <meta name="HandheldFriendly" content="true"> <meta name="format-detection" content="telephone=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="white"> <meta name="viewport" content="user-scalable=no,width=device-width,height=device-height,minimum-scale=1,maximum-scale=1,viewport-fit=cover"> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <style> a{ color: none; } .page{ width: 90%; margin: 5%; } .item{ border-bottom: 1px solid #00000011; margin: 10px auto; display: flex; height: 100px; } .cover{ width: 120px; min-width: 120px; height: 80px; object-fit: cover; border-radius: 5px; } .cover img{ width: 100%; height: 100%; border-radius: 5px; } .title{ height: 65px; } .info{ font-size: 12px; } .content{ width: 100%; } .icon { width: 1em; height: 1em; vertical-align: -0.15em; fill: currentColor; overflow: hidden; } .footer[data-v-2c430d6e] { height: 100% } .footer .a[data-v-2c430d6e] { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); margin-bottom: 55px } .footer footer[data-v-2c430d6e] { display: -ms-flexbox; display: flex; position: fixed; bottom: 0; left: 0; width: 100%; height: 54px; font-size: 12px; z-index: 999; background-color: #343c4c; -ms-flex-pack: distribute; justify-content: space-around } .footer footer .sty[data-v-2c430d6e] { display: block; font-size: 18px; color: #bbbbbb; padding-top: 9px } .footer footer .router-link-active a[data-v-2c430d6e] { color: #ff2a2a; } .footer footer .router-link-active span[data-v-2c430d6e] { color: #ff2a2a; } .footer footer .one[data-v-2c430d6e] { width: 20%; text-align: center; line-height: 2; text-decoration: none; color: #bbbbbb } .footer .fade-enter[data-v-2c430d6e] { opacity: .2 } .footer .fade-leave[data-v-2c430d6e] { opacity: 1 } .footer .fade-enter-active[data-v-2c430d6e] { transition: opacity .2s } </style></head><body> <div class="page"> <div class="list"> </div> </div></body><script> let req = 0,page=1; //上拉加载 $(window).scroll(function () { var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度 var scrollHeight = $(document).height(); //当前页面的总高度 var clientHeight = $(this).height(); //当前可视的页面高度 if (scrollTop + clientHeight >= scrollHeight - 50) { getContent(); } }) function navigate(link){ window.location.href = link; } getContent(); function getContent(){ if(req === 1){ return false; } req = 1 $.ajax({ url:"/get_news?page="+page, success:function(res){ if(res.code === 0){ res.data.forEach(e => { let html = '<div class="item" onClick="navigate('+e.link+');"><div class="content"><div class="title">'+e.title+'</div><div class="info"><span>'+e.date+'</span><span>作者</span><span style="float: right;padding-right: 8px;">'+e.read+'阅读</span></div></div><div class="cover"><img src="'+e.cover+'" alt=""></div></div>'; $(".list").append(html); }); req = 0; page = page+1 if($(".list").height() < $(window).height()){ getContent(); } }else{ alert('请求错误,请联系客服'); } } }) }</script></html>