diff --git a/app/Helpers/function.php b/app/Helpers/function.php index 51e245e..4ac9f80 100644 --- a/app/Helpers/function.php +++ b/app/Helpers/function.php @@ -21,6 +21,7 @@ function getOneCategory($categoryId, $return = '') /** * Notes: 获取文章分类详情 + * * @Author: 玄尘 * @Date : 2020/9/10 13:21 * @param $categoryId @@ -30,8 +31,8 @@ function getOneCategory($categoryId, $return = '') function getOneArticleBYCate($categoryId, $result = '') { $info = Article::where('status', 1) - ->ByCategory($categoryId) - ->latest('sort')->latest()->first(); + ->ByCategory($categoryId) + ->latest('sort')->latest()->first(); if ($info) { if ($result) { @@ -48,11 +49,12 @@ function getOneArticleBYCate($categoryId, $result = '') /** * Notes: 获取分类下的文章 + * * @Author: 玄尘 * @Date : 2020/9/10 10:05 * @param $categoryId - * @param int $take - * @param int $recommen + * @param int $take + * @param int $recommen * @return \App\Models\Article */ function getArticlesBYCate($categoryId, $take = 8, $recommen = 0) @@ -61,14 +63,14 @@ function getArticlesBYCate($categoryId, $take = 8, $recommen = 0) $ids = $cate ? $cate->getAllChildrenId() : []; $articles = Article::where('status', 1) - ->ByCategory([$categoryId]) - ->latest('sort') - ->latest() - ->when($recommen, function ($q) use ($recommen) { - $q->where('recommen', 1); - }) - ->take($take) - ->get(); + ->ByCategory([$categoryId]) + ->latest('sort') + ->latest() + ->when($recommen, function ($q) use ($recommen) { + $q->where('recommen', 1); + }) + ->take($take) + ->get(); return $articles; } @@ -77,12 +79,12 @@ function getArticlesBYCate($categoryId, $take = 8, $recommen = 0) function getCateChild($categoryId, $take = '') { return Category::where('status', 1) - ->where('parent_id', $categoryId) - ->orderBy('order', 'desc') - ->when($take, function ($q) use ($take) { - $q->take($take); - }) - ->get(); + ->where('parent_id', $categoryId) + ->orderBy('order', 'desc') + ->when($take, function ($q) use ($take) { + $q->take($take); + }) + ->get(); } //获取顶级分类 @@ -99,6 +101,7 @@ function getTopCate($categoryId) /** * Notes: 根据分类获取一张图片 + * * @Author: 玄尘 * @Date : 2021/10/8 13:53 * @param $categoryId @@ -108,9 +111,9 @@ function getTopCate($categoryId) function getOneAdvertByCate($categoryId, $result = '') { $info = Advert::where('category_id', $categoryId) - ->latest('sort') - ->latest() - ->first(); + ->latest('sort') + ->latest() + ->first(); if ($info) { if ($result) { @@ -123,19 +126,35 @@ function getOneAdvertByCate($categoryId, $result = '') } } +/** + * Notes: 获取图片 + * + * @Author: 玄尘 + * @Date: 2021/11/29 10:05 + * @param $categoryId + * @param string $take + * @return mixed + */ function getAdvertsByCate($categoryId, $take = '8') { return Advert::where('category_id', $categoryId) - ->latest() - ->take($take) - ->get(); + ->latest() + ->take($take) + ->get(); } -function getVideoByCate($categoryId, $result = '') +/** + * Notes: 根据分类获取视频 + * + * @Author: 玄尘 + * @Date: 2021/11/29 10:05 + * @param $categoryId + * @param string $result + * @return string + */ +function getVideoByCate($categoryId, string $result = '') { - $video = Video::where('category_id', $categoryId) - ->latest() - ->first(); + $video = Video::where('category_id', $categoryId)->latest()->first(); if ($video) { if ($result) { @@ -148,12 +167,21 @@ function getVideoByCate($categoryId, $result = '') } } +/** + * Notes: 获取视频列表 + * + * @Author: 玄尘 + * @Date: 2021/11/29 10:21 + * @param $categoryId + * @param string $take + * @return mixed + */ function getVideosByCate($categoryId, $take = '8') { return Video::where('category_id', $categoryId) - ->latest() - ->take($take) - ->get(); + ->latest() + ->take($take) + ->get(); } function dateLocalMonth($m): string diff --git a/config/template.php b/config/template.php new file mode 100644 index 0000000..4075cfd --- /dev/null +++ b/config/template.php @@ -0,0 +1,23 @@ + '分类模板', + + /** + * 分类所有模板 + */ + 'lists' => [ + 'djwh' => '党建文化', + 'images' => '图片', + 'jianjie' => '简介', + 'kjpt' => '科技平台', + 'kxjs' => '学科建设与人才队伍', + 'kxyj' => '科学研究', + 'personnel' => '人员列表', + 'photos' => 'XXXXXX', + 'sqhg' => '所庆回顾', + 'videos' => '媒体宣传视频', + 'xh_qk' => '学会与期刊', + 'yjsjy' => '研究生教育', + ], +]; \ No newline at end of file diff --git a/resources/views/category/jqhg.blade.php b/resources/views/category/jqhg.blade.php deleted file mode 100644 index f6a657f..0000000 --- a/resources/views/category/jqhg.blade.php +++ /dev/null @@ -1,20 +0,0 @@ -@extends('layouts.app') - -@section('title', $parent->title) - -@section('content') - - @include('category.navigation') - - -
-
- - @include('category.left') - -
-
-
-
-@endsection - diff --git a/resources/views/category/kxjs_rcdw.blade.php b/resources/views/category/kxjs_rcdw.blade.php index f18a184..69b0c75 100644 --- a/resources/views/category/kxjs_rcdw.blade.php +++ b/resources/views/category/kxjs_rcdw.blade.php @@ -22,7 +22,7 @@
@if (getArticlesBYCate(31,3)->isNotEmpty()) - @foreach (getArticlesBYCate(31,1) as $info) + @foreach (getArticlesBYCate(31,3) as $info)
{{ $info->title }}
@@ -43,51 +43,29 @@ {{ getOneCategory(32,'title') }}
-
    - @if(getCateChild(32)->isNotEmpty()) - @foreach(getCateChild(32) as $cate) -
  • iteration==1) class="active" @endif > - - {{ $cate->title }} - -
  • - @endforeach - @endif -
-
- + - @if(getCateChild(32)->isNotEmpty()) - @foreach(getCateChild(32) as $cate) -
-
- @if (getArticlesBYCate($cate->id,3)->isNotEmpty()) - @foreach (getArticlesBYCate($cate->id,3) as $info) -
-
-
- {{ $info->title }} -
-
- - -
-
+ @if(getCateChild(32)->isNotEmpty()) + @foreach(getCateChild(32) as $cate) +
+ @if (getArticlesBYCate($cate->id,3)->isNotEmpty()) + @foreach (getArticlesBYCate($cate->id,3) as $info) +
+
+
+ {{ $info->title }}
- @endforeach - @endif -
-
- @endforeach - @endif -
+
+ + +
+
+
+ @endforeach + @endif +
+ @endforeach + @endif
@@ -122,13 +100,13 @@ {{ getOneCategory(43,'title') }}
-
查看更多>>
+
@if (getArticlesBYCate(43,6)->isNotEmpty()) - @foreach (getArticlesBYCate(43,6) as $info) + @foreach (getArticlesBYCate(43,20) as $info)
diff --git a/resources/views/category/kxyj.blade.php b/resources/views/category/kxyj.blade.php index e9db791..253d609 100644 --- a/resources/views/category/kxyj.blade.php +++ b/resources/views/category/kxyj.blade.php @@ -43,12 +43,12 @@
{{ $info->title }}
- +
-->
- + {{ $info->created_at->format('Y年m月d') }}
@@ -61,78 +61,125 @@ -
-
-
- - {{ getOneCategory(26,'title') }} -
-
- -
-
-
-
- - -
-
-
-
概况
-
- {{ getOneCategory(26,'description') }} -
-
- 了解更多 -
+
+
+
+ + {{ getOneCategory(26,'title') }}
-
- - -
-
动态
-
-
- @if (getArticlesBYCate(26,1)->isNotEmpty()) - @foreach (getArticlesBYCate(26,1) as $info) - @if($loop->iteration==1) -
-
- - -
-
- {{ $info->title }} -
-
- {{ $info->description }} -
-
+ +
+
+
+
+ + +
+
+
+
概况
+ +
    + @if (getArticlesBYCate(26,8)->isNotEmpty()) + @foreach (getArticlesBYCate(26,8) as $info) + @if($loop->iteration>1) +
  • +
    +
    +
    + {{ $info->title }} +
    +
    +
    + {{ $info->created_at->format('Y-m-d')}} +
    +
    +
  • + @endif + @endforeach @endif - @endforeach - @endif - +
+
-
-
    - @if (getArticlesBYCate(26,8)->isNotEmpty()) - @foreach (getArticlesBYCate(26,8) as $info) - @if($loop->iteration>1) -
  • -
    {{ $info->title }}
    -
    {{ $info->created_at->format('Y-m-d')}}
    -
  • +
+ + +
+ +
+
+ @if (getArticlesBYCate(26,1)->isNotEmpty()) + @foreach (getArticlesBYCate(26,1) as $info) + @if($loop->iteration==1) +
+
+ + +
+ +
@endif @endforeach @endif - + +
+
+
动态
+
    +
  • +
    +
    +
    + 黑龙江省科学院自然与生态研究所科技特派员组织开展乡村振兴对接服务 +
    +
    +
    + 2021年11月02 +
    +
    +
  • +
  • +
    +
    +
    + 黑龙江省科学院自然与生态研究所科技特派员组织开展乡村振兴对接服务 +
    +
    +
    + 2021年11月02 +
    +
    +
  • +
  • +
    +
    +
    + 黑龙江省科学院自然与生态研究所科技特派员组织开展乡村振兴对接服务 +
    +
    +
    + 2021年11月02 +
    +
    +
  • +
+
-
- +
@@ -144,89 +191,57 @@
- - @if (getArticlesBYCate(18,10)->isNotEmpty()) - @foreach (getArticlesBYCate(18,10)->chunk(5) as $articles) -
-
- @foreach($articles as $article) - @if($loop->iteration==1) -
-
-
- -
- {{ $article->title }} -
-
- {{ $article->description }} -
-
-
-
- @endif - @if($loop->iteration==2) -
-
- @endif - - @if($loop->iteration>1) -
-
- -
-
- {{ $article->title }} -
-
- {{ $article->description }} -
-
-
-
- @endif - - @if($loop->last) -
-
- @endif - @endforeach +
+ @if (getArticlesBYCate(18,10)->isNotEmpty()) + @foreach (getArticlesBYCate(18,10) as $article) +
+
+
+ +
+
+ {{ $article->title }} +
+
-
- @endforeach - @endif -
- - -
- + @endforeach + @endif +
+ +
+
+
+ + {{ getOneCategory(27,'title') }} +
+
+ 查看更多  > +
+
+
+ @if (getArticlesBYCate(27,4)->isNotEmpty()) + @foreach (getArticlesBYCate(27,4) as $info) +
+
+ +
+
{{ $info->title }}
+
{{ $info->created_at->format('Y-m-d') }}
+
+
+
+ @endforeach + @endif +
+
+ +
@@ -258,37 +273,6 @@
- -
-
-
- - {{ getOneCategory(27,'title') }} -
-
- 查看更多  > -
-
-
- @if (getArticlesBYCate(27,4)->isNotEmpty()) - @foreach (getArticlesBYCate(27,4) as $info) -
-
-
- -
-
-
{{ $info->title }}
-
{{ $info->created_at->format('Y-m-d') }}
-
-
-
- @endforeach - @endif -
-
- -
@@ -300,7 +284,7 @@
-
+
@@ -310,48 +294,107 @@
-
- @if(getVideoByCate(29)) - - {{-- --}} - @endif +
+
+ @if(getVideoByCate(29)) + + {{-- --}} + @endif +
+
+ {{ getVideoByCate(29,'title') }} +
-
- {{ getVideoByCate(29,'title') }} +
+
    + @if(getVideosByCate(29,8)) + @foreach(getVideosByCate(29,8) as $video) + @if($loop->iteration>1) +
  • +
    +
    +
    + {{ $video->title }} +
    +
    +
    + {{ $video->format('Y年m月d日') }} +
    +
    +
  • + @endif + @endforeach + @endif +
-
+
-
- {{ getOneCategory(30,'title') }} +
{{ getOneCategory(30,'title') }}
+
+ 查看更多>> +
-
    +
    + @if (getArticlesBYCate(30,2)->isNotEmpty()) +
    + +
    + @endif @if (getArticlesBYCate(30,2)->isNotEmpty()) - @foreach (getArticlesBYCate(30,2) as $info) -
  • -
    - - -
    -
    {{ $info->title }}
    -
  • - @endforeach +
      + @foreach (getArticlesBYCate(30,2) as $info) +
    • +
      +
      +
      + {{ $info->title }} +
      +
      +
      + {{ $info->format('Y年m月d日') }} +
      +
      +
    • + @endforeach +
    @endif -
-
- 查看更多> + +
+ {{--
--}} + {{--
--}} + {{-- {{ getOneCategory(30,'title') }}--}} + {{--
--}} + {{--
    --}} + {{-- @if (getArticlesBYCate(30,2)->isNotEmpty())--}} + {{-- @foreach (getArticlesBYCate(30,2) as $info)--}} + {{--
  • --}} + {{--
    --}} + {{-- --}} + {{--
    --}} + {{--
    {{ $info->title }}
    --}} + {{--
  • --}} + {{-- @endforeach--}} + {{-- @endif--}} + {{--
--}} + {{--
--}} + {{-- 查看更多>--}} + {{--
--}} + {{--
--}}
diff --git a/resources/views/category/videos.blade.php-- b/resources/views/category/videos.blade.php-- deleted file mode 100644 index 9970496..0000000 --- a/resources/views/category/videos.blade.php-- +++ /dev/null @@ -1,60 +0,0 @@ -@extends('layouts.app') - -@section('title', $parent->title) - - -@section('css') - -@endsection - -@section('content') - - @include('category.navigation') - - -
-
- - @include('category.left') - - @if ($articles->isNotEmpty()) -
-
-
- @foreach ($articles as $article) -
-
-
- - -
-
-

{{ $article->title }}

-
-
-
- @endforeach -
-
-
- @if ($articles->isNotEmpty()) - {{ $articles->links('layouts.pagination') }} - @endif -
-
- @else -
-
- - 抱歉,暂无内容 -
-
- @endif -
-
-@endsection -@push('script') - -@endpush diff --git a/resources/views/category/yh_qk.blade.php b/resources/views/category/yh_qk.blade.php deleted file mode 100644 index ec75a20..0000000 --- a/resources/views/category/yh_qk.blade.php +++ /dev/null @@ -1,84 +0,0 @@ -@extends('layouts.app') - -@section('title', $parent->title) - -@section('content') - - @include('category.navigation') - - -
-
- - @include('category.left') - -
-
- -
-
- 学会LEARN -
-
-
-
-
- -
-
-
-
-
-
党建文化-学会简介
-
- 近年来,中国银行西安长安路支行结合陕西红色文化特点和本行实际,坚持党建引领,文化铸魂,提倡“幸福中行,快乐员工”的文化理念,以加快转型发展,打造区域强行为突破口,形成了具有自身特色的企业文化,并将其渗透和服务于经营管理的全过程,实现了文化创造价值,党建与经营双丰收的目标。 -
-
查看详情
-
- -
-
-
-
-
- - - -
-
- 期刊PERIODICAL -
-
- -
-
-
-
-
党建文化-期刊
-
-
查看更多 -
-
征稿启事 -
-
-
-
-
- -
- 近年来,中国银行西安长安路支行结合陕西红色文化特点和本行实际,坚持党建引领,文化铸魂,提倡“幸福中行,快乐员工”的文化理念,以加快转型发展,打造区域强行为突破口,形成了具有自身特色的企业文化,并将其渗透和服务于经营管理的全过程,实现了文化创造价值,党建与经营双丰收的目标。 -
-
-
-
-
-
- -
-
-
-
-@endsection -