更新
This commit is contained in:
@@ -39,7 +39,7 @@ class IndexController extends AdminController
|
|||||||
return $this->categories()->pluck('title');
|
return $this->categories()->pluck('title');
|
||||||
})->label();
|
})->label();
|
||||||
$grid->column('title', '文章标题');
|
$grid->column('title', '文章标题');
|
||||||
$grid->column('sort', '序号');
|
$grid->column('sort', '序号')->editable();
|
||||||
$states = [
|
$states = [
|
||||||
'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'],
|
'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'],
|
||||||
'off' => ['value' => 2, 'text' => '关闭', 'color' => 'default'],
|
'off' => ['value' => 2, 'text' => '关闭', 'color' => 'default'],
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ function getOneArticleBYCate($categoryId, $result = '')
|
|||||||
->whereHas('categories', function ($q) use ($categoryId) {
|
->whereHas('categories', function ($q) use ($categoryId) {
|
||||||
$q->where('id', $categoryId);
|
$q->where('id', $categoryId);
|
||||||
})
|
})
|
||||||
->latest()
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($info) {
|
if ($info) {
|
||||||
@@ -87,7 +88,8 @@ function getArticlesBYCate($categoryId, $take = 8, $mark = 'one', $hasCover = fa
|
|||||||
->whereHas('categories', function ($q) use ($categoryId) {
|
->whereHas('categories', function ($q) use ($categoryId) {
|
||||||
$q->where('id', $categoryId);
|
$q->where('id', $categoryId);
|
||||||
})
|
})
|
||||||
->orderBy('sort', $order)
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
->when($hasCover, function ($q) {
|
->when($hasCover, function ($q) {
|
||||||
$q->whereNotNull('cover');
|
$q->whereNotNull('cover');
|
||||||
})
|
})
|
||||||
@@ -104,7 +106,8 @@ function getArticlesBYCate($categoryId, $take = 8, $mark = 'one', $hasCover = fa
|
|||||||
->when($hasCover, function ($q) {
|
->when($hasCover, function ($q) {
|
||||||
$q->whereNotNull('cover');
|
$q->whereNotNull('cover');
|
||||||
})
|
})
|
||||||
->orderBy('sort', $order)
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
->take($take)
|
->take($take)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
@@ -179,7 +182,8 @@ function getArticlesByCateIds($take = 8, $hasCover = false)
|
|||||||
->whereHas('categories', function ($q) use ($ids) {
|
->whereHas('categories', function ($q) use ($ids) {
|
||||||
$q->whereIn('id', $ids);
|
$q->whereIn('id', $ids);
|
||||||
})
|
})
|
||||||
->latest()
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
->when($hasCover, function ($q) {
|
->when($hasCover, function ($q) {
|
||||||
$q->whereNotNull('cover')->orWhere('cover', '<>', '');
|
$q->whereNotNull('cover')->orWhere('cover', '<>', '');
|
||||||
})
|
})
|
||||||
@@ -200,7 +204,8 @@ function getArticlesByCateIds($take = 8, $hasCover = false)
|
|||||||
function getArticlesByPosition($postion)
|
function getArticlesByPosition($postion)
|
||||||
{
|
{
|
||||||
$articles = Article::ofPosition($postion)
|
$articles = Article::ofPosition($postion)
|
||||||
->latest()
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
->take(5)
|
->take(5)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,12 @@ img {max-width: 100%;}
|
|||||||
.indexPrize-img {position: relative; width: 100%; padding-top: 70%; margin-bottom: 10px; display: block;}
|
.indexPrize-img {position: relative; width: 100%; padding-top: 70%; margin-bottom: 10px; display: block;}
|
||||||
.indexPrize-title {font-size: 18px;}
|
.indexPrize-title {font-size: 18px;}
|
||||||
.indexPrize-pagination {bottom: -5px !important;}
|
.indexPrize-pagination {bottom: -5px !important;}
|
||||||
|
.IndexExpertNew {overflow: hidden; margin: 0 20px;}
|
||||||
|
.IndexExpertNew li { width: calc(33.33% - 40px); float: left; margin: 20px; padding: 15px 0; text-align: center; box-sizing: border-box;border: 1px solid #f5f5f5;border-radius: 5px;background: #f5f5f5;}
|
||||||
|
.IndexExpertNew-title {font-size: 18px; font-weight: 600}
|
||||||
|
.IndexExpertNew-tips {margin-bottom: 20px; color: #999; display: block; position: relative;}
|
||||||
|
.IndexExpertNew-tips::after {position: absolute; content: ''; left: calc(50% - 16px); bottom: -10px; background-color: #ffb993; width: 30px; height: 4px;
|
||||||
|
border-radius: 22px;}
|
||||||
|
|
||||||
|
|
||||||
/* 友情链接 */
|
/* 友情链接 */
|
||||||
|
|||||||
@@ -16,16 +16,19 @@
|
|||||||
{{ getOneCategory(12,'title') }}
|
{{ getOneCategory(12,'title') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="indexExtend-ul studyExtend">
|
<ul class="mediaList">
|
||||||
@if (getArticlesBYCate(12,2)->isNotEmpty())
|
@if (getArticlesBYCate(12,2)->isNotEmpty())
|
||||||
@foreach (getArticlesBYCate(12,2) as $article)
|
@foreach (getArticlesBYCate(12,2) as $article)
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ $article->link }}">
|
<a href="{{ $article->link }}">
|
||||||
<div class="ce-nowrap indexExtend-ul-name">
|
<div class="ce-img mediaList-img">
|
||||||
|
<span style="background-image: url({{ $article->cover_path }});"></span>
|
||||||
|
</div>
|
||||||
|
<div class="mediaList-text">
|
||||||
|
<div class="ce-nowrap-multi mediaList-name">
|
||||||
{{ $article->title }}
|
{{ $article->title }}
|
||||||
</div>
|
</div>
|
||||||
<div class="ce-nowrap-multi indexExtend-ul-text">
|
<span>{{ $article->description }}</span>
|
||||||
{{ $article->description }}
|
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -67,37 +70,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 媒体报道 -->
|
|
||||||
<div class="surveyCont">
|
|
||||||
<div class="secondTop">
|
|
||||||
<div class="secondTop-name">
|
|
||||||
<img src="/assets/index/images/surveyIcon_02.png">
|
|
||||||
{{ getOneCategory(11,'title') }}
|
|
||||||
</div>
|
|
||||||
<a href="{{ getOneCategory(11,'link') }}" class="secondTop-more">
|
|
||||||
查看更多>>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<ul class="mediaList">
|
|
||||||
@if (getArticlesBYCate(30,2)->isNotEmpty())
|
|
||||||
@foreach (getArticlesBYCate(30,2) as $article)
|
|
||||||
<li>
|
|
||||||
<a href="{{ $article->link }}">
|
|
||||||
<div class="ce-img mediaList-img">
|
|
||||||
<span style="background-image: url({{ $article->cover_path }});"></span>
|
|
||||||
</div>
|
|
||||||
<div class="mediaList-text">
|
|
||||||
<div class="ce-nowrap-multi mediaList-name">
|
|
||||||
{{ $article->title }}
|
|
||||||
</div>
|
|
||||||
<span>{{ $article->description }}</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,10 +21,11 @@
|
|||||||
@if ($articles->isNotEmpty())
|
@if ($articles->isNotEmpty())
|
||||||
@foreach ($articles as $article)
|
@foreach ($articles as $article)
|
||||||
<li>
|
<li>
|
||||||
<a href="">
|
<a href="{{ $article->link }}">
|
||||||
<div class="dateExtend-left">
|
<div class="dateExtend-left">
|
||||||
<span>06/01</span>
|
<span>{{ $article->created_at->format('m/d') }}</span>
|
||||||
2021
|
{{ $article->created_at->format('Y') }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="dateExtend-right">
|
<div class="dateExtend-right">
|
||||||
<div class="ce-nowrap indexExtend-ul-name">
|
<div class="ce-nowrap indexExtend-ul-name">
|
||||||
|
|||||||
@@ -388,19 +388,23 @@
|
|||||||
|
|
||||||
<!-- 专家智库 -->
|
<!-- 专家智库 -->
|
||||||
<div role="screen-2" class="tab-pane fade" id="screen-2">
|
<div role="screen-2" class="tab-pane fade" id="screen-2">
|
||||||
<ul class="IndexExpert-ul">
|
<ul class="IndexExpertNew">
|
||||||
@if (getArticlesBYCate(29,3)->isNotEmpty())
|
@if (getArticlesBYCate(29,9)->isNotEmpty())
|
||||||
@foreach (getArticlesBYCate(29,3) as $article)
|
@foreach (getArticlesBYCate(29,9) as $article)
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ $article->link }}" title="{{ $article->title }}">
|
<a href="{{ $article->link }}" title="{{ $article->title }}">
|
||||||
<div class="ce-img IndexExpert-img">
|
<div class="IndexExpertNew-li">
|
||||||
|
<span class="IndexExpertNew-tips">客座教授</span>
|
||||||
|
<div class="IndexExpertNew-title">{{ $article->title }}</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="ce-img IndexExpert-img">
|
||||||
<span style="background-image: url({{ $article->cover_path }});"></span>
|
<span style="background-image: url({{ $article->cover_path }});"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="IndexExpert-name">
|
<div class="IndexExpert-name">
|
||||||
<div class="IndexExpert-title">
|
<div class="IndexExpert-title">
|
||||||
<span>{{ $article->title }}</span>科学专家
|
<span>{{ $article->title }}</span>客座教授
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div> -->
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Reference in New Issue
Block a user