阶段更新
This commit is contained in:
@@ -55,14 +55,19 @@ class IndexController extends AdminController
|
|||||||
$form->belongsToMany('categories', CategorySelectAble::class, __('关联分类'));
|
$form->belongsToMany('categories', CategorySelectAble::class, __('关联分类'));
|
||||||
$form->textarea('description', '内容简介');
|
$form->textarea('description', '内容简介');
|
||||||
|
|
||||||
$form->list('subjoin', '附加')
|
// $form->list('subjoin', '附加')
|
||||||
->help('只有领导班子需要添加');
|
// ->help('只有领导班子需要添加');
|
||||||
|
|
||||||
$form->image('cover', '封面')
|
$form->image('cover', '封面')
|
||||||
->move('images/'.date('Y/m/d'))
|
->move('images/'.date('Y/m/d'))
|
||||||
->removable()
|
->removable()
|
||||||
->uniqueName();
|
->uniqueName();
|
||||||
|
|
||||||
|
$form->image('label', '图标')
|
||||||
|
->move('images/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
|
||||||
$form->multipleImage('pictures', '多图')
|
$form->multipleImage('pictures', '多图')
|
||||||
->move('images/'.date('Y/m/d'))
|
->move('images/'.date('Y/m/d'))
|
||||||
->removable()
|
->removable()
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class CategoryController extends Controller
|
|||||||
$parent = $category->parent;
|
$parent = $category->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
$articles = Article::ByCategory($category->getAllChildrenId())
|
$articles = Article::shown()->ByCategory($category->getAllChildrenId())
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->Bysort()
|
->Bysort()
|
||||||
->paginate();
|
->paginate();
|
||||||
@@ -47,7 +47,7 @@ class CategoryController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($category->id == 2) {
|
if ($category->id == 2) {
|
||||||
$article = Article::query()->ByCategory(2)->Bysort()->first();
|
$article = Article::shown()->ByCategory(2)->Bysort()->first();
|
||||||
$data = array_merge($data, [
|
$data = array_merge($data, [
|
||||||
'article' => $article,
|
'article' => $article,
|
||||||
]);
|
]);
|
||||||
@@ -57,9 +57,9 @@ class CategoryController extends Controller
|
|||||||
$cgCate = Category::find(24);
|
$cgCate = Category::find(24);
|
||||||
$hjCate = Category::find(20);
|
$hjCate = Category::find(20);
|
||||||
$zlCate = Category::find(21);
|
$zlCate = Category::find(21);
|
||||||
$cgArticles = Article::query()->ByCategory($cgCate->id)->Bysort()->take(3)->get();
|
$cgArticles = Article::shown()->ByCategory($cgCate->id)->Bysort()->take(3)->get();
|
||||||
$hjArticles = Article::query()->ByCategory($hjCate->id)->Bysort()->take(3)->get();
|
$hjArticles = Article::shown()->ByCategory($hjCate->id)->Bysort()->take(3)->get();
|
||||||
$zlArticles = Article::query()->ByCategory($zlCate->id)->Bysort()->take(6)->get();
|
$zlArticles = Article::shown()->ByCategory($zlCate->id)->Bysort()->take(6)->get();
|
||||||
|
|
||||||
$data = array_merge($data, [
|
$data = array_merge($data, [
|
||||||
'cgCate' => $cgCate,
|
'cgCate' => $cgCate,
|
||||||
@@ -72,7 +72,7 @@ class CategoryController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($category->id == 3) {
|
if ($category->id == 3) {
|
||||||
$articles = Article::ByCategory($category->getAllChildrenId())
|
$articles = Article::shown()->ByCategory($category->getAllChildrenId())
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->Bysort()
|
->Bysort()
|
||||||
->get();
|
->get();
|
||||||
@@ -87,9 +87,9 @@ class CategoryController extends Controller
|
|||||||
$nyydtCate = Category::find(7);
|
$nyydtCate = Category::find(7);
|
||||||
$mtbdCate = Category::find(31);
|
$mtbdCate = Category::find(31);
|
||||||
|
|
||||||
$tzArticles = Article::query()->ByCategory($tzCate->id)->Bysort()->take(4)->get();
|
$tzArticles = Article::shown()->ByCategory($tzCate->id)->Bysort()->take(4)->get();
|
||||||
$nyydtArticles = Article::query()->ByCategory($nyydtCate->id)->Bysort()->take(3)->get();
|
$nyydtArticles = Article::shown()->ByCategory($nyydtCate->id)->Bysort()->take(3)->get();
|
||||||
$mtbdArticles = Article::query()->ByCategory($mtbdCate->id)->Bysort()->take(3)->get();
|
$mtbdArticles = Article::shown()->ByCategory($mtbdCate->id)->Bysort()->take(3)->get();
|
||||||
$data = array_merge($data, [
|
$data = array_merge($data, [
|
||||||
'tzCate' => $tzCate,
|
'tzCate' => $tzCate,
|
||||||
'nyydtCate' => $nyydtCate,
|
'nyydtCate' => $nyydtCate,
|
||||||
@@ -105,8 +105,8 @@ class CategoryController extends Controller
|
|||||||
$zdCate = Category::find(16);
|
$zdCate = Category::find(16);
|
||||||
$ljCate = Category::find(29);
|
$ljCate = Category::find(29);
|
||||||
|
|
||||||
$yjArticles = Article::query()->ByCategory($yjCate->id)->Bysort()->take(3)->get();
|
$yjArticles = Article::shown()->ByCategory($yjCate->id)->Bysort()->take(3)->get();
|
||||||
$ljLeaders = Leader::query()->where('category_id', $ljCate->id)->Bysort()->take(3)->get();
|
$ljLeaders = Leader::shown()->where('category_id', $ljCate->id)->Bysort()->take(3)->get();
|
||||||
$data = array_merge($data, [
|
$data = array_merge($data, [
|
||||||
'yjCate' => $yjCate,
|
'yjCate' => $yjCate,
|
||||||
'zdCate' => $zdCate,
|
'zdCate' => $zdCate,
|
||||||
@@ -118,9 +118,14 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
if ($category->id == 32) {
|
if ($category->id == 32) {
|
||||||
|
|
||||||
$nghjxhArticle = Article::query()->ByCategory($category->id)->Bysort()->first();
|
$nghjxhArticle = Article::shown()->ByCategory($category->id)->Bysort()->first();
|
||||||
$data = array_merge($data, [
|
$xhdtCate = Category::find(33);
|
||||||
|
$xhdtArticles = Article::shown()->ByCategory($xhdtCate->id)->Bysort()->get();
|
||||||
|
|
||||||
|
$data = array_merge($data, [
|
||||||
'nghjxhArticle' => $nghjxhArticle,
|
'nghjxhArticle' => $nghjxhArticle,
|
||||||
|
'xhdtCate' => $xhdtCate,
|
||||||
|
'xhdtArticles' => $xhdtArticles,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class StaffController extends Controller
|
|||||||
$parent = $category->parent;
|
$parent = $category->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
$staffs = Staff::query()->latest('order')->get();
|
$staffs = Staff::shown()->latest('order')->get();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'staffs' => $staffs,
|
'staffs' => $staffs,
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Models\Traits\HasCovers;
|
use App\Models\Traits\HasCovers;
|
||||||
use App\Models\Traits\HasSort;
|
use App\Models\Traits\HasSort;
|
||||||
|
use App\Models\Traits\ScopeStatus;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Article extends Model
|
class Article extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasCovers,HasSort;
|
use HasCovers, HasSort, ScopeStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应进行类型转换的属性
|
* 应进行类型转换的属性
|
||||||
@@ -59,16 +60,40 @@ class Article extends Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取时间 天
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2022/6/30 10:33
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getDateD()
|
public function getDateD()
|
||||||
{
|
{
|
||||||
return $this->created_at->format('d');
|
return $this->created_at->format('d');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取时间 年月
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2022/6/30 10:33
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getDateYM()
|
public function getDateYM()
|
||||||
{
|
{
|
||||||
return $this->created_at->format('Y-m');
|
return $this->created_at->format('Y-m');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 解析单图地址
|
||||||
|
*
|
||||||
|
* @Date : 2021/3/16 4:54 下午
|
||||||
|
* @Author : <Jason.C>
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLabelUrlAttribute(): string
|
||||||
|
{
|
||||||
|
return $this->parseImageUrl($this->label);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ namespace App\Models;
|
|||||||
use App\Models\Traits\BelongsToCategory;
|
use App\Models\Traits\BelongsToCategory;
|
||||||
use App\Models\Traits\HasCovers;
|
use App\Models\Traits\HasCovers;
|
||||||
use App\Models\Traits\HasSort;
|
use App\Models\Traits\HasSort;
|
||||||
|
use App\Models\Traits\ScopeStatus;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Leader extends Model
|
class Leader extends Model
|
||||||
{
|
{
|
||||||
use BelongsToCategory,
|
use BelongsToCategory,
|
||||||
HasCovers,
|
HasCovers,
|
||||||
|
ScopeStatus,
|
||||||
HasSort;
|
HasSort;
|
||||||
|
|
||||||
const STATUS_FALSE = 0;
|
const STATUS_FALSE = 0;
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Models\Traits\BelongsToCategory;
|
use App\Models\Traits\BelongsToCategory;
|
||||||
use App\Models\Traits\HasCovers;
|
use App\Models\Traits\HasCovers;
|
||||||
|
use App\Models\Traits\ScopeStatus;
|
||||||
|
|
||||||
class Staff extends Model
|
class Staff extends Model
|
||||||
{
|
{
|
||||||
use BelongsToCategory, HasCovers;
|
use BelongsToCategory, HasCovers,ScopeStatus;
|
||||||
|
|
||||||
|
|
||||||
const STATUS_FALSE = 0;
|
const STATUS_FALSE = 0;
|
||||||
|
|||||||
26
app/Models/Traits/ScopeStatus.php
Normal file
26
app/Models/Traits/ScopeStatus.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Traits;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use function collect;
|
||||||
|
|
||||||
|
trait ScopeStatus
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 排序
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2022/6/28 14:49
|
||||||
|
* @param $query
|
||||||
|
* @param $ids
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function scopeShown($query)
|
||||||
|
{
|
||||||
|
return $query->where('status',1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -35,62 +35,38 @@
|
|||||||
<!-- 活动新闻列表 -->
|
<!-- 活动新闻列表 -->
|
||||||
<div class="scientific">
|
<div class="scientific">
|
||||||
<div class="learnNews">
|
<div class="learnNews">
|
||||||
<div class="learnNews-left" style="background-image: url(./images/learnNews_back.png);">
|
<div class="learnNews-left"
|
||||||
<div class="learnNews-left-name">活动新闻列表</div>
|
style="background-image: url({{ asset('assets/index/images/learnNews_back.png') }});">
|
||||||
<div class="learnNews-left-text">Event news</div>
|
<div class="learnNews-left-name">{{ $xhdtCate->title }}</div>
|
||||||
<a href="列表页-有图.html" class="learnNews-left-btn">
|
<div class="learnNews-left-text">{{ $xhdtCate->description }}</div>
|
||||||
|
<a href="{{ $xhdtCate->link }}" class="learnNews-left-btn">
|
||||||
<span>+</span>
|
<span>+</span>
|
||||||
<div class="learnNews-left-more">查看更多 >></div>
|
<div class="learnNews-left-more">查看更多 >></div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="learnNews-right">
|
<div class="learnNews-right">
|
||||||
<ul class="learnList">
|
@if ($xhdtArticles->isNotEmpty())
|
||||||
<li>
|
<ul class="learnList">
|
||||||
<a href="详情页.html">
|
@foreach ($xhdtArticles as $relation)
|
||||||
<div class="ce-img learnList-img">
|
<li>
|
||||||
<span style="background-image: url(./temporary/img1.png);"></span>
|
<a href="{{ $relation->link }}">
|
||||||
</div>
|
<div class="ce-img learnList-img">
|
||||||
<div class="learnList-cont">
|
<span style="background-image: url({{ $relation->cover_url }});"></span>
|
||||||
<div class="nowrap learnList-name">一种硫掺杂催化油浆基多孔碳材料及其制备方法</div>
|
</div>
|
||||||
<div class="learnList-time">发布时间:2021-10-28</div>
|
<div class="learnList-cont">
|
||||||
<div class="ellipsis learnList-text">
|
<div class="nowrap learnList-name">{{ $relation->title }}</div>
|
||||||
一种硫掺杂催化油浆基多孔碳材料及其制备方法,它属于催化裂化油浆综合利用及功能型碳材料领域。本发明要解决的技术问题为当前存在的催化油浆深加工利用问题。
|
<div class="learnList-time">
|
||||||
</div>
|
发布时间:{{ $relation->created_at->format('Y-m-d') }}</div>
|
||||||
<div class="learnList-more">了解详情 ></div>
|
<div class="ellipsis learnList-text">
|
||||||
</div>
|
{{ $relation->description }}
|
||||||
</a>
|
</div>
|
||||||
</li>
|
<div class="learnList-more">了解详情 ></div>
|
||||||
<li>
|
</div>
|
||||||
<a href="详情页.html">
|
</a>
|
||||||
<div class="ce-img learnList-img">
|
</li>
|
||||||
<span style="background-image: url(./temporary/img4.png);"></span>
|
@endforeach
|
||||||
</div>
|
</ul>
|
||||||
<div class="learnList-cont">
|
@endif
|
||||||
<div class="nowrap learnList-name">一种硫掺杂催化油浆基多孔碳材料及其制备方法</div>
|
|
||||||
<div class="learnList-time">发布时间:2021-10-28</div>
|
|
||||||
<div class="ellipsis learnList-text">
|
|
||||||
一种硫掺杂催化油浆基多孔碳材料及其制备方法,它属于催化裂化油浆综合利用及功能型碳材料领域。本发明要解决的技术问题为当前存在的催化油浆深加工利用问题。
|
|
||||||
</div>
|
|
||||||
<div class="learnList-more">了解详情 ></div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="详情页.html">
|
|
||||||
<div class="ce-img learnList-img">
|
|
||||||
<span style="background-image: url(./temporary/img3.png);"></span>
|
|
||||||
</div>
|
|
||||||
<div class="learnList-cont">
|
|
||||||
<div class="nowrap learnList-name">一种硫掺杂催化油浆基多孔碳材料及其制备方法</div>
|
|
||||||
<div class="learnList-time">发布时间:2021-10-28</div>
|
|
||||||
<div class="ellipsis learnList-text">
|
|
||||||
一种硫掺杂催化油浆基多孔碳材料及其制备方法,它属于催化裂化油浆综合利用及功能型碳材料领域。本发明要解决的技术问题为当前存在的催化油浆深加工利用问题。
|
|
||||||
</div>
|
|
||||||
<div class="learnList-more">了解详情 ></div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user