show.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. @extends('theme::layout.public')
  2. @section('seo_title'){{ parse_seo_template('seo_article_title',$article) }}@endsection
  3. @section('seo_keyword'){{ parse_seo_template('seo_article_keyword',$article) }}@endsection
  4. @section('seo_description'){{ parse_seo_template('seo_article_description',$article) }}@endsection
  5. @section('css')
  6. <link href="{{ asset('/static/js/fancybox/jquery.fancybox.min.css')}}" rel="stylesheet">
  7. @endsection
  8. @section('content')
  9. <div class="row mt-10">
  10. <div class="col-xs-12 col-md-9 main">
  11. <div class="widget-article">
  12. <h3 class="title">{{ $article->title }}</h3>
  13. @if($article->tags)
  14. <ul class="taglist-inline">
  15. @foreach($article->tags as $tag)
  16. <li class="tagPopup"><a class="tag" href="{{ route('ask.tag.index',['id'=>$tag->id]) }}">{{ $tag->name }}</a></li>
  17. @endforeach
  18. </ul>
  19. @endif
  20. <div class="content mt-10">
  21. <div class="quote mb-20">
  22. {{ $article->summary }}
  23. </div>
  24. <div class="text-fmt">
  25. {!! $article->content !!}
  26. </div>
  27. <div class="post-opt mt-30">
  28. <ul class="list-inline text-muted">
  29. <li>
  30. <i class="fa fa-clock-o"></i>
  31. 发表于 {{ timestamp_format($article->created_at) }}
  32. </li>
  33. <li>阅读 ( {{$article->views}} )</li>
  34. @if($article->category)
  35. <li>分类:<a href="{{ route('website.blog',['category_slug'=>$article->category->slug]) }}" target="_blank">{{ $article->category->name }}</a>
  36. @endif
  37. </li>
  38. @if($article->status !== 2 && Auth()->check() && (Auth()->user()->id === $article->user_id || Auth()->user()->can('admin.login') ) )
  39. <li><a href="{{ route('blog.article.edit',['id'=>$article->id]) }}" class="edit" data-toggle="tooltip" data-placement="right" title="" data-original-title="进一步完善文章内容"><i class="fa fa-edit"></i> 编辑</a></li>
  40. @endif
  41. @if(Auth()->check())
  42. <li><a href="#" class="report_btn" data-source_type="article" data-source_id="{{ $article->id }}" data-toggle="modal" data-target="#send_report_model" ><i class="fa fa-flag-o"></i> 举报</a></li>
  43. @endif
  44. </ul>
  45. </div>
  46. </div>
  47. <div class="text-center mt-30 mb-20">
  48. <button id="support-button" class="btn btn-success btn-lg mr-5" data-source_id="{{ $article->id }}" data-source_type="article" data-support_num="{{ $article->supports }}">{{ $article->supports }} 推荐</button>
  49. @if($article->user->qrcode)
  50. <button class="btn btn-warning btn-lg" data-toggle="modal" data-target="#payment-qrcode-modal-article-{{ $article->id }}" ><i class="fa fa-heart-o" aria-hidden="true"></i> 打赏</button>
  51. @endif
  52. @if(Auth()->check() && Auth()->user()->isCollected(get_class($article),$article->id))
  53. <button id="collect-button" class="btn btn-default btn-lg" data-loading-text="加载中..." data-source_type = "article" data-source_id = "{{ $article->id }}" > 已收藏</button>
  54. @else
  55. <button id="collect-button" class="btn btn-default btn-lg" data-loading-text="加载中..." data-source_type = "article" data-source_id = "{{ $article->id }}" > 收藏</button>
  56. @endif
  57. </div>
  58. @if(Setting()->get('website_share_code')!='')
  59. <div class="mb-10">
  60. {!! Setting()->get('website_share_code') !!}
  61. </div>
  62. @endif
  63. </div>
  64. <div class="widget-relation">
  65. <div class="row">
  66. <div class="col-md-6">
  67. <h4>你可能感兴趣的文章</h4>
  68. <ul class="widget-links list-unstyled">
  69. @foreach($relatedArticles as $relatedArticle)
  70. @if($relatedArticle->id != $article->id)
  71. <li class="widget-links-item">
  72. <a title="{{ $relatedArticle->title }}" href="{{ route('blog.article.detail',['article_id'=>$relatedArticle->id]) }}">{{ $relatedArticle->title }}</a>
  73. <small class="text-muted">{{ $relatedArticle->views }} 浏览</small>
  74. </li>
  75. @endif
  76. @endforeach
  77. </ul>
  78. </div>
  79. <div class="col-md-6">
  80. <h4>相关问题</h4>
  81. <ul class="widget-links list-unstyled">
  82. @foreach($relatedQuestions as $relatedQuestion)
  83. @if($relatedQuestion->id != $article->id)
  84. <li class="widget-links-item">
  85. <a title="{{ $relatedQuestion->title }}" href="{{ route('ask.question.detail',['question_id'=>$relatedQuestion->id]) }}">{{ $relatedQuestion->title }}</a>
  86. <small class="text-muted">{{ $relatedQuestion->answers }} 回答</small>
  87. </li>
  88. @endif
  89. @endforeach
  90. </ul>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="widget-answers mt-15">
  95. <h2 class="h4 post-title">{{ $article->comments }} 条评论</h2>
  96. @include('theme::comment.collapse',['comment_source_type'=>'article','comment_source_id'=>$article->id,'hide_cancel'=>true])
  97. </div>
  98. </div>
  99. <div class="col-xs-12 col-md-3 side">
  100. <div class="widget-user">
  101. <div class="media">
  102. <a class="pull-left" href="{{ route('auth.space.index',['user_id'=>$article->user_id]) }}"><img class="media-object avatar-64" src="{{ $article->user->qrcode }}" alt="{{ $article->user->name }}"></a>
  103. <div class="media-body ">
  104. <a href="{{ route('auth.space.index',['user_id'=>$article->user_id]) }}" class="media-heading">{{ $article->user->name }}</a>
  105. @if($article->user->title)
  106. <p class="text-muted">{{ $article->user->title }}</p>
  107. @endif
  108. <p class="text-muted">{{ $article->user->userData->articles }} 篇文章</p>
  109. </div>
  110. </div>
  111. </div>
  112. <div class="widget-box mt-30">
  113. <h2 class="widget-box-title">
  114. 作家榜
  115. <a href="{{ route('auth.top.articles') }}" title="更多">»</a>
  116. </h2>
  117. <ol class="widget-top10">
  118. @foreach($topUsers as $index => $topUser)
  119. <li class="text-muted">
  120. <img class="avatar-32" src="{{ $topUser['qrcode'] }}">
  121. <a href="{{ route('auth.space.index',['user_id'=>$topUser['id']]) }}" class="ellipsis">{{ $topUser['name'] }}</a>
  122. <span class="text-muted pull-right">{{ $topUser['articles'] }} 文章</span>
  123. </li>
  124. @endforeach
  125. </ol>
  126. </div>
  127. </div>
  128. </div>
  129. @endsection
  130. @section('script')
  131. @include('theme::layout.report_modal')
  132. @include('theme::layout.qrcode_pament',['source_id'=>'article-'.$article->id,'paymentUser'=>$article->user,'message'=>'如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!'])
  133. <script type="text/javascript" src="{{ asset('/static/js/fancybox/jquery.fancybox.min.js') }}"></script>
  134. <script type="text/javascript">
  135. $(document).ready(function() {
  136. var article_id = "{{ $article->id }}";
  137. /*评论默认展开*/
  138. load_comments('article',article_id);
  139. $("#comments-article-"+article_id).collapse('show');
  140. /*评论提交*/
  141. $(".comment-btn").click(function(){
  142. var source_id = $(this).data('source_id');
  143. var source_type = $(this).data('source_type');
  144. var to_user_id = $(this).data('to_user_id');
  145. var token = $(this).data('token');
  146. var content = $("#comment-"+source_type+"-content-"+source_id).val();
  147. add_comment(token,source_type,source_id,content,to_user_id);
  148. $("#comment-content-"+source_id+"").val('');
  149. });
  150. /*文章推荐*/
  151. $("#support-button").click(function() {
  152. var btn_support = $(this);
  153. var source_type = btn_support.data('source_type');
  154. var source_id = btn_support.data('source_id');
  155. var support_num = parseInt(btn_support.data('support_num'));
  156. $.get('/support/' + source_type + '/' + source_id, function (msg) {
  157. if (msg == 'success') {
  158. support_num++
  159. }
  160. btn_support.html(support_num+' 已推荐');
  161. btn_support.data('support_num', support_num);
  162. });
  163. });
  164. /*收藏问题或文章*/
  165. $("#collect-button").click(function(){
  166. $("#collect-button").button('loading');
  167. var source_type = $(this).data('source_type');
  168. var source_id = $(this).data('source_id');
  169. $.get('/collect/'+source_type+'/'+source_id,function(msg){
  170. $("#collect-button").removeClass('disabled');
  171. $("#collect-button").removeAttr('disabled');
  172. if(msg=='collected'){
  173. $("#collect-button").html('已收藏');
  174. }else{
  175. $("#collect-button").html('收藏');
  176. }
  177. });
  178. });
  179. });
  180. </script>
  181. @endsection