newslist.blade.php 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>文章教程-帮助中心-星优办公软件</title>
  5. @include('home.http.common.head')
  6. <link href="/static/css/jquery.page.css" rel="stylesheet" type="text/css">
  7. <script src="/static/js/jquery.js"></script>
  8. <script src="/static/js/jquery.page.js"></script>
  9. </head>
  10. <body>
  11. <div class="header">
  12. @include('home.http.common.header')
  13. </div>
  14. <div style="height: 68px;"></div>
  15. <div id="app">
  16. <!--- 解决方案 --->
  17. <div class="index-about" style="padding-top: 40px;">
  18. <div class="width-1200">
  19. <div class="flex-start">
  20. <div class="about-list">
  21. @foreach ($list as $item)
  22. <div class="about-item">
  23. <div class="i-time">
  24. <a href="{{ url('/news/detail/' . $item->mid) }}">
  25. @if ($item->logo)
  26. <img src="{{ $item->logo }}" class="new-img" />
  27. @else
  28. <img src="/static/images/about-img2.jpg" class="new-img" />
  29. @endif
  30. </a>
  31. </div>
  32. <div class="i-content">
  33. <a href="{{ url('/news/detail/' . $item->mid) }}">
  34. <p class="i-title overflow">{{ $item->title }}</p>
  35. <p class="i-desc more-overflow">{{ $item->introduction }}</p>
  36. </a>
  37. </div>
  38. </div>
  39. @endforeach
  40. <div id="page"></div>
  41. </div>
  42. <div class="about-detail">
  43. <div class="about-area">
  44. <div class="about-title">文章分类</div>
  45. @foreach ($category as $item)
  46. <div class="news-item">
  47. <a href="{{ url('/news/category/' . $item->mid . '?page=1') }}"
  48. target="_blank">{{ $item->name }}</a>
  49. </div>
  50. @endforeach
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. @include('home.http.common.footer')
  57. </div>
  58. </body>
  59. <script>
  60. let total = Number ({{ $total }});
  61. let totalPage = Math.ceil(total / 15);
  62. let currentUrl = window.location.href;
  63. let url = new URL(currentUrl);
  64. let currentPage = url.searchParams.get("page") ?? 1;
  65. setTimeout(function() {
  66. $("#page").Page({
  67. totalPages: totalPage, //total Pages
  68. liNums: 10, //the li numbers(advice use odd)
  69. activeClass: 'activP', //active class style
  70. firstPage: '首', //first button name
  71. lastPage: '末', //last button name
  72. prv: '<', //prev button name
  73. next: '>', //next button name
  74. hasFirstPage: true, //whether has first button
  75. hasLastPage: true, //whether has last button
  76. hasPrv: true, //whether has prev button
  77. hasNext: true, //whether has next button
  78. callBack: function(_page) {
  79. url.searchParams.set('page', _page);
  80. window.location.href = url.href;
  81. }
  82. });
  83. $('.pagingUl li a').each((index, item) => {
  84. $(item).removeClass('activP');
  85. let num = $(item).text();
  86. if(num == currentPage){
  87. $(item).addClass('activP');
  88. }
  89. })
  90. }, 100)
  91. </script>
  92. </html>