修改大庆分院
This commit is contained in:
@@ -1,126 +1,126 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Advert;
|
use App\Models\Advert;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\Article;
|
use App\Models\Article;
|
||||||
|
|
||||||
function getOneCategory($categoryId, $return = '')
|
function getOneCategory($categoryId, $return = '')
|
||||||
{
|
{
|
||||||
$category = Category::find($categoryId);
|
$category = Category::find($categoryId);
|
||||||
if ($category) {
|
if ($category) {
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $category->{$return};
|
return $category->{$return};
|
||||||
}
|
}
|
||||||
|
|
||||||
return $category;
|
return $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Category;
|
return new Category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 获取文章分类详情
|
* Notes: 获取文章分类详情
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/9/10 13:21
|
* @Date : 2020/9/10 13:21
|
||||||
* @param $categoryId
|
* @param $categoryId
|
||||||
* @param string $result
|
* @param string $result
|
||||||
* @return \App\Models\Article
|
* @return \App\Models\Article
|
||||||
*/
|
*/
|
||||||
function getOneArticleBYCate($categoryId, $result = '')
|
function getOneArticleBYCate($categoryId, $result = '')
|
||||||
{
|
{
|
||||||
$info = Article::where('category_id', $categoryId)->latest('sort')->latest()->first();
|
$info = Article::where('category_id', $categoryId)->latest('sort')->latest()->first();
|
||||||
|
|
||||||
if ($info) {
|
if ($info) {
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return $info->{$result};
|
return $info->{$result};
|
||||||
}
|
}
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Article;
|
return new Article;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 获取分类下的文章
|
* Notes: 获取分类下的文章
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/9/10 10:05
|
* @Date : 2020/9/10 10:05
|
||||||
* @param $categoryId
|
* @param $categoryId
|
||||||
* @param $take
|
* @param $take
|
||||||
* @return \App\Models\Article
|
* @return \App\Models\Article
|
||||||
*/
|
*/
|
||||||
function getArticlesBYCate($categoryId, $take = 8, $mark = 'one')
|
function getArticlesBYCate($categoryId, $take = 8, $mark = 'one')
|
||||||
{
|
{
|
||||||
if ($mark == 'one') {
|
if ($mark == 'one') {
|
||||||
$articles = Article::where('category_id', $categoryId)
|
$articles = Article::where('category_id', $categoryId)
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->latest('sort')
|
->latest('sort')
|
||||||
->latest()
|
->latest()
|
||||||
->take($take)
|
->take($take)
|
||||||
->get();
|
->get();
|
||||||
} else {
|
} else {
|
||||||
$cate = Category::find($categoryId);
|
$cate = Category::find($categoryId);
|
||||||
$ids = $cate->getAllChildrenId();
|
$ids = $cate->getAllChildrenId();
|
||||||
|
|
||||||
$articles = Article::whereIn('category_id', $ids)
|
$articles = Article::whereIn('category_id', $ids)
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->latest('sort')
|
->latest('sort')
|
||||||
->latest()
|
->latest()
|
||||||
->take($take)
|
->take($take)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $articles;
|
return $articles;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取子分类
|
//获取子分类
|
||||||
function getCateChild($categoryId)
|
function getCateChild($categoryId)
|
||||||
{
|
{
|
||||||
return Category::where('status', 1)
|
return Category::where('status', 1)
|
||||||
->where('parent_id', $categoryId)
|
->where('parent_id', $categoryId)
|
||||||
->orderBy('order', 'asc')
|
->orderBy('order', 'asc')
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取顶级分类
|
//获取顶级分类
|
||||||
function getTopCate($categoryId)
|
function getTopCate($categoryId)
|
||||||
{
|
{
|
||||||
$parent = Category::find($categoryId);
|
$parent = Category::find($categoryId);
|
||||||
|
|
||||||
while ($parent->parent_id != 0) {
|
while ($parent->parent_id != 0) {
|
||||||
$parent = $parent->parent;
|
$parent = $parent->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parent;
|
return $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取一个广告
|
//获取一个广告
|
||||||
function getOneAdvertByCate($categoryId, $result = '')
|
function getOneAdvertByCate($categoryId, $result = '')
|
||||||
{
|
{
|
||||||
$info = Advert::where('category_id', $categoryId)
|
$info = Advert::where('category_id', $categoryId)
|
||||||
->latest('sort')
|
->latest('sort')
|
||||||
->latest()
|
->latest()
|
||||||
->first();
|
->first();
|
||||||
if ($info) {
|
if ($info) {
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return $info->{$result};
|
return $info->{$result};
|
||||||
}
|
}
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Advert;
|
return new Advert;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAdvertsByCate($categoryId, $take = 8)
|
function getAdvertsByCate($categoryId, $take = 8)
|
||||||
{
|
{
|
||||||
return Advert::where('category_id', $categoryId)
|
return Advert::where('category_id', $categoryId)
|
||||||
->latest('sort')
|
->latest('sort')
|
||||||
->latest()
|
->latest()
|
||||||
->take($take)->get();
|
->take($take)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,20 +83,22 @@
|
|||||||
<div class="news">
|
<div class="news">
|
||||||
<div class="news-item party">
|
<div class="news-item party">
|
||||||
<div class="tabs-title" id="information">
|
<div class="tabs-title" id="information">
|
||||||
<span class="tabs-item show">{{ getOneCategory(10,'title') }}</span>
|
{{-- 党政建设--}}
|
||||||
<span class="tabs-item">{{ getOneCategory(9,'title') }}</span>
|
<span class="tabs-item show">{{ getOneCategory(4,'title') }}</span>
|
||||||
|
{{-- 媒体报道--}}
|
||||||
|
<span class="tabs-item"> {{ getOneCategory(17,'title') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="tabs-content-wrapper" id="informationContent">
|
<div class="tabs-content-wrapper" id="informationContent">
|
||||||
<!-- 国内资讯 -->
|
<!-- 国内资讯 -->
|
||||||
<ul class="party-ul tabs-content active">
|
<ul class="party-ul tabs-content active">
|
||||||
@if (getArticlesBYCate(10,3)->isNotEmpty())
|
@if (getArticlesBYCate(4,3)->isNotEmpty())
|
||||||
@foreach (getArticlesBYCate(10,3) as $article)
|
@foreach (getArticlesBYCate(4,3) as $article)
|
||||||
<li class="party-ul-li">
|
<li class="party-ul-li">
|
||||||
<a href="{{ $article->link }}">
|
<a href="{{ $article->link }}">
|
||||||
<span class="party-time">
|
<span class="party-time">
|
||||||
<h3>{{ $article->created_at->format('d') }}</h3>
|
<h3>{{ $article->created_at->format('d') }}</h3>
|
||||||
<p>{{ $article->created_at->format('Y-m') }}</p>
|
<p>{{ $article->created_at->format('Y-m') }}</p>
|
||||||
</span>
|
</span>
|
||||||
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
||||||
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
||||||
</a>
|
</a>
|
||||||
@@ -105,15 +107,16 @@
|
|||||||
@endif
|
@endif
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<!-- 媒体报道 -->
|
||||||
<ul class="party-ul tabs-content">
|
<ul class="party-ul tabs-content">
|
||||||
@if (getArticlesBYCate(9,12)->isNotEmpty())
|
@if (getArticlesBYCate(17,12)->isNotEmpty())
|
||||||
@foreach (getArticlesBYCate(9,12) as $article)
|
@foreach (getArticlesBYCate(17,12) as $article)
|
||||||
<li class="party-ul-li">
|
<li class="party-ul-li">
|
||||||
<a href="{{ $article->link }}">
|
<a href="{{ $article->link }}">
|
||||||
<span class="party-time">
|
<span class="party-time">
|
||||||
<h3>{{ $article->created_at->format('d') }}</h3>
|
<h3>{{ $article->created_at->format('d') }}</h3>
|
||||||
<p>{{ $article->created_at->format('Y-m') }}</p>
|
<p>{{ $article->created_at->format('Y-m') }}</p>
|
||||||
</span>
|
</span>
|
||||||
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
||||||
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
||||||
</a>
|
</a>
|
||||||
@@ -125,19 +128,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="news-item spirit">
|
<div class="news-item spirit">
|
||||||
<div class="mian-title">
|
<div class="mian-title">
|
||||||
<b>{{ getOneCategory(12,'title') }}</b>
|
{{-- 交流合作--}}
|
||||||
<span>/ {{ getOneCategory(12,'description') }}</span>
|
<b>{{ getOneCategory(5,'title') }}</b>
|
||||||
<a class="mian-title-more" href="{{ getOneCategory(12,'link') }}">更多<i class="fa fa-angle-right"></i></a>
|
<span>/ <!-- {{ getOneCategory(5,'description') }} -->Exchange and cooperation</span>
|
||||||
|
<a class="mian-title-more" href="{{ getOneCategory(5,'link') }}">更多<i class="fa fa-angle-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="spiritual-ul">
|
<ul class="spiritual-ul">
|
||||||
@if (getArticlesBYCate(12,3)->isNotEmpty())
|
@if (getArticlesBYCate(5,3)->isNotEmpty())
|
||||||
@foreach (getArticlesBYCate(12,3) as $article)
|
@foreach (getArticlesBYCate(5,3) as $article)
|
||||||
<li class="spiritual-ul-li">
|
<li class="spiritual-ul-li">
|
||||||
<a href="{{ $article->link }}">
|
<a href="{{ $article->link }}">
|
||||||
<h3 class="spiritual-title nowrap">{{ $article->title }}</h3>
|
<h3 class="spiritual-title nowrap">{{ $article->title }}</h3>
|
||||||
<p class="spiritual-info nowrap-multi">
|
<p class="spiritual-info nowrap-multi">{{ $article->description }}</p>
|
||||||
{{ $article->description }}
|
|
||||||
</p>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -159,8 +161,8 @@
|
|||||||
<span class="tabs-item show">{{ getOneCategory(13,'title') }}</span>
|
<span class="tabs-item show">{{ getOneCategory(13,'title') }}</span>
|
||||||
<span class="tabs-item">{{ getOneCategory(15,'title') }}</span>
|
<span class="tabs-item">{{ getOneCategory(15,'title') }}</span>
|
||||||
<span class="tabs-item">{{ getOneCategory(14,'title') }}</span>
|
<span class="tabs-item">{{ getOneCategory(14,'title') }}</span>
|
||||||
<span class="tabs-item">{{ getOneCategory(17,'title') }}</span>
|
{{-- <span class="tabs-item">{{ getOneCategory(17,'title') }}</span>--}}
|
||||||
<span class="tabs-item">{{ getOneCategory(16,'title') }}</span>
|
{{-- <span class="tabs-item">{{ getOneCategory(16,'title') }}</span> --}}
|
||||||
{{-- <a class="mian-title-more" href="">更多<i class="fa fa-angle-right"></i></a>--}}
|
{{-- <a class="mian-title-more" href="">更多<i class="fa fa-angle-right"></i></a>--}}
|
||||||
</div>
|
</div>
|
||||||
<div class="tabs-content-wrapper" id="newsTabContent">
|
<div class="tabs-content-wrapper" id="newsTabContent">
|
||||||
@@ -170,10 +172,11 @@
|
|||||||
@foreach (getArticlesBYCate(13,4) as $article)
|
@foreach (getArticlesBYCate(13,4) as $article)
|
||||||
<li class="party-ul-li">
|
<li class="party-ul-li">
|
||||||
<a href="{{ $article->link }}">
|
<a href="{{ $article->link }}">
|
||||||
<span class="party-time">
|
<span class="party-img">
|
||||||
<h3>{{ $article->created_at->format('d') }}</h3>
|
<!-- <h3>{{ $article->created_at->format('d') }}</h3>
|
||||||
<p>{{ $article->created_at->format('Y-m') }}</p>
|
<p>{{ $article->created_at->format('Y-m') }}</p> -->
|
||||||
</span>
|
</span><span class="party-img party-cover" style="background-image:url({{ $article->cover_path }})">
|
||||||
|
</span>
|
||||||
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
||||||
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
||||||
</a>
|
</a>
|
||||||
@@ -183,12 +186,12 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<!-- 梯队人才 -->
|
<!-- 梯队人才 -->
|
||||||
<ul class="party-ul tabs-content">
|
<ul class="party-ul tabs-content">
|
||||||
@if (getArticlesBYCate(13,4)->isNotEmpty())
|
@if (getArticlesBYCate(15,4)->isNotEmpty())
|
||||||
@foreach (getArticlesBYCate(13,4) as $article)
|
@foreach (getArticlesBYCate(15,4) as $article)
|
||||||
<li class="party-ul-li">
|
<li class="party-ul-li">
|
||||||
<a href="{{ $article->link }}">
|
<a href="{{ $article->link }}">
|
||||||
<span class="party-time party-cover" style="background-image:url({{ $article->cover_path }})">
|
<span class="party-img party-cover" style="background-image:url({{ $article->cover_path }})">
|
||||||
</span>
|
</span>
|
||||||
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
||||||
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
||||||
</a>
|
</a>
|
||||||
@@ -203,42 +206,8 @@
|
|||||||
@foreach (getArticlesBYCate(14,4) as $article)
|
@foreach (getArticlesBYCate(14,4) as $article)
|
||||||
<li class="party-ul-li">
|
<li class="party-ul-li">
|
||||||
<a href="{{ $article->link }}">
|
<a href="{{ $article->link }}">
|
||||||
<span class="party-time party-cover" style="background-image:url({{ $article->cover_path }})">
|
<span class="party-img party-cover" style="background-image:url({{ $article->cover_path }})">
|
||||||
</span>
|
</span>
|
||||||
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
|
||||||
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</ul>
|
|
||||||
<!-- 项目推广 -->
|
|
||||||
<ul class="party-ul tabs-content">
|
|
||||||
@if (getArticlesBYCate(17,4)->isNotEmpty())
|
|
||||||
@foreach (getArticlesBYCate(17,4) as $article)
|
|
||||||
<li class="party-ul-li">
|
|
||||||
<a href="{{ $article->link }}">
|
|
||||||
<span class="party-time">
|
|
||||||
<h3>{{ $article->created_at->format('d') }}</h3>
|
|
||||||
<p>{{ $article->created_at->format('Y-m') }}</p>
|
|
||||||
</span>
|
|
||||||
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
|
||||||
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</ul>
|
|
||||||
<!-- 成果专利 -->
|
|
||||||
<ul class="party-ul tabs-content">
|
|
||||||
@if (getArticlesBYCate(16,4)->isNotEmpty())
|
|
||||||
@foreach (getArticlesBYCate(16,4) as $article)
|
|
||||||
<li class="party-ul-li">
|
|
||||||
<a href="{{ $article->link }}">
|
|
||||||
<span class="party-time">
|
|
||||||
<h3>{{ $article->created_at->format('d') }}</h3>
|
|
||||||
<p>{{ $article->created_at->format('Y-m') }}</p>
|
|
||||||
</span>
|
|
||||||
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
<h3 class="party-title nowrap">{{ $article->title }}</h3>
|
||||||
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
<p class="party-info nowrap-multi">{{ $article->description }}</p>
|
||||||
</a>
|
</a>
|
||||||
@@ -250,23 +219,40 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 项目推广 -->
|
<!-- 项目推广 -->
|
||||||
<div class="news-item spirit">
|
<div class="news-item spirit">
|
||||||
<div class="mian-title">
|
<div class="tabs-title" id="patentTab">
|
||||||
<b>{{ getOneCategory(18,'title') }}</b>
|
<span class="tabs-item show">{{ getOneCategory(18,'title') }}</span>
|
||||||
<span>/ {{ getOneCategory(18,'description') }}</span>
|
<span class="tabs-item">{{ getOneCategory(16,'title') }}</span>
|
||||||
<a class="mian-title-more" href="{{ getOneCategory(18,'link') }}">更多<i class="fa fa-angle-right"></i></a>
|
{{-- <a class="mian-title-more" href="">更多<i class="fa fa-angle-right"></i></a>--}}
|
||||||
|
</div>
|
||||||
|
<div class="tabs-content-wrapper" id="patentTabContent">
|
||||||
|
<!-- 项目推广 -->
|
||||||
|
<ul class="spiritual-ul tabs-content active">
|
||||||
|
@if (getArticlesBYCate(18,4)->isNotEmpty())
|
||||||
|
@foreach (getArticlesBYCate(18,4) as $article)
|
||||||
|
<li class="spiritual-ul-li">
|
||||||
|
<a href="{{ $article->link }}">
|
||||||
|
<h3 class="spiritual-title nowrap">{{ $article->title }}</h3>
|
||||||
|
<p class="spiritual-info nowrap-multi">{{ $article->description }}</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- 成果专利 -->
|
||||||
|
<ul class="spiritual-ul tabs-content">
|
||||||
|
@if (getArticlesBYCate(16,4)->isNotEmpty())
|
||||||
|
@foreach (getArticlesBYCate(16,4) as $article)
|
||||||
|
<li class="spiritual-ul-li">
|
||||||
|
<a href="{{ $article->link }}">
|
||||||
|
<h3 class="spiritual-title nowrap">{{ $article->title }}</h3>
|
||||||
|
<p class="spiritual-info nowrap-multi">{{ $article->description }}</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<ul class="spiritual-ul">
|
|
||||||
@if (getArticlesBYCate(18,4)->isNotEmpty())
|
|
||||||
@foreach (getArticlesBYCate(18,4) as $article)
|
|
||||||
<li class="spiritual-ul-li">
|
|
||||||
<a href="{{ $article->link }}">
|
|
||||||
<h3 class="spiritual-title nowrap">{{ $article->title }}</h3>
|
|
||||||
<p class="spiritual-info nowrap-multi">{{ $article->description }}</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -300,5 +286,14 @@
|
|||||||
$("#informationContent .tabs-content").eq($(this).index()).addClass("active").siblings().removeClass("active")
|
$("#informationContent .tabs-content").eq($(this).index()).addClass("active").siblings().removeClass("active")
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//项目推广
|
||||||
|
$(function () {
|
||||||
|
$('#patentTab .tabs-item').hover(function () {
|
||||||
|
$(this).addClass("show").siblings().removeClass("show")
|
||||||
|
$("#patentTabContent .tabs-content").eq($(this).index()).addClass("active").siblings().removeClass("active")
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
Reference in New Issue
Block a user