index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <style type="text/css">
  2. .pagination{
  3. margin:0 !important;
  4. }
  5. </style>
  6. <div class="ibox float-e-margins">
  7. <div class="ibox-content">
  8. <form action="{{ route('admin.course.course.index') }}" method="get" class="form-horizontal">
  9. <div class="col-md-6">
  10. <a href="{{ route('admin.course.course.create') }}" method="POST" class="btn btn-primary margin-bottom" no-pjax>添加课程</a>
  11. </div>
  12. <div class="col-md-3">
  13. <select class="form-control" name="category">
  14. <option value="0">请选择课程分类</option>
  15. @foreach($categories as $value)
  16. <option @if(request('category') == $value->id) selected @endif value="{{$value->id}}"@if($value->parent_id ==0 )
  17. disabled="disabled" style="background: #a6e1ec" @endif>{{ $value->html }} @if($value->parent_id !=0 )
  18. ﹂@endif {{ $value->name }}</option>
  19. @endforeach
  20. </select>
  21. </div>
  22. <div class="col-md-3">
  23. <div class="form-group">
  24. <div class="input-group search_text">
  25. <input type="text" name="search" placeholder="课程名称" value="{{!empty(request('search'))?request('search'):''}}" class=" form-control"> <span class="input-group-btn"><button type="submit" class="btn btn-primary">查找</button></span>
  26. </div>
  27. </div>
  28. </div>
  29. </form>
  30. <table class="table table-hover table-bordered">
  31. <thead>
  32. <tr>
  33. <th>课程标题</th>
  34. <th>课程封面</th>
  35. <th>课程分类</th>
  36. <th>课程讲师</th>
  37. <th>课程价格</th>
  38. <th>观看等级</th>
  39. <th>播放量</th>
  40. <th>点赞数量</th>
  41. <th>收藏数量</th>
  42. <th>状态</th>
  43. <th>是否推荐</th>
  44. <th>是否热门</th>
  45. <th>是否精彩</th>
  46. <th>操作</th>
  47. </tr>
  48. </thead>
  49. @if(count($course)>0)
  50. <tbody>
  51. @foreach($course as $value)
  52. <tr>
  53. <td> {{$value->name}}</td>
  54. <td><img src="{{$value->cover }}" width="50"/></td>
  55. <td>{{$value->category}}</td>
  56. <td>{{$value->teacher}}</td>
  57. <td>{{$value->price}}</td>
  58. <td>{{$value->vip_level}}</td>
  59. <td>{{$value->watch_num}}</td>
  60. <td>{{$value->good_num}}</td>
  61. <td>{{$value->collection_num}}</td>
  62. <td><a class="shelves" cid="{{$value->id}}" is_shelves="{{$value->is_shelves}}">
  63. @if($value->is_shelves==1) 上架 @else 下架 @endif</a></td>
  64. <td><a class="recom" cid="{{$value->id}}" is_recom="{{$value->is_recom}}">
  65. <i class="fa @if($value->is_recom==1) fa-toggle-on @else fa-toggle-off @endif"></i></a></td>
  66. <td><a class="hot" cid="{{$value->id}}" is_hot="{{$value->is_hot}}">
  67. <i class="fa @if($value->is_hot==1) fa-toggle-on @else fa-toggle-off @endif"></i></a></td>
  68. <td><a class="wonderful" cid="{{$value->id}}" is_wonderful="{{$value->is_wonderful}}">
  69. <i class="fa @if($value->is_wonderful==1) fa-toggle-on @else fa-toggle-off @endif"></i></a></td>
  70. <td>
  71. <a class="btn btn-xs btn-primary" href="{{route('admin.course.course.edit',['id'=>$value->id])}}">
  72. <i data-toggle="tooltip" data-placement="top" class="fa fa-pencil-square-o" title="" data-original-title="编辑"></i></a>
  73. <a class="btn btn-xs btn-danger article-delete" data-url="{{ route('admin.course.course.delete', ['id'=>$value->id]) }}">
  74. <i data-toggle="tooltip" data-placement="top" class="fa fa-trash" title="删除"></i></a>
  75. <a class="btn btn-xs btn-primary" href="{{ route('admin.course.course.video', ['id'=>$value->id]) }}">
  76. {{-- <i data-toggle="tooltip" data-placement="top" class="fa fa-heart" title="测试"></i>--}}
  77. 章节管理</a>
  78. </td>
  79. </tr>
  80. @endforeach
  81. </tbody>
  82. <tfoot>
  83. <tr>
  84. <td colspan="15">
  85. <div class="pull-left">
  86. &nbsp;&nbsp;共&nbsp;{!! $course->total() !!} 条记录
  87. </div>
  88. <div class="pull-right">
  89. {!! $course->appends(request()->except('page'))->render() !!}
  90. </div>
  91. </td>
  92. </tr>
  93. </tfoot>
  94. @else
  95. <tfoot>
  96. <tr>
  97. <td colspan="10">
  98. 当前无数据
  99. </td>
  100. </tr>
  101. </tfoot>
  102. @endif
  103. </table>
  104. <div id="comment_modal" class="modal inmodal fade"></div>
  105. </div>
  106. </div>
  107. <script>
  108. $('.article-delete').on('click', function () {
  109. var thisPoint = $(this);
  110. var url = thisPoint.data('url');
  111. swal({
  112. title: "确认删除此项?",
  113. imageUrl: "/assets/backend/activity/backgroundImage/delete-xxl.png",
  114. showCancelButton: true,
  115. confirmButtonColor: "#DD6B55",
  116. confirmButtonText: "确认",
  117. cancelButtonText: "取消",
  118. closeOnConfirm: false,
  119. closeOnCancel: true
  120. },
  121. function (isConfirm) {
  122. if (isConfirm) {
  123. $.ajax({
  124. type: "GET",
  125. url: url,
  126. success: function (data) {
  127. if (data.status) {
  128. swal({
  129. title: "删除成功",
  130. text: "",
  131. type: "success"
  132. },
  133. function () {
  134. location.reload();
  135. });
  136. }
  137. }
  138. });
  139. } else {
  140. }
  141. });
  142. });
  143. $('.shelves').on('click', function () {
  144. var value = $(this).attr('is_shelves');
  145. var modelId = $(this).attr('cid');
  146. value = parseInt(value);
  147. modelId = parseInt(modelId);
  148. if (value == 1) {
  149. value = 0;
  150. } else {
  151. value = 1;
  152. }
  153. var that = $(this);
  154. $.post("{{route('admin.course.course.shelves')}}",
  155. {
  156. status: value,
  157. modelId: modelId
  158. },
  159. function (data, status) {
  160. console.log(data,status);
  161. if (status) {
  162. if (1 == value) {
  163. that.attr('is_shelves',1);
  164. that.html('上架');
  165. } else {
  166. that.attr('is_shelves',0);
  167. that.html('下架');
  168. }
  169. that.attr('value', value);
  170. }
  171. });
  172. });
  173. $('.recom').on('click', function () {
  174. var value = $(this).attr('is_recom');
  175. var modelId = $(this).attr('cid');
  176. value = parseInt(value);
  177. modelId = parseInt(modelId);
  178. if (value == 1) {
  179. value = 0;
  180. } else {
  181. value = 1;
  182. }
  183. var that = $(this);
  184. $.post("{{route('admin.course.course.recom')}}",
  185. {
  186. status: value,
  187. modelId: modelId
  188. },
  189. function (data, status) {
  190. console.log(data,status);
  191. if (status) {
  192. if (1 == value) {
  193. that.children().removeClass('fa-toggle-off');
  194. that.children().addClass('fa-toggle-on');
  195. that.attr('is_recom',1);
  196. } else {
  197. that.children().removeClass('fa-toggle-on');
  198. that.children().addClass('fa-toggle-off');
  199. that.attr('is_recom',0);
  200. }
  201. }
  202. });
  203. });
  204. $('.hot').on('click', function () {
  205. var value = $(this).attr('is_hot');
  206. var modelId = $(this).attr('cid');
  207. value = parseInt(value);
  208. modelId = parseInt(modelId);
  209. if (value == 1) {
  210. value = 0;
  211. } else {
  212. value = 1;
  213. }
  214. var that = $(this);
  215. $.post("{{route('admin.course.course.hot')}}",
  216. {
  217. status: value,
  218. modelId: modelId
  219. },
  220. function (data, status) {
  221. console.log(data,status);
  222. if (status) {
  223. if (1 == value) {
  224. that.children().removeClass('fa-toggle-off');
  225. that.children().addClass('fa-toggle-on');
  226. that.attr('is_hot',1);
  227. } else {
  228. that.children().removeClass('fa-toggle-on');
  229. that.children().addClass('fa-toggle-off');
  230. that.attr('is_hot',0);
  231. }
  232. }
  233. });
  234. });
  235. $('.wonderful').on('click', function () {
  236. var value = $(this).attr('is_wonderful');
  237. var modelId = $(this).attr('cid');
  238. value = parseInt(value);
  239. modelId = parseInt(modelId);
  240. if (value == 1) {
  241. value = 0;
  242. } else {
  243. value = 1;
  244. }
  245. var that = $(this);
  246. $.post("{{route('admin.course.course.wonderful')}}",
  247. {
  248. status: value,
  249. modelId: modelId
  250. },
  251. function (data, status) {
  252. console.log(data,status);
  253. if (status) {
  254. if (1 == value) {
  255. that.children().removeClass('fa-toggle-off');
  256. that.children().addClass('fa-toggle-on');
  257. that.attr('is_wonderful',1);
  258. } else {
  259. that.children().removeClass('fa-toggle-on');
  260. that.children().addClass('fa-toggle-off');
  261. that.attr('is_wonderful',0);
  262. }
  263. }
  264. });
  265. })
  266. </script>