[更新]微调
This commit is contained in:
@@ -3,12 +3,14 @@
|
|||||||
namespace App\Admin\Controllers\Article;
|
namespace App\Admin\Controllers\Article;
|
||||||
|
|
||||||
use App\Models\ArticlePicture;
|
use App\Models\ArticlePicture;
|
||||||
|
use App\Models\Category;
|
||||||
use Encore\Admin\Controllers\AdminController;
|
use Encore\Admin\Controllers\AdminController;
|
||||||
use Encore\Admin\Form;
|
use Encore\Admin\Form;
|
||||||
use Encore\Admin\Grid;
|
use Encore\Admin\Grid;
|
||||||
|
|
||||||
class PictureController extends AdminController
|
class PictureController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $title = '随手拍';
|
protected $title = '随手拍';
|
||||||
|
|
||||||
public function grid()
|
public function grid()
|
||||||
@@ -24,7 +26,7 @@ class PictureController extends AdminController
|
|||||||
});
|
});
|
||||||
|
|
||||||
$grid->column('id', '#ID#');
|
$grid->column('id', '#ID#');
|
||||||
$grid->column('cover')->display(function () {
|
$grid->column('cover', '图片')->display(function () {
|
||||||
return $this->one_picture_path;
|
return $this->one_picture_path;
|
||||||
})->image('', 100);
|
})->image('', 100);
|
||||||
$grid->column('category.title', '所属分类');
|
$grid->column('category.title', '所属分类');
|
||||||
@@ -40,7 +42,14 @@ class PictureController extends AdminController
|
|||||||
$form = new Form(new ArticlePicture);
|
$form = new Form(new ArticlePicture);
|
||||||
|
|
||||||
$form->text('title', '文章标题')->rules('min:2');
|
$form->text('title', '文章标题')->rules('min:2');
|
||||||
$form->hidden('category_id')->value(6);
|
$form->select('category_id', '所属分类')
|
||||||
|
->options(Category::selectOptions(function ($model) {
|
||||||
|
return $model->whereIn('type', [Category::TYPE_PICTURE]);
|
||||||
|
}, '选择分类'))
|
||||||
|
->rules('required|min:1', [
|
||||||
|
'required' => '必须选择所属分类',
|
||||||
|
'min' => '必须选择所属分类',
|
||||||
|
]);
|
||||||
$form->multipleImage('pictures', '封面')
|
$form->multipleImage('pictures', '封面')
|
||||||
->move('images/' . date('Y/m/d'))
|
->move('images/' . date('Y/m/d'))
|
||||||
->removable()
|
->removable()
|
||||||
|
|||||||
@@ -16,17 +16,50 @@ class IndexController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$ssp = ArticlePicture::orderBy('sort', 'desc')->take(3)->get(); //随手拍
|
$ssp = ArticlePicture::orderBy('sort', 'desc')->where('category_id', 6)->take(3)->get();
|
||||||
$all_articles = Article::orderBy('sort', 'desc')->whereNotIn('category_id', [20, 21, 22])->take(7)->get(); //最新资讯
|
//随手拍
|
||||||
$danwei = Article::where('category_id', 15)->latest()->first(); //单位概况
|
$all_articles = Article::orderBy('sort', 'desc')
|
||||||
$ysbj = Article::where('category_id', 12)->latest()->take(3)->get(); //养生保健
|
->whereNotIn('category_id', [20, 21, 22])
|
||||||
$dcyfx = Article::where('category_id', 10)->latest()->take(7)->get(); //调研与分析
|
->take(7)
|
||||||
$yyjcyj = Article::where('category_id', 9)->latest()->take(7)->get(); //应用基础研究
|
->get();
|
||||||
$jsyt = Article::where('category_id', 11)->latest()->take(7)->get(); //技术研讨
|
//最新资讯
|
||||||
$kyyyy = Article::where('category_id', 12)->latest()->take(7)->get(); //科研与应用
|
$danwei = Article::where('category_id', 15)
|
||||||
$qkys = Article::where('category_id', 9)->latest()->take(7)->get(); //全科医学
|
->latest()
|
||||||
|
->first();
|
||||||
|
//单位概况
|
||||||
|
$ysbj = Article::where('category_id', 12)
|
||||||
|
->latest()
|
||||||
|
->take(3)
|
||||||
|
->get();
|
||||||
|
//养生保健
|
||||||
|
$dcyfx = Article::where('category_id', 10)
|
||||||
|
->latest()
|
||||||
|
->take(7)
|
||||||
|
->get();
|
||||||
|
//调研与分析
|
||||||
|
$yyjcyj = Article::where('category_id', 9)
|
||||||
|
->latest()
|
||||||
|
->take(7)
|
||||||
|
->get();
|
||||||
|
//应用基础研究
|
||||||
|
$jsyt = Article::where('category_id', 11)
|
||||||
|
->latest()
|
||||||
|
->take(7)
|
||||||
|
->get();
|
||||||
|
//技术研讨
|
||||||
|
$kyyyy = Article::where('category_id', 12)
|
||||||
|
->latest()
|
||||||
|
->take(7)
|
||||||
|
->get();
|
||||||
|
//科研与应用
|
||||||
|
$qkys = Article::where('category_id', 13)
|
||||||
|
->latest()
|
||||||
|
->take(7)
|
||||||
|
->get();
|
||||||
|
//全科医学
|
||||||
$center_advert = Advert::where('category_id', 18)->first();
|
$center_advert = Advert::where('category_id', 18)->first();
|
||||||
$qikan_advert = Advert::where('category_id', 19)->take(4)->orderBy('sort', 'desc')->get();
|
//期刊
|
||||||
|
$qikan_advert = ArticlePicture::latest()->take(4)->where('category_id', 23)->get();
|
||||||
|
|
||||||
return view('index.index', compact('ssp', 'all_articles', 'danwei', 'ysbj', 'dcyfx', 'yyjcyj', 'jsyt', 'kyyyy', 'qkys', 'center_advert', 'qikan_advert'));
|
return view('index.index', compact('ssp', 'all_articles', 'danwei', 'ysbj', 'dcyfx', 'yyjcyj', 'jsyt', 'kyyyy', 'qkys', 'center_advert', 'qikan_advert'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,20 +9,21 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
|
|
||||||
class Category extends Model
|
class Category extends Model
|
||||||
{
|
{
|
||||||
use AdminBuilder, ModelTree;
|
|
||||||
|
|
||||||
public const TYPES = [
|
use AdminBuilder, ModelTree;
|
||||||
'article' => '文章列表',
|
|
||||||
'show' => '文章详情',
|
|
||||||
'advert' => '广告',
|
|
||||||
'picture' => '图册',
|
|
||||||
];
|
|
||||||
|
|
||||||
public const TYPE_SHOW = 'show';
|
public const TYPE_SHOW = 'show';
|
||||||
public const TYPE_ARTICLE = 'article';
|
public const TYPE_ARTICLE = 'article';
|
||||||
public const TYPE_ADVERT = 'advert';
|
public const TYPE_ADVERT = 'advert';
|
||||||
public const TYPE_PICTURE = 'picture';
|
public const TYPE_PICTURE = 'picture';
|
||||||
|
|
||||||
|
public const TYPES = [
|
||||||
|
self::TYPE_ARTICLE => '文章列表',
|
||||||
|
self::TYPE_SHOW => '文章详情',
|
||||||
|
self::TYPE_ADVERT => '广告',
|
||||||
|
self::TYPE_PICTURE => '图册',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联的数据
|
* 关联的数据
|
||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
|
|||||||
@@ -45,7 +45,8 @@
|
|||||||
@foreach ($all_articles as $article)
|
@foreach ($all_articles as $article)
|
||||||
<li>
|
<li>
|
||||||
<div class="idxNews-ul-title">
|
<div class="idxNews-ul-title">
|
||||||
<a href="{{ route('article.show', $article) }}"><p class="ce-nowrap">{{ $article->title }}</p></a>
|
<a href="{{ route('article.show', $article) }}">
|
||||||
|
<p class="ce-nowrap">{{ $article->title }}</p></a>
|
||||||
<span>{{ $article->created_at }}</span>
|
<span>{{ $article->created_at }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ce-nowrap-multi idxNews-ul-text">
|
<div class="ce-nowrap-multi idxNews-ul-text">
|
||||||
@@ -137,7 +138,9 @@
|
|||||||
<span style="background-image: url({{ $dcyfx->first()->cover_path }});"></span>
|
<span style="background-image: url({{ $dcyfx->first()->cover_path }});"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="recomdUl-top-text">
|
<div class="recomdUl-top-text">
|
||||||
<p class="ce-nowrap"><a href="{{ route('article.show', $dcyfx->first()) }}"> {{ $dcyfx->first()->title }}</a></p>
|
<p class="ce-nowrap">
|
||||||
|
<a href="{{ route('article.show', $dcyfx->first()) }}"> {{ $dcyfx->first()->title }}</a>
|
||||||
|
</p>
|
||||||
<span class="ce-nowrap-multi">{{ $dcyfx->first()->description }}</span>
|
<span class="ce-nowrap-multi">{{ $dcyfx->first()->description }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -169,7 +172,9 @@
|
|||||||
<span style="background-image: url({{ $yyjcyj->first()->cover_path }});"></span>
|
<span style="background-image: url({{ $yyjcyj->first()->cover_path }});"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="recomdUl-top-text">
|
<div class="recomdUl-top-text">
|
||||||
<p class="ce-nowrap"><a href="{{ route('article.show', $yyjcyj->first()) }}"> {{ $yyjcyj->first()->title }}</a></p>
|
<p class="ce-nowrap">
|
||||||
|
<a href="{{ route('article.show', $yyjcyj->first()) }}"> {{ $yyjcyj->first()->title }}</a>
|
||||||
|
</p>
|
||||||
<span class="ce-nowrap-multi">{{ $yyjcyj->first()->description }}</span>
|
<span class="ce-nowrap-multi">{{ $yyjcyj->first()->description }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -202,7 +207,9 @@
|
|||||||
<span style="background-image: url({{ $jsyt->first()->cover_path }});"></span>
|
<span style="background-image: url({{ $jsyt->first()->cover_path }});"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="recomdUl-top-text">
|
<div class="recomdUl-top-text">
|
||||||
<p class="ce-nowrap"><a href="{{ route('article.show', $jsyt->first()) }}"> {{ $jsyt->first()->title }}</a></p>
|
<p class="ce-nowrap">
|
||||||
|
<a href="{{ route('article.show', $jsyt->first()) }}"> {{ $jsyt->first()->title }}</a>
|
||||||
|
</p>
|
||||||
<span class="ce-nowrap-multi">{{ $jsyt->first()->description }}</span>
|
<span class="ce-nowrap-multi">{{ $jsyt->first()->description }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -278,7 +285,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="idxWeekly-ul">
|
<div class="idxWeekly-ul">
|
||||||
@foreach ($qikan_advert as $advert)
|
@foreach ($qikan_advert as $advert)
|
||||||
<div class="idxWeekly-back" style="background-image: url({{ $advert->cover_path }});"></div>
|
<div class="idxWeekly-back" style="background-image: url({{ $advert->one_picture_path }});"></div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -121,8 +121,8 @@
|
|||||||
<div class="idxFooter-tips">
|
<div class="idxFooter-tips">
|
||||||
<p>版权所有: 黑龙江易代文化产业有限公司 <a href="http://www.beian.miit.gov.cn/" style="color: #fff">黑ICP备18000348号-1</a>
|
<p>版权所有: 黑龙江易代文化产业有限公司 <a href="http://www.beian.miit.gov.cn/" style="color: #fff">黑ICP备18000348号-1</a>
|
||||||
</p>
|
</p>
|
||||||
<p>地址:哈尔滨市嵩山路15号(150090) 电话:0451-82316133/82321706 E-Mail:
|
<p>地址:哈尔滨市嵩山路15号(150090) 电话:{{ config('mobile') }}
|
||||||
hlj16133@163.com</p>
|
E-Mail:{{ config('email') }}</p>
|
||||||
<p>印刷单位:哈尔滨市工大节能印刷厂 总发行:哈尔滨市邮局 订阅:全国各地邮局 刊期:半月</p>
|
<p>印刷单位:哈尔滨市工大节能印刷厂 总发行:哈尔滨市邮局 订阅:全国各地邮局 刊期:半月</p>
|
||||||
<p>广告发布登记编号:哈南市监逛变字【2019】第21号</p>
|
<p>广告发布登记编号:哈南市监逛变字【2019】第21号</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<p class="ccsl">联系我们 </p>
|
<p class="ccsl">联系我们 </p>
|
||||||
</div>
|
</div>
|
||||||
<div class="lxwmbox">
|
<div class="lxwmbox">
|
||||||
<div>黑龙江省杂志社<br/> 联系电话:82316133<br/>投稿邮箱:hlj16133@163.com</div>
|
<div>黑龙江省杂志社<br/> 联系电话:0451-82321706<br/>投稿邮箱:{{ config('email') }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user