diff --git a/app/Admin/Controllers/Article/ArticleController.php b/app/Admin/Controllers/Article/ArticleController.php index d8c2dca..923622e 100644 --- a/app/Admin/Controllers/Article/ArticleController.php +++ b/app/Admin/Controllers/Article/ArticleController.php @@ -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; diff --git a/app/Admin/Controllers/Category/IndexController.php b/app/Admin/Controllers/Category/IndexController.php index 9300e42..0eb1159 100644 --- a/app/Admin/Controllers/Category/IndexController.php +++ b/app/Admin/Controllers/Category/IndexController.php @@ -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')); + // } + // } }); diff --git a/app/Http/Controllers/ArticleController.php b/app/Http/Controllers/ArticleController.php index bc45aab..af693ca 100644 --- a/app/Http/Controllers/ArticleController.php +++ b/app/Http/Controllers/ArticleController.php @@ -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')); diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 27cc90e..8166f49 100644 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -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(); diff --git a/public/assets/index/css/style.css b/public/assets/index/css/style.css index a5c124d..cbae3f8 100644 --- a/public/assets/index/css/style.css +++ b/public/assets/index/css/style.css @@ -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} diff --git a/resources/views/index/index.blade.php b/resources/views/index/index.blade.php index 6bbd49b..7a9985a 100644 --- a/resources/views/index/index.blade.php +++ b/resources/views/index/index.blade.php @@ -66,16 +66,16 @@

期刊简介

/ INTRODUCTION OF THE JOURNAL - 更多 > + 更多 >
- @if ($danwei) {{ $danwei->description }} @endif + @if ($danwei) {{ $danwei->description }} @endif
- +