123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <style type="text/css">
- .pagination{
- margin:0 !important;
- }
- </style>
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <form action="{{ route('admin.course.course.index') }}" method="get" class="form-horizontal">
- <div class="col-md-6">
- <a href="{{ route('admin.course.course.create') }}" method="POST" class="btn btn-primary margin-bottom" no-pjax>添加课程</a>
- </div>
- <div class="col-md-3">
- <select class="form-control" name="category">
- <option value="0">请选择课程分类</option>
- @foreach($categories as $value)
- <option @if(request('category') == $value->id) selected @endif value="{{$value->id}}"@if($value->parent_id ==0 )
- disabled="disabled" style="background: #a6e1ec" @endif>{{ $value->html }} @if($value->parent_id !=0 )
- ﹂@endif {{ $value->name }}</option>
- @endforeach
- </select>
- </div>
- <div class="col-md-3">
- <div class="form-group">
- <div class="input-group search_text">
- <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>
- </div>
- </div>
- </div>
- </form>
- <table class="table table-hover table-bordered">
- <thead>
- <tr>
- <th>课程标题</th>
- <th>课程封面</th>
- <th>课程分类</th>
- <th>课程讲师</th>
- <th>课程价格</th>
- <th>观看等级</th>
- <th>播放量</th>
- <th>点赞数量</th>
- <th>收藏数量</th>
- <th>状态</th>
- <th>是否推荐</th>
- <th>是否热门</th>
- <th>是否精彩</th>
- <th>操作</th>
- </tr>
- </thead>
- @if(count($course)>0)
- <tbody>
- @foreach($course as $value)
- <tr>
- <td> {{$value->name}}</td>
- <td><img src="{{$value->cover }}" width="50"/></td>
- <td>{{$value->category}}</td>
- <td>{{$value->teacher}}</td>
- <td>{{$value->price}}</td>
- <td>{{$value->vip_level}}</td>
- <td>{{$value->watch_num}}</td>
- <td>{{$value->good_num}}</td>
- <td>{{$value->collection_num}}</td>
- <td><a class="shelves" cid="{{$value->id}}" is_shelves="{{$value->is_shelves}}">
- @if($value->is_shelves==1) 上架 @else 下架 @endif</a></td>
- <td><a class="recom" cid="{{$value->id}}" is_recom="{{$value->is_recom}}">
- <i class="fa @if($value->is_recom==1) fa-toggle-on @else fa-toggle-off @endif"></i></a></td>
- <td><a class="hot" cid="{{$value->id}}" is_hot="{{$value->is_hot}}">
- <i class="fa @if($value->is_hot==1) fa-toggle-on @else fa-toggle-off @endif"></i></a></td>
- <td><a class="wonderful" cid="{{$value->id}}" is_wonderful="{{$value->is_wonderful}}">
- <i class="fa @if($value->is_wonderful==1) fa-toggle-on @else fa-toggle-off @endif"></i></a></td>
- <td>
- <a class="btn btn-xs btn-primary" href="{{route('admin.course.course.edit',['id'=>$value->id])}}">
- <i data-toggle="tooltip" data-placement="top" class="fa fa-pencil-square-o" title="" data-original-title="编辑"></i></a>
- <a class="btn btn-xs btn-danger article-delete" data-url="{{ route('admin.course.course.delete', ['id'=>$value->id]) }}">
- <i data-toggle="tooltip" data-placement="top" class="fa fa-trash" title="删除"></i></a>
- <a class="btn btn-xs btn-primary" href="{{ route('admin.course.course.video', ['id'=>$value->id]) }}">
- {{-- <i data-toggle="tooltip" data-placement="top" class="fa fa-heart" title="测试"></i>--}}
- 章节管理</a>
- </td>
- </tr>
- @endforeach
- </tbody>
- <tfoot>
- <tr>
- <td colspan="15">
- <div class="pull-left">
- 共 {!! $course->total() !!} 条记录
- </div>
- <div class="pull-right">
- {!! $course->appends(request()->except('page'))->render() !!}
- </div>
- </td>
- </tr>
- </tfoot>
- @else
- <tfoot>
- <tr>
- <td colspan="10">
- 当前无数据
- </td>
- </tr>
- </tfoot>
- @endif
- </table>
- <div id="comment_modal" class="modal inmodal fade"></div>
- </div>
- </div>
- <script>
- $('.article-delete').on('click', function () {
- var thisPoint = $(this);
- var url = thisPoint.data('url');
- swal({
- title: "确认删除此项?",
- imageUrl: "/assets/backend/activity/backgroundImage/delete-xxl.png",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确认",
- cancelButtonText: "取消",
- closeOnConfirm: false,
- closeOnCancel: true
- },
- function (isConfirm) {
- if (isConfirm) {
- $.ajax({
- type: "GET",
- url: url,
- success: function (data) {
- if (data.status) {
- swal({
- title: "删除成功",
- text: "",
- type: "success"
- },
- function () {
- location.reload();
- });
- }
- }
- });
- } else {
- }
- });
- });
- $('.shelves').on('click', function () {
- var value = $(this).attr('is_shelves');
- var modelId = $(this).attr('cid');
- value = parseInt(value);
- modelId = parseInt(modelId);
- if (value == 1) {
- value = 0;
- } else {
- value = 1;
- }
- var that = $(this);
- $.post("{{route('admin.course.course.shelves')}}",
- {
- status: value,
- modelId: modelId
- },
- function (data, status) {
- console.log(data,status);
- if (status) {
- if (1 == value) {
- that.attr('is_shelves',1);
- that.html('上架');
- } else {
- that.attr('is_shelves',0);
- that.html('下架');
- }
- that.attr('value', value);
- }
- });
- });
- $('.recom').on('click', function () {
- var value = $(this).attr('is_recom');
- var modelId = $(this).attr('cid');
- value = parseInt(value);
- modelId = parseInt(modelId);
- if (value == 1) {
- value = 0;
- } else {
- value = 1;
- }
- var that = $(this);
- $.post("{{route('admin.course.course.recom')}}",
- {
- status: value,
- modelId: modelId
- },
- function (data, status) {
- console.log(data,status);
- if (status) {
- if (1 == value) {
- that.children().removeClass('fa-toggle-off');
- that.children().addClass('fa-toggle-on');
- that.attr('is_recom',1);
- } else {
- that.children().removeClass('fa-toggle-on');
- that.children().addClass('fa-toggle-off');
- that.attr('is_recom',0);
- }
- }
- });
- });
- $('.hot').on('click', function () {
- var value = $(this).attr('is_hot');
- var modelId = $(this).attr('cid');
- value = parseInt(value);
- modelId = parseInt(modelId);
- if (value == 1) {
- value = 0;
- } else {
- value = 1;
- }
- var that = $(this);
- $.post("{{route('admin.course.course.hot')}}",
- {
- status: value,
- modelId: modelId
- },
- function (data, status) {
- console.log(data,status);
- if (status) {
- if (1 == value) {
- that.children().removeClass('fa-toggle-off');
- that.children().addClass('fa-toggle-on');
- that.attr('is_hot',1);
- } else {
- that.children().removeClass('fa-toggle-on');
- that.children().addClass('fa-toggle-off');
- that.attr('is_hot',0);
- }
- }
- });
- });
- $('.wonderful').on('click', function () {
- var value = $(this).attr('is_wonderful');
- var modelId = $(this).attr('cid');
- value = parseInt(value);
- modelId = parseInt(modelId);
- if (value == 1) {
- value = 0;
- } else {
- value = 1;
- }
- var that = $(this);
- $.post("{{route('admin.course.course.wonderful')}}",
- {
- status: value,
- modelId: modelId
- },
- function (data, status) {
- console.log(data,status);
- if (status) {
- if (1 == value) {
- that.children().removeClass('fa-toggle-off');
- that.children().addClass('fa-toggle-on');
- that.attr('is_wonderful',1);
- } else {
- that.children().removeClass('fa-toggle-on');
- that.children().addClass('fa-toggle-off');
- that.attr('is_wonderful',0);
- }
- }
- });
- })
- </script>
|