newsdetail.blade.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>{{ $info->title }} -星优办公软件</title>
  5. <meta name="keywords" content="{{ $info->title }}">
  6. <meta name="description" content="{{ $info->introduction }}">
  7. @include('home.http.common.head')
  8. </head>
  9. <body>
  10. <div class="header">
  11. @include('home.http.common.header')
  12. </div>
  13. <div style="height: 68px;"></div>
  14. <div id="app">
  15. <!--- 解决方案 --->
  16. <div class="index-about" style="padding-top: 40px;">
  17. <div class="width-1200">
  18. <div class="flex-start">
  19. <div class="about-list news-detail">
  20. <p class="news-title overflow">{{ $info->title }}</p>
  21. <p class="news-time">发布日期:{{ date('Y-m-d H:i', $info->created_at) }}</p>
  22. <div class="news-content" id="news-content">
  23. {!! $info->content !!}
  24. </div>
  25. </div>
  26. <div class="about-detail">
  27. <div class="about-area">
  28. <div class="about-title">文章分类</div>
  29. @foreach ($category as $item)
  30. @if($item->id < 17)
  31. <div class="news-item">
  32. <a href="{{ '/news/category/' . $item->mid }}">{{ $item->name }}</a>
  33. </div>
  34. @endif
  35. @endforeach
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. @include('home.http.common.footer')
  42. </div>
  43. </body>
  44. <script type="text/javascript" src="/static/public/swiper/swiper-4.3.3.min.js"></script>
  45. <script>
  46. var vm = new Vue({
  47. el: '#app',
  48. data: {
  49. imgUrl: 'https://audio.yososoft.com/static',
  50. target: 'https://audio.yososoft.com',
  51. newsInfo: [],
  52. categoryList: [],
  53. },
  54. mounted: function() {
  55. var mySwiper = new Swiper('.swiper-container', {
  56. loop: true,
  57. // 如果需要分页器
  58. pagination: {
  59. el: '.swiper-pagination',
  60. }
  61. })
  62. this.init();
  63. },
  64. //方法
  65. methods: {
  66. init: function() {
  67. let _this = this;
  68. let mid = this.getQueryVariable('mid');
  69. axios.post(_this.target + '/api/index/m_news_info', {
  70. mid: mid
  71. }).then(function(response) {
  72. if (response.data.result) {
  73. this.newsInfo = response.data.data;
  74. this.newsInfo.created_at = new Date(this.newsInfo.created_at * 1000)
  75. .toLocaleString();
  76. let dom = document.getElementById('news-content');
  77. dom.innerHTML = this.newsInfo.content;
  78. }
  79. }.bind(_this)).catch(function(error) {
  80. console.log(error);
  81. });
  82. axios.post(_this.target + '/api/index/m_category_list', {
  83. size: 10,
  84. page: 1
  85. }).then(function(response) {
  86. if (response.data.result) {
  87. this.categoryList = response.data.data.list;
  88. }
  89. }.bind(_this)).catch(function(error) {
  90. console.log(error);
  91. });
  92. },
  93. getQueryVariable: function(variable) {
  94. var query = window.location.search.substring(1);
  95. var vars = query.split("&");
  96. for (var i = 0; i < vars.length; i++) {
  97. var pair = vars[i].split("=");
  98. if (pair[0] == variable) {
  99. return pair[1];
  100. }
  101. }
  102. return (false);
  103. }
  104. },
  105. });
  106. </script>
  107. </html>