1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
    6. <title>资讯</title>
    7. <meta name="robots" content="noindex,nofollow">
    8. <meta name="full-screen" content="yes">
    9. <meta name="x5-fullscreen" content="true">
    10. <meta name="x5-orientation" content="portrait">
    11. <meta name="x5-page-mode" content="app">
    12. <meta name="HandheldFriendly" content="true">
    13. <meta name="format-detection" content="telephone=no">
    14. <meta name="apple-mobile-web-app-capable" content="yes">
    15. <meta name="apple-mobile-web-app-status-bar-style" content="white">
    16. <meta name="viewport"
    17. content="user-scalable=no,width=device-width,height=device-height,minimum-scale=1,maximum-scale=1,viewport-fit=cover">
    18. <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    19. <style>
    20. a{
    21. color: none;
    22. }
    23. .page{
    24. width: 90%;
    25. margin: 5%;
    26. }
    27. .item{
    28. border-bottom: 1px solid #00000011;
    29. margin: 10px auto;
    30. display: flex;
    31. height: 100px;
    32. }
    33. .cover{
    34. width: 120px;
    35. min-width: 120px;
    36. height: 80px;
    37. object-fit: cover;
    38. border-radius: 5px;
    39. }
    40. .cover img{
    41. width: 100%;
    42. height: 100%;
    43. border-radius: 5px;
    44. }
    45. .title{
    46. height: 65px;
    47. }
    48. .info{
    49. font-size: 12px;
    50. }
    51. .content{
    52. width: 100%;
    53. }
    54. .icon {
    55. width: 1em;
    56. height: 1em;
    57. vertical-align: -0.15em;
    58. fill: currentColor;
    59. overflow: hidden;
    60. }
    61. .footer[data-v-2c430d6e] {
    62. height: 100%
    63. }
    64. .footer .a[data-v-2c430d6e] {
    65. padding-bottom: constant(safe-area-inset-bottom);
    66. padding-bottom: env(safe-area-inset-bottom);
    67. margin-bottom: 55px
    68. }
    69. .footer footer[data-v-2c430d6e] {
    70. display: -ms-flexbox;
    71. display: flex;
    72. position: fixed;
    73. bottom: 0;
    74. left: 0;
    75. width: 100%;
    76. height: 54px;
    77. font-size: 12px;
    78. z-index: 999;
    79. background-color: #343c4c;
    80. -ms-flex-pack: distribute;
    81. justify-content: space-around
    82. }
    83. .footer footer .sty[data-v-2c430d6e] {
    84. display: block;
    85. font-size: 18px;
    86. color: #bbbbbb;
    87. padding-top: 9px
    88. }
    89. .footer footer .router-link-active a[data-v-2c430d6e] {
    90. color: #ff2a2a;
    91. }
    92. .footer footer .router-link-active span[data-v-2c430d6e] {
    93. color: #ff2a2a;
    94. }
    95. .footer footer .one[data-v-2c430d6e] {
    96. width: 20%;
    97. text-align: center;
    98. line-height: 2;
    99. text-decoration: none;
    100. color: #bbbbbb
    101. }
    102. .footer .fade-enter[data-v-2c430d6e] {
    103. opacity: .2
    104. }
    105. .footer .fade-leave[data-v-2c430d6e] {
    106. opacity: 1
    107. }
    108. .footer .fade-enter-active[data-v-2c430d6e] {
    109. transition: opacity .2s
    110. }
    111. </style>
    112. </head>
    113. <body>
    114. <div class="page">
    115. <div class="list">
    116. </div>
    117. </div>
    118. </body>
    119. <script>
    120. let req = 0,page=1;
    121. //上拉加载
    122. $(window).scroll(function () {
    123. var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度
    124. var scrollHeight = $(document).height(); //当前页面的总高度
    125. var clientHeight = $(this).height(); //当前可视的页面高度
    126. if (scrollTop + clientHeight >= scrollHeight - 50) {
    127. getContent();
    128. }
    129. })
    130. function navigate(link){
    131. window.location.href = link;
    132. }
    133. getContent();
    134. function getContent(){
    135. if(req === 1){
    136. return false;
    137. }
    138. req = 1
    139. $.ajax({
    140. url:"/get_news?page="+page,
    141. success:function(res){
    142. if(res.code === 0){
    143. res.data.forEach(e => {
    144. 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>';
    145. $(".list").append(html);
    146. });
    147. req = 0;
    148. page = page+1
    149. if($(".list").height() < $(window).height()){
    150. getContent();
    151. }
    152. }else{
    153. alert('请求错误,请联系客服');
    154. }
    155. }
    156. })
    157. }
    158. </script>
    159. </html>