调整模板
This commit is contained in:
@@ -11,21 +11,31 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* 显示分类
|
||||
*
|
||||
* @param Category $category [description]
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View [type] [description]
|
||||
*/
|
||||
public function index(Category $category)
|
||||
{
|
||||
if ($category->type == Category::TYPE_SHOW && $category->article_id) {
|
||||
return redirect("articles/" . $category->article_id);
|
||||
return redirect("articles/".$category->article_id);
|
||||
} elseif ($category->type == Category::TYPE_LINK && $category->url) {
|
||||
return redirect()->away($category->url);
|
||||
} else {
|
||||
$template = 'show';
|
||||
if ($category->template) {
|
||||
$template = $category->template;
|
||||
} else {
|
||||
if ($category->type == Category::TYPE_VIDEO) {
|
||||
$template = 'videos';
|
||||
}
|
||||
|
||||
if ($category->type == Category::TYPE_ADVERT) {
|
||||
$template = 'images';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$articles = $category->relations($category->type)
|
||||
->where('status', 1)
|
||||
->latest('sort')
|
||||
@@ -37,7 +47,7 @@ class CategoryController extends Controller
|
||||
$parent = $category->parent;
|
||||
}
|
||||
|
||||
return view('category.' . $template, compact('articles', 'category', 'parent'));
|
||||
return view('category.'.$template, compact('articles', 'category', 'parent'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
resources/views/category/images.blade.php
Normal file
54
resources/views/category/images.blade.php
Normal file
@@ -0,0 +1,54 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', $parent->title)
|
||||
|
||||
|
||||
@section('css')
|
||||
<link href="{{ asset('assets/index/css/video.css') }}" rel="stylesheet" type="text/css"/>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- 面包屑导航 -->
|
||||
@include('category.navigation')
|
||||
|
||||
<!-- 内容 -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<!-- 左侧导航部分 -->
|
||||
@include('category.left')
|
||||
<!-- 右侧内容部分 -->
|
||||
@if ($articles->isNotEmpty())
|
||||
<div class="col-xs-12 col-md-9">
|
||||
<div class="levelRight">
|
||||
<div class="row">
|
||||
@foreach ($articles as $article)
|
||||
<div class="col-lg-4">
|
||||
<div class="videoList">
|
||||
<div class="ce-img videoImg m-video">
|
||||
<span style="background-image: url({{ $article->cover_url }});"></span>
|
||||
</div>
|
||||
<div class="videoText">
|
||||
<p class="ce-nowrap-multi">{{ $article->title }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="pageUl">
|
||||
@if ($articles->isNotEmpty())
|
||||
{{ $articles->links('layouts.pagination') }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="col-md-12 col-xs-12">
|
||||
<div class="no-searchCont">
|
||||
<img src="/assets/index/images/org55.png"/>
|
||||
<span>抱歉,暂无内容</span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -25,8 +25,8 @@
|
||||
<div class="col-lg-4">
|
||||
<div class="videoList">
|
||||
<div class="ce-img videoImg m-video"
|
||||
data-src="{{ $article->cover_url }}">
|
||||
<span style="background-image: url(/assets/index/images/index-news.png);"></span>
|
||||
data-src="{{ $article->link_url }}">
|
||||
<span style="background-image: url({{ $article->cover_url }});"></span>
|
||||
<img class="videoImg-icon"
|
||||
src="/assets/index/images/srIcon/srSpread_icon_list.png"/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user