diff --git a/app/Admin/Controllers/Advert/IndexController.php b/app/Admin/Controllers/Advert/IndexController.php index 4664171..8c1cf66 100644 --- a/app/Admin/Controllers/Advert/IndexController.php +++ b/app/Admin/Controllers/Advert/IndexController.php @@ -45,35 +45,39 @@ class IndexController extends AdminController * Make a form builder. * @return Form */ - protected function form() + protected function form(): Form { $form = new Form(new Advert); $form->text('title', '广告名称')->required(); $form->select('category_id', '所属分类') - ->options(Category::selectOptions(function ($model) { - return $model->where('status', 1)->where('type', Category::TYPE_ADVERT); - }, '选择分类')) - ->rules('required|min:1', [ - 'required' => '必须选择所属分类', - 'min' => '必须选择所属分类', - ]); + ->options(function () { + return Category::query() + ->where('status', 1) + ->where('type', Category::TYPE_ADVERT) + ->pluck('title', 'id'); + }) + ->rules('required|min:1', [ + 'required' => '必须选择所属分类', + 'min' => '必须选择所属分类', + ]); + $form->image('cover', '封面图片') - ->rules(function ($form) { - if ($form->model()->cover != []) { - return 'nullable|image'; - } else { - return 'required'; - } - }) - ->move('images/' . date('Y/m/d')) - ->removable() - ->uniqueName(); + ->rules(function ($form) { + if ($form->model()->cover != []) { + return 'nullable|image'; + } else { + return 'required'; + } + }) + ->move('images/' . date('Y/m/d')) + ->removable() + ->uniqueName(); $form->text('url', '链接地址'); $form->number('sort', '排序') - ->default(1) - ->required() - ->help('数字越大越靠前'); + ->default(1) + ->required() + ->help('数字越大越靠前'); return $form; } diff --git a/app/Admin/Controllers/Article/IndexController.php b/app/Admin/Controllers/Article/IndexController.php index 030c54f..3471ac4 100644 --- a/app/Admin/Controllers/Article/IndexController.php +++ b/app/Admin/Controllers/Article/IndexController.php @@ -5,6 +5,7 @@ namespace App\Admin\Controllers\Article; use App\Admin\Selectable\CategorySelectAble; use App\Models\Article; use App\Models\Category; +use App\Models\CategoryOld; use Encore\Admin\Controllers\AdminController; use Encore\Admin\Form; use Encore\Admin\Grid; @@ -24,6 +25,7 @@ class IndexController extends AdminController $filter->equal('category_id', '所属分类')->select(Category::selectOptions(function ($model) { return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]); }, '所有分类')); + }); $filter->disableIdFilter(); @@ -32,6 +34,7 @@ class IndexController extends AdminController $grid->column('id', '#ID#'); $grid->column('cover', '封面图片')->image('', 100); $grid->column('category.title', '所属分类'); + $grid->column('category_old.title', '所属老分类'); $grid->column('title', '文章标题'); $states = [ 'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'], @@ -50,10 +53,11 @@ class IndexController extends AdminController $form->text('title', '文章标题')->rules('min:2'); $form->text('remark', '子标题'); - $form->select('category_id', '上级分类') + $form->select('category_id', '所属分类') ->options(Category::selectOptions(function ($model) { return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]); }, '一级分类')); + $form->textarea('description', '内容简介'); $form->image('cover', '封面') ->move('images/' . date('Y/m/d')) diff --git a/app/Admin/Controllers/Article/OldController.php b/app/Admin/Controllers/Article/OldController.php new file mode 100644 index 0000000..8d9e0ed --- /dev/null +++ b/app/Admin/Controllers/Article/OldController.php @@ -0,0 +1,82 @@ +model()->orderBy('id', 'desc'); + $grid->filter(function ($filter) { + $filter->column(1 / 2, function ($filter) { + $filter->like('title', '文章标题'); + $filter->equal('category_id', '所属分类')->select(Category::selectOptions(function ($model) { + return $model->where('status', 1) + ->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]); + }, '所有分类')); + }); + + $filter->disableIdFilter(); + }); + + $grid->column('id', '#ID#'); + $grid->column('cover', '封面图片')->image('', 100); + $grid->column('category.title', '所属分类'); + $grid->column('title', '文章标题'); + $states = [ + 'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'], + 'off' => ['value' => 2, 'text' => '关闭', 'color' => 'default'], + ]; + $grid->column('status', '状态')->switch($states); + $grid->column('sort', '序号'); + $grid->column('测试')->display(function () { + $cids = $this->categories()->pluck('id')->toArray(); + if (empty($this->category_id) && !empty($cids)) { + $this->category_id = $cids[0]; + $this->save(); + } + }); + $grid->column('created_at', '创建时间'); + + return $grid; + } + + public function form() + { + $form = new Form(new ArticleOld); + + $form->text('title', '文章标题')->rules('min:2'); + $form->text('remark', '子标题'); + $form->select('category_id', '上级分类') + ->options(Category::selectOptions(function ($model) { + return $model->where('status', 1)->whereIn('type', [Category::TYPE_ArticleOld, Category::TYPE_SHOW]); + }, '一级分类')); + $form->textarea('description', '内容简介'); + $form->image('cover', '封面') + ->move('images/' . date('Y/m/d')) + ->removable() + ->uniqueName(); + $form->ueditor('content', '文章内容')->rules('required', ['required' => '详情不能为空']); + $form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先'); + $states = [ + 'on' => ['value' => 1, 'text' => '打开', 'color' => 'success'], + 'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'], + ]; + $form->datetime('created_at', '发布时间'); + $form->switch('status', '状态')->states($states)->default(1); + + return $form; + } + +} diff --git a/app/Admin/Controllers/Category/IndexController.php b/app/Admin/Controllers/Category/IndexController.php index 8faa25d..22162ef 100644 --- a/app/Admin/Controllers/Category/IndexController.php +++ b/app/Admin/Controllers/Category/IndexController.php @@ -39,7 +39,7 @@ class IndexController extends AdminController ->when('show', function (WidgetsForm $form) { $form->select('article_id', '关联文章') ->options(function ($option, $info) { - return Article::whereHas('categories', function ($q) { + return Article::whereHas('category', function ($q) { $q->where('type', 'show'); })->pluck('title', 'id'); })->help('当分类类型是文章详情的时候需要选择关联文章'); @@ -109,7 +109,7 @@ class IndexController extends AdminController ->when('show', function (Form $form) { $form->select('article_id', '关联文章') ->options(function ($option, $info) { - return Article::whereHas('categories', function ($q) { + return Article::whereHas('category', function ($q) { $q->where('type', 'show'); })->pluck('title', 'id'); })->help('当分类类型是文章详情的时候需要选择关联文章'); diff --git a/app/Admin/Controllers/Category/OldController.php b/app/Admin/Controllers/Category/OldController.php new file mode 100644 index 0000000..db1696d --- /dev/null +++ b/app/Admin/Controllers/Category/OldController.php @@ -0,0 +1,155 @@ +column(6, $this->treeView()); + + $row->column(6, function (Column $column) { + $form = new WidgetsForm(); + + $form->select('parent_id', '上级分类')->options(CategoryOld::selectOptions(function ($model) { + return $model->where('status', 1); + }, '一级分类')); + $form->text('title', '分类名称')->rules('required'); + $form->text('alias', '别名'); + $form->select('type', '分类类型') + ->options(CategoryOld::TYPES) + ->when('show', function (WidgetsForm $form) { + $form->select('article_id', '关联文章') + ->options(function ($option, $info) { + return Article::whereHas('categories', function ($q) { + $q->where('type', 'show'); + })->pluck('title', 'id'); + })->help('当分类类型是文章详情的时候需要选择关联文章'); + }) + ->required(); + $form->textarea('description', '分类简介') + ->rules('nullable'); + $form->image('logo', 'Logo') + ->move('logos/' . date('Y/m/d')) + ->removable() + ->uniqueName(); + $form->image('cover', '封面') + ->move('images/' . date('Y/m/d')) + ->removable() + ->uniqueName(); + $form->text('template', '模板'); + $form->number('order', '排序')->default(0); + $form->switch('top_show', '顶部导航显示')->states()->default(0); + $form->switch('status', '显示')->states()->default(1); + $form->action(admin_url('categories')); + + $column->append((new Box('新增分类', $form))->style('success')); + }); + }; + } + + /** + * @return Tree + */ + protected function treeView() + { + return CategoryOld::tree(function (Tree $tree) { + $tree->disableCreate(); + + $tree->branch(function ($branch) { + if ($branch['status'] == 1) { + $payload = " "; + } else { + $payload = " "; + } + $payload .= " [ID:{$branch['id']}] - "; + $payload .= " {$branch['title']} "; + $payload .= " {$branch['alias']} "; + $payload .= " {$branch['type']} "; + $payload .= " {$branch['template']}"; + + return $payload; + }); + }); + } + + /** + * Make a form builder. + * @return Form + */ + protected function form(): Form + { + $form = new Form(new CategoryOld); + + $form->select('parent_id', '上级分类')->options(CategoryOld::selectOptions(function ($model) { + return $model->where('status', 1); + }, '一级分类')); + $form->text('title', '分类名称')->rules('required'); + $form->text('alias', '别名'); + $form->select('type', '分类类型') + ->options(CategoryOld::TYPES) + ->when('show', function (Form $form) { + $form->select('article_id', '关联文章') + ->options(function ($option, $info) { + return Article::whereHas('categories', function ($q) { + $q->where('type', 'show'); + })->pluck('title', 'id'); + })->help('当分类类型是文章详情的时候需要选择关联文章'); + }) + ->required() + ->rules('required'); + $form->textarea('description', '分类简介')->rows(4)->rules('nullable'); + $form->image('logo', 'Logo') + ->move('logos/' . date('Y/m/d')) + ->removable() + ->uniqueName(); + $form->image('cover', '封面') + ->move('images/' . date('Y/m/d')) + ->removable() + ->uniqueName(); + $form->text('template', '模板'); + $form->number('order', '排序')->default(0)->help('正序优先'); + $form->switch('top_show', '顶部导航显示')->states()->default(0); + $form->switch('status', '显示')->states()->default(1); + $form->saving(function (Form $form) { + + if (request()->has('title')) { + // if (request()->type == CategoryOld::TYPE_SHOW && empty(request()->article_id)) { + // $error = new MessageBag([ + // 'title' => '错误', + // 'message' => '文章类型是文章详情的时候需要选择关联文章', + // ]); + // + // return back()->withInput()->with(compact('error')); + // } + } + + }); + + return $form; + } + + public function destroy($id) + { + return $this->form()->destroy($id); + } + +} diff --git a/app/Admin/Controllers/Video/IndexController.php b/app/Admin/Controllers/Video/IndexController.php index 9b0efbe..9e59945 100644 --- a/app/Admin/Controllers/Video/IndexController.php +++ b/app/Admin/Controllers/Video/IndexController.php @@ -50,9 +50,12 @@ class IndexController extends AdminController $form->text('title', '视频名称')->required(); $form->select('category_id', '所属分类') - ->options(Category::selectOptions(function ($model) { - return $model->where('status', 1); - }, '选择分类')) + ->options(function () { + return Category::query() + ->where('status', 1) + ->where('type', Category::TYPE_VIDEO) + ->pluck('title', 'id'); + }) ->rules('required|min:1', [ 'required' => '必须选择所属分类', 'min' => '必须选择所属分类', diff --git a/app/Admin/Routes/category.php b/app/Admin/Routes/category.php index 2f4c852..4e68853 100644 --- a/app/Admin/Routes/category.php +++ b/app/Admin/Routes/category.php @@ -8,5 +8,6 @@ Route::group([ 'middleware' => config('admin.route.middleware'), ], function (Router $router) { $router->resource('categories', 'IndexController'); + $router->resource('categorie_olds', 'OldController'); }); diff --git a/app/Helpers/function.php b/app/Helpers/function.php index 2f32526..972feb1 100644 --- a/app/Helpers/function.php +++ b/app/Helpers/function.php @@ -84,7 +84,7 @@ function getCateChild($categoryId) { return Category::where('status', 1) ->where('parent_id', $categoryId) - ->orderBy('order', 'asc') + ->orderBy('order', 'desc') ->get(); } @@ -126,6 +126,14 @@ function getOneAdvertByCate($categoryId, $result = '') } } +function getAdvertsByCate($categoryId, $take = '8') +{ + return Advert::where('category_id', $categoryId) + ->latest() + ->take($take) + ->get(); +} + function getVideoByCate($categoryId, $result = '') { $video = Video::where('category_id', $categoryId) @@ -151,3 +159,24 @@ function getVideosByCate($categoryId, $take = '8') ->get(); } +function dateLocalMonth($m) +{ + $months = [ + '1' => '一月', + '2' => '二月', + '3' => '三月', + '4' => '四月', + '5' => '五月', + '6' => '六月', + '7' => '七月', + '8' => '八月', + '9' => '九月', + '10' => '十月', + '11' => '十一月', + '12' => '十二月', + ]; + + return $months[$m] ?? $m; + +} + diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index dc08d5d..1a692c1 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\Advert; use App\Models\Category; +use Carbon\Carbon; class CategoryController extends Controller { @@ -11,7 +12,7 @@ class CategoryController extends Controller /** * 显示分类 * @param Category $category [description] - * @return [type] [description] + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View [type] [description] */ public function index(Category $category) { diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 9eaf7db..31d0c50 100644 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -6,6 +6,7 @@ use App\Models\Advert; use App\Models\Article; use App\Models\Category; use App\Models\Link; +use Illuminate\Http\Request; class IndexController extends Controller { @@ -24,15 +25,12 @@ class IndexController extends Controller return view('index.index', compact('top_adverts', 'top_adverts')); } - //通用获取文章 - public function getArticle($category_ids, $take = 3) + public function search(Request $request) { - return Article::where('status', 1) - ->ByCategory($category_ids) - ->select('id', 'description', 'title', 'created_at', 'cover', 'content') - ->orderBy('created_at', 'desc') - ->take($take) - ->get(); + $title = $request->title; + $articles = Article::query()->where('title', 'like', "%{$title}%")->paginate(); + + return view('index.search', compact('articles')); } } diff --git a/app/Models/Article.php b/app/Models/Article.php index 2c937b5..0dec20c 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -76,6 +76,11 @@ class Article extends Model return $this->belongsTo(Category::class); } + public function category_old(): BelongsTo + { + return $this->belongsTo(CategoryOld::class); + } + /** * Notes: description * @Author: 玄尘 diff --git a/app/Models/ArticleOld.php b/app/Models/ArticleOld.php new file mode 100644 index 0000000..2a500ea --- /dev/null +++ b/app/Models/ArticleOld.php @@ -0,0 +1,100 @@ +].*?>/isU", str_ireplace("\\", "", $this->content), $matches); + + if (isset($matches[1])) { + return $matches[1]; + } else { + return ''; + } + } + + /** + * Notes: 获取一个默认图片 + * @Author: 玄尘 + * @Date : 2020/6/3 16:29 + * @return mixed|string + */ + public function get_one_cover() + { + if ($this->cover_url) { + $path = $this->cover_url; + } else { + $path = $this->get_content_cover(); + if ($path) { + $this->cover = str_replace("/storage", "", $path); + $this->save(); + $path = config('app.url') . $path; + + } + + } + + return $path; + + } + + /** + * Notes: 关联分类 + * @Author: 玄尘 + * @Date : 2021/4/2 9:11 + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function categories(): BelongsToMany + { + return $this->belongsToMany(CategoryOld::class, 'article_old_category') + ->using(ArticleOldCategory::class); + } + + public function category(): BelongsTo + { + return $this->belongsTo(CategoryOld::class); + } + + /** + * Notes: description + * @Author: 玄尘 + * @Date : 2021/4/2 9:17 + * @param $query + * @param $ids + * @return mixed + */ + public function scopeByCategory($query, $ids) + { + if (!is_array($ids)) { + $ids = [$ids]; + } + + return $query->whereIn('category_id', $ids); + // + // return $query->whereHas('categories', function ($q) use ($ids) { + // $q->whereIN('id', $ids); + // }); + } + +} diff --git a/app/Models/ArticleOldCategory.php b/app/Models/ArticleOldCategory.php new file mode 100644 index 0000000..deb9ec5 --- /dev/null +++ b/app/Models/ArticleOldCategory.php @@ -0,0 +1,11 @@ +", $this->description); - - return Str::replaceArray('\n', ['
'], $this->description); } } diff --git a/app/Models/CategoryOld.php b/app/Models/CategoryOld.php new file mode 100644 index 0000000..b4b5899 --- /dev/null +++ b/app/Models/CategoryOld.php @@ -0,0 +1,119 @@ + '文章列表', + self::TYPE_SHOW => '文章详情', + self::TYPE_ADVERT => '图片列表', + self::TYPE_VIDEO => '视频列表', + ]; + + public $cover_field = 'cover'; + + public function getLogoUrlAttribute(): string + { + return $this->parseImageUrl($this->logo); + } + + public function getLinkAttribute(): string + { + return route('category.show', $this); + } + + /** + * 关联的数据 + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|\Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\HasOne|null [type] [description] + */ + public function relations() + { + switch ($this->type) { + case self::TYPE_SHOW: + return $this->hasOne(Article::class)->where('id', $this->article_id); + break; + case self::TYPE_ARTICLE: + return $this->belongsToMany(Article::class); + break; + case self::TYPE_ADVERT: + return $this->hasMany(Advert::class); + break; + case self::TYPE_VIDEO: + return $this->hasMany(Video::class); + break; + default: + return null; + } + } + + public function childrens(): HasMany + { + return $this->hasMany(self::class, 'parent_id'); + } + + public function parent(): HasOne + { + return $this->hasOne(self::class, 'id', 'parent_id'); + } + + public function article(): BelongsTo + { + return $this->belongsTo(Article::class); + } + + /** + * Notes: 获取当前分类及子分类ID + * @Author: + * @Date : 2020/4/6 3:12 下午 + * @return array + */ + public function getAllChildrenId(): array + { + $ids = array_keys($this->buildSelectOptions([], $this->id)); + if ($ids) { + array_unshift($ids, $this->id); + + return $ids; + } + + return []; + } + + // public function articles(): BelongsToMany + // { + // return $this->belongsToMany(Article::class); + // } + + public function articles(): HasMany + { + return $this->hasMany(Article::class); + } + + /** + * Notes: 格式化description + * @Author: 玄尘 + * @Date : 2021/10/8 15:24 + */ + public function getDescriptionHtmlAttribute(): string + { + return str_replace("\n", "
", $this->description); + } + +} diff --git a/public/assets/index/css/style.css b/public/assets/index/css/style.css index 3b4f72a..9f3224c 100644 --- a/public/assets/index/css/style.css +++ b/public/assets/index/css/style.css @@ -1,5 +1,5 @@ a:hover, a:link { - text-decoration:none; + text-decoration: none; } img { @@ -26,11 +26,11 @@ a, button { color: inherit; } -input,button,a, select { - outline:none +input, button, a, select { + outline: none } -select:focus{ +select:focus { outline: none; } @@ -39,7 +39,7 @@ body { font-size: 14px; } -.ce-img>span { +.ce-img > span { position: absolute; width: 100%; height: 100%; @@ -136,7 +136,7 @@ body { /*logo */ .navHead { - background-image: linear-gradient(6deg, rgba(237,246,248,.8), transparent); + background-image: linear-gradient(6deg, rgba(237, 246, 248, .8), transparent); } .navHead-search { @@ -157,7 +157,7 @@ body { width: calc(100% - 52px); } -.navHead-search input::-webkit-input-placeholder{ +.navHead-search input::-webkit-input-placeholder { color: #449942; font-size: 15px; } @@ -420,9 +420,9 @@ body { .modularThree-back { background-color: #fff; - box-shadow: 0px 0 20px rgba(0,0,0,.1); + box-shadow: 0px 0 20px rgba(0, 0, 0, .1); padding: 15px; - border-radius:4px; + border-radius: 4px; box-sizing: border-box; } @@ -580,7 +580,7 @@ body { left: 0; bottom: 0; z-index: 1; - background-color: rgba(0,0,0,.5); + background-color: rgba(0, 0, 0, .5); color: #fff; } @@ -592,7 +592,7 @@ body { background-color: #f1f2f7; text-align: center; height: 110px; - display:table; + display: table; width: 100%; font-size: 17px; margin-bottom: 20px; @@ -601,7 +601,7 @@ body { .modularSix-padding:nth-child(13) .modularSix-label, .modularSix-padding:nth-child(14) .modularSix-label, -.modularSix-padding:nth-child(15) .modularSix-label{ +.modularSix-padding:nth-child(15) .modularSix-label { margin-bottom: 0; } @@ -610,7 +610,7 @@ body { color: #ffffff; } -.modularSix-padding:last-child .modularSix-label img{ +.modularSix-padding:last-child .modularSix-label img { filter: grayscale(100) brightness(200%); } @@ -627,8 +627,8 @@ body { } .modularSix-label-cont { - display:table-cell; - vertical-align:middle + display: table-cell; + vertical-align: middle } .modularSix-padding { @@ -703,7 +703,7 @@ body { /*首页-模块八*/ .modularEight-label { background-position: center; - background-size:cover; + background-size: cover; background-repeat: no-repeat; width: 100%; height: 120px; @@ -723,7 +723,7 @@ body { text-align: center; padding: 15px 0; box-sizing: border-box; - background-color: rgba(255,255,255,.3); + background-color: rgba(255, 255, 255, .3); } @@ -739,13 +739,13 @@ body { /*二级页面-左侧内容*/ .levelLeft { - width: 100%; - background-image: url(../image/levelLeft-back.jpg); - background-repeat: repeat-y; - background-size: 100% 100%; - position: relative; - padding-bottom: 200px; - overflow: hidden; + width: 100%; + background-image: url(/assets/index/images/levelLeft-back.jpg); + background-repeat: repeat-y; + background-size: 100% 100%; + position: relative; + padding-bottom: 200px; + overflow: hidden; } .levelLeft-title { @@ -983,7 +983,7 @@ body { } .briefResearch-label:hover { - box-shadow: 0 0 15px rgba(0,0,0,.2); + box-shadow: 0 0 15px rgba(0, 0, 0, .2); color: #b9000e; } @@ -1020,6 +1020,7 @@ body { .briefHistoy-right-tool { text-align: right; + margin-bottom: 20px; } .briefHistoy-right-tool div { @@ -1041,7 +1042,7 @@ body { .briefHistoy-right-tool div.briefHistoy-yellow { border-radius: 4px; - padding: 0 30px; + padding: 0 10px; background-color: #e7ad00; } @@ -1108,7 +1109,7 @@ body { width: 100%; line-height: 34px; height: 34px; - background-color: rgba(0,0,0,.5); + background-color: rgba(0, 0, 0, .5); color: #fff; display: flex; } @@ -1145,12 +1146,12 @@ body { } .briefSwiper .swiper-button-next { - background-image: url(../image/briefIcon/briefAlbum_right.jpg); + background-image: url(/assets/index/images/briefIcon/briefAlbum_right.jpg); right: 20px; } .briefSwiper .swiper-button-prev { - background-image: url(../image/briefIcon/briefAlbum_left.jpg); + background-image: url(/assets/index/images/briefIcon/briefAlbum_left.jpg); left: 20px; } @@ -1172,7 +1173,7 @@ body { width: 14px; height: 14px; top: calc(50% - 7px); - background-image: url(../image/briefIcon/briefAlbum_title_icon.png); + background-image: url(/assets/index/images/briefIcon/briefAlbum_title_icon.png); background-repeat: no-repeat; background-position: center; } @@ -1196,7 +1197,7 @@ body { padding: 0 20px; height: 66px; line-height: 66px; - box-sizing:border-box; + box-sizing: border-box; width: 100%; position: relative; display: flex; @@ -1328,7 +1329,7 @@ body { .srBuildOther-back::after { position: absolute; content: ''; - background-color: rgba(0,0,0,.4); + background-color: rgba(0, 0, 0, .4); width: 100%; height: 100%; left: 0; @@ -1350,7 +1351,7 @@ body { .srBuildFrist-text { font-size: 12px; height: 50px; - -webkit-line-clamp: 3; + -webkit-line-clamp: 3; } .srBuildFrist-name { @@ -1421,7 +1422,7 @@ body { background-repeat: no-repeat; background-position: bottom center; background-size: 100%; - box-shadow: 0 0 15px rgba(0,0,0,.1); + box-shadow: 0 0 15px rgba(0, 0, 0, .1); cursor: pointer; margin-bottom: 30px; } @@ -1797,7 +1798,7 @@ body { padding-bottom: 10px; } -.ranks-title img { +.ranks-title img { margin-right: 10px; } @@ -1845,7 +1846,7 @@ body { line-height: 60px; text-align: center; flex: 3; - text-shadow: 2px 2px 2px rgba(2,84,0,1); + text-shadow: 2px 2px 2px rgba(2, 84, 0, 1); position: relative; } @@ -1967,8 +1968,8 @@ body { z-index: 5; width: 50%; padding: 20px; - box-sizing:border-box; - background-color:rgba(246,246,246, .9); + box-sizing: border-box; + background-color: rgba(246, 246, 246, .9); } .educateStudent-cont { @@ -1996,7 +1997,7 @@ body { bottom: 0; width: 18px; height: 10px; - background: url(../image/educateIcon.png) no-repeat center; + background: url(/assets/index/images/educateIcon.png) no-repeat center; } .educateStudent-cont-name span { @@ -2090,7 +2091,7 @@ body { } /*国际平台*/ -.terraceInter { +.terraceInter { margin-bottom: 6px; } @@ -2142,7 +2143,7 @@ body { padding: 0; } -.terraceHome-left{ +.terraceHome-left { position: relative; width: 100%; padding-top: 200%; @@ -2158,7 +2159,7 @@ body { .terraceHome-right-img { position: relative; width: 50%; - padding-top:50%; + padding-top: 50%; } .terraceHome-label li { @@ -2249,8 +2250,8 @@ body { height: 50px; } -.terraceHome-cont>div::after, -.terraceHome-left-cont>div::after { +.terraceHome-cont > div::after, +.terraceHome-left-cont > div::after { position: absolute; content: ''; left: calc(50% - 20px); @@ -2361,7 +2362,7 @@ body { .party-title span { width: 230px; - background: url(../image/partyTitle.png) no-repeat left; + background: url(/assets/index/images/partyTitle.png) no-repeat left; background-size: 100% 100%; display: inline-block; padding: 0 20px; @@ -2428,7 +2429,7 @@ body { /*精神文明建设*/ .partyBuild-left { - box-shadow: 0px 0 20px rgba(0,0,0,.1); + box-shadow: 0px 0 20px rgba(0, 0, 0, .1); } .partyBuild-left-img { @@ -2540,7 +2541,7 @@ body { .partyVideo-text { width: 100%; position: absolute; - padding-top:100%; + padding-top: 100%; } .partyVideo-text span { @@ -2551,7 +2552,7 @@ body { top: 0; left: 0; height: 100%; - letter-spacing: 4px; + letter-spacing: 4px; text-align: center; display: -webkit-box; -webkit-box-orient: horizontal; @@ -2573,7 +2574,7 @@ body { margin-bottom: 20px; } -.learn-title>span { +.learn-title > span { position: relative; font-size: 14px; font-weight: normal; @@ -2583,7 +2584,7 @@ body { padding-top: 6px; } -.learn-title>span::after { +.learn-title > span::after { position: absolute; content: ''; left: 0; @@ -2842,7 +2843,7 @@ body { border-radius: 4px; } -.pagination>li { +.pagination > li { display: inline; } @@ -2869,21 +2870,31 @@ body { height: 1px; } -.pagination>li>a { +.pagination > li > a { padding: 8px 18px; font-size: 16px; } -.pagination>.active>a, .pagination>.active>a:focus, .pagination>.active>a:hover, .pagination>.active>span, .pagination>.active>span:focus, .pagination>.active>span:hover{ +.pagination > .active > a, .pagination > .active > a:focus, .pagination > .active > a:hover, .pagination > .active > span, .pagination > .active > span:focus, .pagination > .active > span:hover { background-color: #449942; border-color: #449942; } -.pagination>li>a, .pagination>li>span, -.pagination>li>a:focus, - .pagination>li>a:hover{ +.pagination > li > a, .pagination > li > span, +.pagination > li > a:focus, +.pagination > li > a:hover { color: #449942; } -.no-searchCont {padding: 120px 0; text-align: center; font-size: 22px; color: #999;} -.no-searchCont img {width: 200px; display: block; margin: 0 auto 20px;} +.no-searchCont { + padding: 120px 0; + text-align: center; + font-size: 22px; + color: #999; +} + +.no-searchCont img { + width: 200px; + display: block; + margin: 0 auto 20px; +} diff --git a/resources/views/category/djwh.blade.php b/resources/views/category/djwh.blade.php index 4a45bb4..b88d0ba 100644 --- a/resources/views/category/djwh.blade.php +++ b/resources/views/category/djwh.blade.php @@ -17,55 +17,29 @@
- 党团活动 -
更多>>
+ {{ getOneCategory(60,'title') }} +
更多>>
-
-
-
- - -
-
-
三江平原湿地生物多样性定位研究站
-
2021-07-09
-
- 黑龙江省科学院生物多样性重点实验室于1999年由黑龙江省科学院批准成立,实验室隶属于黑龙江省科学院自然与生态研究所。 + @if (getArticlesBYCate(60,3)->isNotEmpty()) + @foreach (getArticlesBYCate(60,3) as $info) +
+
+
+ + +
+
+
{{ $info->title }}
+
{{ $info->created_at->toDateString() }}
+
+ {{ $info->description }} +
+
-
-
-
-
-
- - -
-
-
三江平原湿地生物多样性定位研究站
-
2021-07-09
-
- 黑龙江省科学院生物多样性重点实验室于1999年由黑龙江省科学院批准成立,实验室隶属于黑龙江省科学院自然与生态研究所。 -
-
-
-
-
-
-
- - -
-
-
三江平原湿地生物多样性定位研究站
-
2021-07-09
-
- 黑龙江省科学院生物多样性重点实验室于1999年由黑龙江省科学院批准成立,实验室隶属于黑龙江省科学院自然与生态研究所。 -
-
-
-
+ @endforeach + @endif
@@ -73,61 +47,52 @@
- 精神文明建设 -
更多>>
+ {{ getOneCategory(61,'title') }} +
更多>>
-
-
-
- - -
-
-
- 五月06 + @if (getArticlesBYCate(61,3)->isNotEmpty()) + @foreach (getArticlesBYCate(61,3) as $info) + @if($loop->iteration==1) +
+
+
+ + +
+
+
+ {{ dateLocalMonth($info->created_at->format('m')) }} + {{ $info->created_at->format('d') }} +
+
{{ $info->title }}
+
+ {{ $info->description }} +
+
+
-
庆祝中国共产党成立100周年
-
- 2021年7月1日上午8时,庆祝中国共产党成立100周年大会在北京天安门广场隆重举行。 -
-
-
-
+ @endif + + @endforeach + @endif
-
-
- 五月01 -
-
黑龙江黑河国家森林生态系统定位观测研究站
-
-
-
- 五月05 -
-
黑龙江省林下经济资源研发与利用协同创新中心
-
-
-
- 五月06 -
-
- 联合国教科文组织国际自然与文化遗产空间技术中心哈尔滨分中心 -
-
-
-
- 五月07 -
-
黑龙江省特色动植物利用工程技术研究中心
-
-
-
- 五月08 -
-
黑龙江省中国科学院马克平生物多样性工作室
-
+ @if (getArticlesBYCate(61,3)->isNotEmpty()) + @foreach (getArticlesBYCate(61,3) as $info) + @if($loop->iteration>1) +
+
+ {{ dateLocalMonth($info->created_at->format('m')) }} + {{ $info->created_at->format('d') }} +
+
+ {{ $info->title }} +
+
+ @endif + @endforeach + @endif
@@ -137,22 +102,24 @@
- 党建风采视频 -
更多>>
+ {{ getOneCategory(62,'title') }} +
更多>>
- +
- 党建风采视频 + {{ getOneCategory(62,'title') }}
diff --git a/resources/views/category/jianjie.blade.php b/resources/views/category/jianjie.blade.php index 42d990a..2e3983f 100644 --- a/resources/views/category/jianjie.blade.php +++ b/resources/views/category/jianjie.blade.php @@ -146,7 +146,7 @@ data-href="{{ $info->link }}" > {{ $info->title }} - +
@endforeach @@ -176,63 +176,40 @@
-
-
四十周年所庆纪念册
-
-
-
-
-
- -
-
- 四十周年所庆图片册 -
-
- 查看详情 + + @if (getAdvertsByCate(16,10)->isNotEmpty()) + +
+
四十周年所庆纪念册
+
+
+ @foreach (getAdvertsByCate(16,10) as $info) +
+
+
+ +
+
+ {{ $info->title }} +
+
+ 查看详情 +
+
-
-
-
-
-
- -
-
- 四十周年所庆图片册 -
-
- 查看详情 -
-
-
-
-
-
-
-
- -
-
- 四十周年所庆图片册 -
-
- 查看详情 -
-
-
-
+ @endforeach
+ +
+
- -
-
-
- + @endif + +
diff --git a/resources/views/category/kjpt.blade.php b/resources/views/category/kjpt.blade.php index 69f4639..1ef5802 100644 --- a/resources/views/category/kjpt.blade.php +++ b/resources/views/category/kjpt.blade.php @@ -17,114 +17,102 @@
- 国际平台 + + {{ getOneCategory(55,'title') }} +
-
-
-
- 国际森林生物多样性检测网络寒温带森林样区 -
-
- - -
-
-
-
-
-
- 中国-芬兰浆果研究技术中心 -
-
- - -
-
-
-
-
-
- 国际森林生物多样性检测网络寒温带森林样区 -
-
- - -
-
-
-
-
-
- 中俄五大连池-贝加尔湖新生代火山与环境研究中心 -
-
- - -
-
-
-
-
-
-
-
- 联合国教科文组织国际自然与文化遗产空间技术中心哈尔滨分中心 -
-
- - -
+ @if (getArticlesBYCate(55,5)->isNotEmpty()) + @foreach (getArticlesBYCate(55,5) as $info) + @if($loop->iteration<5) +
+
+
+ {{ $info->title }} +
+
+ + +
+
+
+ @endif + @endforeach + @endif
+ @if (getArticlesBYCate(55,5)->isNotEmpty()) + @foreach (getArticlesBYCate(55,5) as $info) + @if($loop->iteration>4) +
+
+
+ {{ $info->title }} +
+
+ + +
+
+
+ @endif + @endforeach + @endif +
-
国家平台 +
+ + {{ getOneCategory(56,'title') }} +
-
-
-
- - -
-
-
- 湿地与生态保育国家地方联合工程实验室 + @if (getArticlesBYCate(56,3)->isNotEmpty()) + @foreach (getArticlesBYCate(56,3) as $info) + @if($loop->iteration==1) +
+
+
+ + +
+
+
+ {{ $info->title }} +
+
+
-
-
-
+ @endif + @endforeach + @endif +
    -
  • -
    - - -
    -
    -
    - 国家博士后科研工作站 -
    -
    -
  • -
  • -
    - -
    -
    -
    - 黑龙江黑河(五大连池)国家森林定位观测研究站 -
    -
    -
  • + @if (getArticlesBYCate(56,3)->isNotEmpty()) + @foreach (getArticlesBYCate(56,3) as $info) + @if($loop->iteration>1) +
  • +
    + + +
    +
    +
    + {{ $info->title }} +
    +
    +
  • + @endif + @endforeach + @endif
@@ -133,177 +121,84 @@
-
省级平台 +
+ + {{ getOneCategory(57,'title') }} +
-
-
-
- 黑龙江省湿地与恢复生态学重点实验室 + @if (getArticlesBYCate(57,6)->isNotEmpty()) + @foreach (getArticlesBYCate(57,6) as $info) +
+
+
+ {{ $info->title }} +
+
+ 省级 +
+
+ + +
+
-
- 省级 -
-
- - -
-
-
-
-
-
- 黑龙江省花卉中试基地 -
-
- 省级 -
-
- - -
-
-
-
-
-
- 国际森林生物多样性检测网络寒温带森林样区 -
-
- 省级 -
-
- - -
-
-
-
-
-
- 国际森林生物多样性检测网络寒温带森林样区 -
-
- 省级 -
-
- - -
-
-
-
-
-
- 国际森林生物多样性检测网络寒温带森林样区 -
-
- 省级 -
-
- - -
-
-
+ @endforeach + @endif
-
院级平台 +
+ + {{ getOneCategory(58,'title') }} +
-
-
-
- 黑龙江省科学院生物多样性重点实验室 + @if (getArticlesBYCate(58,3)->isNotEmpty()) + @foreach (getArticlesBYCate(58,3) as $info) +
+
+
+ {{ $info->title }} +
+
+ + +
+
-
- - -
-
-
+ @endforeach + @endif
-
定位研究站 +
+ + {{ getOneCategory(59,'title') }} +
-
-
-
- 黑龙江省科学院生物多样性重点实验室 + @if (getArticlesBYCate(59,6)->isNotEmpty()) + @foreach (getArticlesBYCate(59,6) as $info) +
+
+
+ {{ $info->title }} +
+
+ + +
+
-
- - -
-
-
-
-
-
- 三江平原湿地生物多样性 -
-
- - -
-
-
-
-
-
- 伊勒呼里山寒温带森林生物多样性 -
-
- - -
-
-
-
-
-
- 五大连池火山植物进化与植被生态 -
-
- - -
-
-
-
-
-
- 松嫩平原湿地生态 -
-
- - -
-
-
-
-
-
- 园林植物实验基地 -
-
- - -
-
-
+ @endforeach + @endif
diff --git a/resources/views/category/kxjs_rcdw.blade.php b/resources/views/category/kxjs_rcdw.blade.php index 37fbc09..23ca74a 100644 --- a/resources/views/category/kxjs_rcdw.blade.php +++ b/resources/views/category/kxjs_rcdw.blade.php @@ -95,40 +95,21 @@
- 专家学者 + + {{ getOneCategory(42,'title') }}
-
-
- 国务院特贴专家 -
-
-
-
- 国务院特贴专家 -
-
-
-
- 专家 -
-
-
-
- 青年学者 -
-
-
-
- 省级领军人才梯队专家 -
-
-
-
- 院级重点学科专家 -
-
+ + @if(getCateChild(42)->isNotEmpty()) + @foreach(getCateChild(42) as $cate) +
+
+ {{ $cate->title }} +
+
+ @endforeach + @endif
@@ -166,7 +147,6 @@
-
diff --git a/resources/views/category/kxyj.blade.php b/resources/views/category/kxyj.blade.php index 8908cb1..be79bc2 100644 --- a/resources/views/category/kxyj.blade.php +++ b/resources/views/category/kxyj.blade.php @@ -397,7 +397,6 @@
-
@endsection diff --git a/resources/views/category/navigation.blade.php b/resources/views/category/navigation.blade.php index 8d4d83d..58a2d8d 100644 --- a/resources/views/category/navigation.blade.php +++ b/resources/views/category/navigation.blade.php @@ -1,13 +1,15 @@ -
-
-
-
- 当前位置: -
- 首页 > - {{ $parent->title }} +@if(!empty($parent)) +
+
+
+
+ 当前位置: +
+ 首页 > + {{ $parent->title }} +
-
\ No newline at end of file +@endif diff --git a/resources/views/category/show.blade.php b/resources/views/category/show.blade.php index 4f88af9..fd66f16 100644 --- a/resources/views/category/show.blade.php +++ b/resources/views/category/show.blade.php @@ -17,10 +17,6 @@
    @foreach ($articles as $article) -
  • - {{ $article->title }}{{ $article->created_at->format('m-d') }} -
  • -
  • {{ $article->title }} diff --git a/resources/views/category/videos.blade.php b/resources/views/category/videos.blade.php new file mode 100644 index 0000000..a6bbba3 --- /dev/null +++ b/resources/views/category/videos.blade.php @@ -0,0 +1,23 @@ +@extends('layouts.app') + +@section('title', $parent->title) + +@section('content') + + @include('category.navigation') + + +
    +
    + + @include('category.left') + +
    +
    + 视频列表 +
    +
    +
    +
    +@endsection + diff --git a/resources/views/category/xh_qk.blade.php b/resources/views/category/xh_qk.blade.php new file mode 100644 index 0000000..4bc83ac --- /dev/null +++ b/resources/views/category/xh_qk.blade.php @@ -0,0 +1,93 @@ +@extends('layouts.app') + +@section('title', $parent->title) + +@section('content') + + @include('category.navigation') + + +
    +
    + + @include('category.left') + +
    +
    + +
    +
    + {{ getOneCategory(63,'title') }}{{ getOneCategory(63,'alias') }} +
    +
    +
    + @if(getOneCategory(63,'article')) + +
    +
    + +
    +
    + +
    +
    +
    +
    {{ getOneCategory(63,'article')->title }}
    +
    + {{ getOneCategory(63,'article')->description }} +
    +
    查看详情 +
    +
    + +
    +
    + @endif +
    +
    +
    + + + +
    +
    + {{ getOneCategory(64,'title') }}{{ getOneCategory(64,'alias') }} +
    +
    + +
    +
    +
    + @if(getOneCategory(64,'article')) +
    +
    {{ getOneCategory(63,'article')->title }}
    +
    +
    + 查看更多 +
    +
    + 征稿启事 +
    +
    +
    +
    +
    + +
    + {{ getOneCategory(64,'article')->description }} +
    +
    +
    + @endif +
    +
    +
    + +
    +
    +
    +
    +@endsection + diff --git a/resources/views/category/yh_qk.blade.php b/resources/views/category/yh_qk.blade.php deleted file mode 100644 index ec75a20..0000000 --- a/resources/views/category/yh_qk.blade.php +++ /dev/null @@ -1,84 +0,0 @@ -@extends('layouts.app') - -@section('title', $parent->title) - -@section('content') - - @include('category.navigation') - - -
    -
    - - @include('category.left') - -
    -
    - -
    -
    - 学会LEARN -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    党建文化-学会简介
    -
    - 近年来,中国银行西安长安路支行结合陕西红色文化特点和本行实际,坚持党建引领,文化铸魂,提倡“幸福中行,快乐员工”的文化理念,以加快转型发展,打造区域强行为突破口,形成了具有自身特色的企业文化,并将其渗透和服务于经营管理的全过程,实现了文化创造价值,党建与经营双丰收的目标。 -
    -
    查看详情
    -
    - -
    -
    -
    -
    -
    - - - -
    -
    - 期刊PERIODICAL -
    -
    - -
    -
    -
    -
    -
    党建文化-期刊
    -
    -
    查看更多 -
    -
    征稿启事 -
    -
    -
    -
    -
    - -
    - 近年来,中国银行西安长安路支行结合陕西红色文化特点和本行实际,坚持党建引领,文化铸魂,提倡“幸福中行,快乐员工”的文化理念,以加快转型发展,打造区域强行为突破口,形成了具有自身特色的企业文化,并将其渗透和服务于经营管理的全过程,实现了文化创造价值,党建与经营双丰收的目标。 -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -@endsection - diff --git a/resources/views/category/yjsjy.blade.php b/resources/views/category/yjsjy.blade.php index dd3994a..a01826a 100644 --- a/resources/views/category/yjsjy.blade.php +++ b/resources/views/category/yjsjy.blade.php @@ -16,46 +16,57 @@
    -
    研究生教育简介
    -
    -
    - 研究生教育简介/ Introduction to graduate education
    -
    - 研究生教育是学生本科毕业之后继续进行深造和学习的一种教育形式,又可分为硕士研究生教育和博士研究生教育。考生参加国家统一组织的硕士生入学考试(含应届本科毕业生的推荐免试和部分高等学校经教育部批准自行组织的单独入学考试),被录取后,并在毕业时,若课程学习和论文答辩均符合学位条例的规定,可获硕士生毕业证书和硕士学位证书。研究生学历教育分为普通研究生(双证,包含全日制研究生及非全日制研究生)、传统在职研究生(单证在职)。研究生学历教育的招生工作由教育部高校学生司负责 +
    {{ getOneCategory(54,'title') }}
    + @if(getOneCategory(54,'article')) +
    +
    + {{ getOneCategory(54,'article')->title }} + / Introduction to graduate education
    +
    + {{ getOneCategory(54,'article')->description }} +
    +
    更多>> +
    -
    更多>>
    -
    -
    -
    - - +
    +
    + + +
    -
    + @endif
    -
    硕士导师简介
    -
    -
    -
    - - +
    {{ getOneCategory(53,'title') }}
    + @if(getOneCategory(54,'article')) +
    +
    +
    + + +
    -
    -
    -
    - -
    硕士导师简介Introduction to master tutor +
    +
    + +
    + {{ getOneCategory(54,'article')->title }} + Introduction to master tutor +
    +
    +
    + {{ getOneCategory(54,'article')->description }} +
    +
    更多>>
    -
    - 硕士生导师,也叫硕士研究生导师,是指硕士研究生、硕士生的指导教师,属于研究生导师、研究生指导教师,包括学术学位硕士生导师、专业学位硕士生导师。硕士生导师应是本学科学术造诣较深的教授或相当专业技术职务的教学,科研人员,其学术水平在某些方面接近或达到国内或国际先进水平。有培养本科生经验,至少培养过两届本科生。能坚持正常工作,担负实际指导硕士生的责任。有课程教学经历,承担过或正在承担一定工作量的本科生课程。 -
    -
    更多>>
    -
    + @endif
    diff --git a/resources/views/index/search.blade.php b/resources/views/index/search.blade.php new file mode 100644 index 0000000..95d49fa --- /dev/null +++ b/resources/views/index/search.blade.php @@ -0,0 +1,45 @@ +@extends('layouts.app') + +@section('title', '首页') + +@section('content') + + + @include('category.navigation') + + +
    +
    + @if ($articles->isNotEmpty()) +
    +
      + @foreach ($articles as $article) +
    • +
      + {{ $article->title }} +
      +
      + {{ $article->description }} +
      +
    • + @endforeach +
    +
    + @if ($articles->isNotEmpty()) + {{ $articles->links('layouts.pagination') }} + @endif +
    +
    + @else +
    +
    + + 抱歉,暂无内容 +
    +
    + @endif +
    +
    + + +@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 2661b39..9079be9 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -12,6 +12,7 @@ + @include('layouts.header') @section('content') diff --git a/resources/views/layouts/header.blade.php b/resources/views/layouts/header.blade.php index 314c7d5..835379a 100644 --- a/resources/views/layouts/header.blade.php +++ b/resources/views/layouts/header.blade.php @@ -1,3 +1,10 @@ + +
    +
    + + +
    +
    @@ -49,8 +60,8 @@ } @endphp @foreach ($all_categorys as $cate) -
  • id,$top_ids)) class="active" @endif> - {{ $cate->title }} +
  • id,$top_ids)) class="active" @endif data-href="{{ $cate->link }}"> + {{ $cate->title }}
  • @endforeach
diff --git a/routes/web.php b/routes/web.php index d471365..f3f4d67 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,10 +11,11 @@ | */ Route::get('/', 'IndexController@index')->name('index.index'); +Route::get('search', 'IndexController@search')->name('index.search'); + Route::get('articles/{article}', 'ArticleController@show')->name('article.show'); Route::get('category/{category}', 'CategoryController@index')->name('category.show'); - //以下为导入数据 Route::get('test/set_article_category', 'TestController@set_article_category'); Route::get('test/set_category', 'TestController@set_category');