newsdetail.blade.php 3.7 KB

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