newsdetail.blade.php 3.9 KB

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