微调
This commit is contained in:
@@ -69,6 +69,8 @@ class ArticleController extends AdminController
|
||||
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
||||
];
|
||||
|
||||
$form->text('url', '外链地址')->help('必须有http');
|
||||
|
||||
$form->switch('status', '状态')->states($states);
|
||||
|
||||
return $form;
|
||||
|
||||
@@ -125,16 +125,16 @@ class IndexController extends AdminController
|
||||
|
||||
$form->saving(function (Form $form) {
|
||||
|
||||
if (request()->has('title')) {
|
||||
if (request()->type == Category::TYPE_SHOW && empty(request()->article_id)) {
|
||||
$error = new MessageBag([
|
||||
'title' => '错误',
|
||||
'message' => '文章类型是文章详情的时候需要选择关联文章',
|
||||
]);
|
||||
|
||||
return back()->withInput()->with(compact('error'));
|
||||
}
|
||||
}
|
||||
// if (request()->has('title')) {
|
||||
// if (request()->type == Category::TYPE_SHOW && empty(request()->article_id)) {
|
||||
// $error = new MessageBag([
|
||||
// 'title' => '错误',
|
||||
// 'message' => '文章类型是文章详情的时候需要选择关联文章',
|
||||
// ]);
|
||||
//
|
||||
// return back()->withInput()->with(compact('error'));
|
||||
// }
|
||||
// }
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ class ArticleController extends Controller
|
||||
|
||||
public function show(Article $article)
|
||||
{
|
||||
if ($article->url) {
|
||||
return redirect($article->url);
|
||||
}
|
||||
|
||||
$category = $article->category;
|
||||
|
||||
return view('articles.show', compact('article', 'category'));
|
||||
|
||||
@@ -16,47 +16,49 @@ class IndexController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$ssp = ArticlePicture::orderBy('sort', 'desc')->where('category_id', 6)->take(3)->get();
|
||||
//随手拍
|
||||
$all_articles = Article::orderBy('sort', 'desc')
|
||||
$ssp = ArticlePicture::orderBy('sort', 'desc')->where('category_id', 6)->take(3)->get();
|
||||
//最新资讯
|
||||
$all_articles = Article::latest()
|
||||
->whereNotIn('category_id', [20, 21, 22])
|
||||
->take(7)
|
||||
->get();
|
||||
//最新资讯
|
||||
// dd($all_articles->toArray());
|
||||
//单位概况
|
||||
$danwei = Article::where('category_id', 15)
|
||||
->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();
|
||||
//期刊
|
||||
$qikan_advert = ArticlePicture::latest()->take(4)->where('category_id', 23)->get();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@charset "utf-8";
|
||||
@charset "utf-8";
|
||||
/* CSS Document */
|
||||
*{ margin:0; padding:0}
|
||||
ul li{ list-style:none}
|
||||
@@ -187,7 +187,6 @@ ul.listul li .newsr .more{color:#ff6600;display: inline-block;margin-top: 20px;}
|
||||
.detailbox .xq .date{color: #999;background: #eee;padding: 8px 0;text-align: center;margin-bottom: 20px;font-size: 14px;}
|
||||
.detailbox .xq .con{ font-size:14px; color:#333;line-height: 2; padding-bottom:40px}
|
||||
.detailbox .xq .pprooimg{ display:block; margin:0 auto; max-width:600px; margin-bottom:20px}
|
||||
.detailbox .xq .con p{ text-indent:2em}
|
||||
|
||||
|
||||
.pagebox{ text-align:center; padding-top:30px; padding-bottom:50px}
|
||||
|
||||
@@ -66,16 +66,16 @@
|
||||
<p>期刊简介</p>
|
||||
<span>/ INTRODUCTION OF THE JOURNAL</span>
|
||||
</div>
|
||||
<a href="@if ($danwei) {{ route('article.show', $danwei) }} @endif">更多 ></a>
|
||||
<a href="@if ($danwei) {{ route('article.show', $danwei) }} @endif">更多 ></a>
|
||||
</div>
|
||||
<div class="idxSurveyCont">
|
||||
<div class="idxSurveyCont-left">
|
||||
@if ($danwei) {{ $danwei->description }} @endif
|
||||
@if ($danwei) {{ $danwei->description }} @endif
|
||||
|
||||
</div>
|
||||
<div class="idxSurveyCont-right">
|
||||
<div class="idxSurveyCont-right-img">
|
||||
<img src=" @if ($danwei) {{ $danwei->cover_path }} @endif">
|
||||
<img src=" @if ($danwei) {{ $danwei->cover_path }} @endif">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user