index.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {extend name="layout/base" /}
  2. {block name="header"}
  3. <link rel="stylesheet" href="__STATIC__/css/mobile/game-info.css">
  4. <link rel="stylesheet" href="__STATIC__/css/mobile/style.css">
  5. {/block}
  6. {block name="content"}
  7. <!-- header start -->
  8. <header class="top">
  9. <div class="header">
  10. <a href="javascript:history.back(-1)"><img src="__STATIC__/images/mobile/icon/left.png" class="back"></a>
  11. <h1>资讯</h1>
  12. <div>
  13. <div class="search-icon"><a href="{:getMobileSearchUrl()}"><img src="__STATIC__/images/mobile/icon/search.png"></a></div>
  14. <div class="menu"><img src="__STATIC__/images/mobile/icon/menu-bar.png"></div>
  15. </div>
  16. </div>
  17. <ul class="game_rec">
  18. {volist name="newsCatgList" id="cat"}
  19. <li><a href="javascript:;" onclick="window.location.replace('{:getMobileNewsIndexUrl($cat['id'])}')" {if($type==$cat.id)} class="active" {else/} {/if}>{$cat.name}</a></li>
  20. {/volist}
  21. </ul>
  22. </header>
  23. <!-- header end -->
  24. <!-- 游戏资讯 -->
  25. <div class="info-new" style="margin-top: 1rem;">
  26. <p style="line-height: 0.5rem;">相关资讯<span>{$totalNewsCnt}</span>条</p>
  27. {volist name="list" id="vo"}
  28. <div class="new-info">
  29. <a href="{$vo.url}"> <img lazy-src="{$vo.image}" src="__STATIC__/images/icon/990-625.png" class="new-img"></a>
  30. <div>
  31. <a href="{$vo.url}">
  32. <h4>{$vo.title}</h4>
  33. <p>{$vo.createtime}</p>
  34. </a>
  35. </div>
  36. </div>
  37. {/volist}
  38. </div>
  39. <div class="weui-loadmore">
  40. <i class="weui-loading"></i>
  41. <span class="weui-loadmore__tips">数据加载中,请稍等</span>
  42. </div>
  43. <div class="no-more-data"><span></span>已经到底啦(>_<)<span></span></div>
  44. {empty name="list"}
  45. <div class="no_content">
  46. <div>
  47. <img src="/static/images/mobile/icon/information.png">
  48. <p>暂无相关资讯</p>
  49. </div>
  50. </div>
  51. {/empty}
  52. {include file="layout/footer" /}
  53. {/block}
  54. {block name="detail_js"}
  55. <script>
  56. var currentPage = parseInt("{$list->currentPage()}");
  57. var lastPage = parseInt("{$list->lastPage()}");
  58. var total = parseInt("{$list->total()}");
  59. var url = window.location.href;
  60. var defaultImg = "__STATIC__/images/icon/150-150.png";
  61. $(".no-more-data").hide();
  62. var loading = false; //状态标记
  63. $(document.body).infinite(90).on("infinite", function() {
  64. if (loading) return;
  65. loading = true;
  66. if (currentPage + 1 > lastPage) {
  67. $(".weui-loadmore").hide();
  68. if (currentPage > 1) {
  69. $(".no-more-data").show();
  70. }
  71. loading = false;
  72. return false;
  73. }
  74. $(".weui-loadmore").show();
  75. setTimeout(function() {
  76. currentPage += 1;
  77. $.ajax({
  78. type: "POST",
  79. timeOut: 10000,
  80. url: url,
  81. data: {
  82. "page": currentPage
  83. },
  84. async: false,
  85. success: function(res) {
  86. console.log(res);
  87. var arr = res.data.data;
  88. arr.forEach(function(val, index) {
  89. $(".info-new").append(
  90. '<div class="new-info">'+
  91. '<a href="'+val.url+'"> <img lazy-src="'+val.image+'" src="/static/images/icon/990-625.png" class="new-img"></a>'+
  92. '<div>'+
  93. '<a href="'+val.url+'">'+
  94. '<h4>'+val.title+'</h4>'+
  95. '<p>'+val.createtime +'</p></a>'+
  96. '</div>'+
  97. '</div>'
  98. );
  99. });
  100. },
  101. error: function() {
  102. $.alert("网络错误,请刷新页面重试");
  103. }
  104. });
  105. $.getScript("/static/js/mobile/reload.js");
  106. $(".weui-loadmore").hide();
  107. loading = false;
  108. }, 500); //模拟延迟
  109. });
  110. </script>
  111. {/block}