微调
This commit is contained in:
@@ -69,6 +69,8 @@ class ArticleController extends AdminController
|
|||||||
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$form->text('url', '外链地址')->help('必须有http');
|
||||||
|
|
||||||
$form->switch('status', '状态')->states($states);
|
$form->switch('status', '状态')->states($states);
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
|
|||||||
@@ -125,16 +125,16 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
$form->saving(function (Form $form) {
|
$form->saving(function (Form $form) {
|
||||||
|
|
||||||
if (request()->has('title')) {
|
// if (request()->has('title')) {
|
||||||
if (request()->type == Category::TYPE_SHOW && empty(request()->article_id)) {
|
// if (request()->type == Category::TYPE_SHOW && empty(request()->article_id)) {
|
||||||
$error = new MessageBag([
|
// $error = new MessageBag([
|
||||||
'title' => '错误',
|
// 'title' => '错误',
|
||||||
'message' => '文章类型是文章详情的时候需要选择关联文章',
|
// 'message' => '文章类型是文章详情的时候需要选择关联文章',
|
||||||
]);
|
// ]);
|
||||||
|
//
|
||||||
return back()->withInput()->with(compact('error'));
|
// return back()->withInput()->with(compact('error'));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
public function show(Article $article)
|
public function show(Article $article)
|
||||||
{
|
{
|
||||||
|
if ($article->url) {
|
||||||
|
return redirect($article->url);
|
||||||
|
}
|
||||||
|
|
||||||
$category = $article->category;
|
$category = $article->category;
|
||||||
|
|
||||||
return view('articles.show', compact('article', 'category'));
|
return view('articles.show', compact('article', 'category'));
|
||||||
|
|||||||
@@ -16,47 +16,49 @@ class IndexController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
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])
|
->whereNotIn('category_id', [20, 21, 22])
|
||||||
->take(7)
|
->take(7)
|
||||||
->get();
|
->get();
|
||||||
//最新资讯
|
// dd($all_articles->toArray());
|
||||||
|
//单位概况
|
||||||
$danwei = Article::where('category_id', 15)
|
$danwei = Article::where('category_id', 15)
|
||||||
->latest()
|
->latest()
|
||||||
->first();
|
->first();
|
||||||
//单位概况
|
//养生保健
|
||||||
$ysbj = Article::where('category_id', 12)
|
$ysbj = Article::where('category_id', 12)
|
||||||
->latest()
|
->latest()
|
||||||
->take(3)
|
->take(3)
|
||||||
->get();
|
->get();
|
||||||
//养生保健
|
//调研与分析
|
||||||
$dcyfx = Article::where('category_id', 10)
|
$dcyfx = Article::where('category_id', 10)
|
||||||
->latest()
|
->latest()
|
||||||
->take(7)
|
->take(7)
|
||||||
->get();
|
->get();
|
||||||
//调研与分析
|
//应用基础研究
|
||||||
$yyjcyj = Article::where('category_id', 9)
|
$yyjcyj = Article::where('category_id', 9)
|
||||||
->latest()
|
->latest()
|
||||||
->take(7)
|
->take(7)
|
||||||
->get();
|
->get();
|
||||||
//应用基础研究
|
//技术研讨
|
||||||
$jsyt = Article::where('category_id', 11)
|
$jsyt = Article::where('category_id', 11)
|
||||||
->latest()
|
->latest()
|
||||||
->take(7)
|
->take(7)
|
||||||
->get();
|
->get();
|
||||||
//技术研讨
|
//科研与应用
|
||||||
$kyyyy = Article::where('category_id', 12)
|
$kyyyy = Article::where('category_id', 12)
|
||||||
->latest()
|
->latest()
|
||||||
->take(7)
|
->take(7)
|
||||||
->get();
|
->get();
|
||||||
//科研与应用
|
//全科医学
|
||||||
$qkys = Article::where('category_id', 13)
|
$qkys = Article::where('category_id', 13)
|
||||||
->latest()
|
->latest()
|
||||||
->take(7)
|
->take(7)
|
||||||
->get();
|
->get();
|
||||||
//全科医学
|
|
||||||
$center_advert = Advert::where('category_id', 18)->first();
|
$center_advert = Advert::where('category_id', 18)->first();
|
||||||
//期刊
|
//期刊
|
||||||
$qikan_advert = ArticlePicture::latest()->take(4)->where('category_id', 23)->get();
|
$qikan_advert = ArticlePicture::latest()->take(4)->where('category_id', 23)->get();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
/* CSS Document */
|
/* CSS Document */
|
||||||
*{ margin:0; padding:0}
|
*{ margin:0; padding:0}
|
||||||
ul li{ list-style:none}
|
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 .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 .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 .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}
|
.pagebox{ text-align:center; padding-top:30px; padding-bottom:50px}
|
||||||
|
|||||||
Reference in New Issue
Block a user