index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. @extends('theme::layout.public')
  2. @section('seo_title')搜索 - 第{{ $list->currentPage() }}页 - {{ Setting()->get('website_name') }}@endsection
  3. @section('content')
  4. @if(Setting()->get("xunsearch_open",0))
  5. <div class="container mt-20">
  6. <div class="row">
  7. <div class="container">
  8. <ul class="search-category nav nav-pills">
  9. <li @if($filter==='all') class="active" @endif ><a href="{{ route('auth.search.index') }}?word={{ $word }}">全部</a></li>
  10. <li @if($filter==='questions') class="active" @endif ><a href="{{ route('auth.search.index',['filter'=>'questions']) }}?word={{ $word }}">问答</a></li>
  11. <li @if($filter==='articles') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'articles']) }}?word={{ $word }}">文章</a></li>
  12. <li @if($filter==='courses') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'courses']) }}?word={{ $word }}">讲堂</a></li>
  13. <li @if($filter==='tags') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'tags']) }}?word={{ $word }}">话题</a></li>
  14. <li @if($filter==='users') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'users']) }}?word={{ $word }}">用户</a></li>
  15. </ul>
  16. <form action="{{ route('auth.search.index',['filter'=>$filter]) }}" class="row" method="GET">
  17. <div class="col-md-9">
  18. <input class="input-lg form-control" type="text" name="word" value="{{ $word }}" placeholder="输入关键字搜索">
  19. </div>
  20. <div class="col-md-2">
  21. <button type="submit" class="btn btn-primary btn-lg btn-block search-btn">搜索</button>
  22. </div>
  23. </form>
  24. </div>
  25. </div>
  26. <div class="row">
  27. <div class="col-md-9 main search-result">
  28. <h3 class="h5">找到约 <strong>{{ $list->count() }}</strong> 条结果</h3>
  29. @foreach( $list as $item )
  30. @if( $item['class_uid'] === 'a071d30e96787d46b4e6e5191b452c1d' )
  31. <section class="widget-item">
  32. <h2 class="h4">
  33. @if( $item['status'] == 2 )
  34. <span class="label label-success pull-left mr-5">问题</span>
  35. @else
  36. <span class="label label-warning pull-left mr-5">问题</span>
  37. @endif
  38. <a href="{{ route('ask.question.detail',['question_id'=>$item['id']]) }}" target="_blank">{!! $item['subject'] !!}</a>
  39. </h2>
  40. <p class="excerpt">{!! $item['content'] !!}</p>
  41. </section>
  42. @elseif( $item['class_uid'] === 'db04ed18cd04b43c64ab9d592dbebc40' )
  43. <section class="widget-item">
  44. <h2 class="h4">
  45. <span class="label label-success pull-left mr-5">文章</span>
  46. <a href="{{ route('blog.article.detail',['article_id'=>$item['id']]) }}" target="_blank">{!! $item['subject'] !!}</a>
  47. </h2>
  48. <p class="excerpt">{!! $item['content'] !!}</p>
  49. </section>
  50. @elseif( $item['class_uid'] === '7c4b2df66ec878ccfab0c03ed7f61989' )
  51. <section class="widget-item">
  52. <h2 class="h4">
  53. <span class="label label-success pull-left mr-5">用户</span>
  54. <a href="{{ route('auth.space.index',['user_id'=>$item['id']]) }}" target="_blank">{!! $item['subject'] !!}</a>
  55. </h2>
  56. <p class="excerpt">{!! $item['content'] !!}</p>
  57. </section>
  58. @elseif( $item['class_uid'] === '7118e6ddaa8fea122e7df7a9b79fc104' )
  59. <section class="widget-item">
  60. <h2 class="h4">
  61. <span class="label label-default pull-left mr-5">话题</span>
  62. <a href="{{ route('ask.tag.index',['id'=>$item['id']]) }}" target="_blank">{!! $item['subject'] !!}</a>
  63. </h2>
  64. <p class="excerpt">{!! $item['content'] !!}</p>
  65. </section>
  66. @elseif( $item['class_uid'] === '0cbb2dbe0943b26c88809cee41ce8e8c' )
  67. <section class="widget-item">
  68. <h2 class="h4">
  69. <span class="label label-success pull-left mr-5">讲堂</span>
  70. <a href="{{ route('live.course.show',['id'=>$item['id']]) }}" target="_blank">{!! $item['subject'] !!}</a>
  71. </h2>
  72. <p class="excerpt">{!! $item['content'] !!}</p>
  73. </section>
  74. @endif
  75. @endforeach
  76. <div class="text-center">
  77. {!! str_replace('/?', '?', $list->render()) !!}
  78. </div>
  79. </div>
  80. <div class="col-md-3 side"></div>
  81. </div>
  82. </div>
  83. @else
  84. <div class="container mt-20">
  85. <div class="row">
  86. <div class="container">
  87. <ul class="search-category nav nav-pills">
  88. <li @if($filter==='questions') class="active" @endif ><a href="{{ route('auth.search.index',['filter'=>'questions']) }}?word={{ $word }}">问答</a></li>
  89. <li @if($filter==='articles') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'articles']) }}?word={{ $word }}">文章</a></li>
  90. <li @if($filter==='courses') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'courses']) }}?word={{ $word }}">讲堂</a></li>
  91. <li @if($filter==='tags') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'tags']) }}?word={{ $word }}">话题</a></li>
  92. <li @if($filter==='users') class="active" @endif><a href="{{ route('auth.search.index',['filter'=>'users']) }}?word={{ $word }}">用户</a></li>
  93. </ul>
  94. <form action="{{ route('auth.search.index') }}" class="row" method="GET">
  95. <div class="col-md-9">
  96. <input class="input-lg form-control" type="text" name="word" value="{{ $word }}" placeholder="输入关键字搜索">
  97. </div>
  98. <div class="col-md-2">
  99. <button type="submit" class="btn btn-primary btn-lg btn-block search-btn">搜索</button>
  100. </div>
  101. </form>
  102. </div>
  103. </div>
  104. <div class="row">
  105. <div class="col-md-9 main search-result">
  106. <h3 class="h5 mt0">找到约 <strong>{{ $list->count() }}</strong> 条结果</h3>
  107. @if($filter==='questions')
  108. @foreach($list as $question)
  109. <section class="widget-question">
  110. <h2 class="h4">
  111. @if($question->status==2)
  112. <span class="label label-success pull-left mr-5">解决</span>
  113. @endif
  114. <a href="{{ route('ask.question.detail',['question_id'=>$question->id]) }}" target="_blank">{!! $question->title !!}</a>
  115. </h2>
  116. <p class="excerpt">{!! str_limit(strip_tags($question->description,"<em>"),200) !!} </p>
  117. </section>
  118. @endforeach
  119. @elseif($filter==='articles')
  120. @foreach($list as $article)
  121. <section class="widget-blog">
  122. <h2 class="h4">
  123. <a href="{{ route('blog.article.detail',['article_id'=>$article->id]) }}" target="_blank">{{ $article->title }}</a>
  124. </h2>
  125. <p class="excerpt">{{ str_limit(strip_tags($article->summary),200) }}</p>
  126. </section>
  127. @endforeach
  128. @elseif($filter==='users')
  129. @foreach($list as $user)
  130. <section class="widget-member">
  131. <h2 class="h4">
  132. <a href="{{ route('auth.space.index',['user_id'=>$user->id]) }}" target="_blank">{{ $user->name }}</a>
  133. @if($user->title) <span class="text-muted"> - {{ $user->title }}</span> @endif
  134. </h2>
  135. <p class="excerpt">{{ str_limit(strip_tags($user->description),200) }}</p>
  136. </section>
  137. @endforeach
  138. @elseif($filter==='tags')
  139. @foreach($list as $tag)
  140. <section class="widget-tag">
  141. <h2 class="h4">
  142. <a href="{{ route('ask.tag.index',['id'=>$tag->id]) }}" target="_blank">{{ $tag->name }}</a>
  143. </h2>
  144. <p class="excerpt">{{ str_limit(strip_tags($tag->description),200) }}</p>
  145. </section>
  146. @endforeach
  147. @elseif($filter==='courses')
  148. @foreach($list as $course)
  149. <section class="widget-tag">
  150. <h2 class="h4">
  151. <a href="{{ route('live.course.show',['id'=>$course->id]) }}" target="_blank">{{ $course->title }}</a>
  152. </h2>
  153. <p class="excerpt">{{ str_limit(strip_tags($course->description),200) }}</p>
  154. </section>
  155. @endforeach
  156. @endif
  157. <div class="text-center">
  158. {!! str_replace('/?', '?', $list->appends(['word'=>$word])->links()) !!}
  159. </div>
  160. </div>
  161. <div class="col-md-3 side">
  162. <ul class="list-unstyled">
  163. </ul>
  164. </div>
  165. </div>
  166. </div>
  167. @endif
  168. @endsection