diff --git a/app/admin/controller/Category.php b/app/admin/controller/Category.php index fae787e..900db2b 100644 --- a/app/admin/controller/Category.php +++ b/app/admin/controller/Category.php @@ -80,7 +80,7 @@ class Category extends Common ModelCategory::create($post_data); - return $this->success('添加成功','index'); + return $this->success('添加成功',url('index',['type'=>$this->request->param('type')])); } @@ -152,7 +152,7 @@ class Category extends Common $model_category->save($post_data); - return $this->success('保存成功','index'); + return $this->success('保存成功',url('index',['type'=>$model_category->getData('type')])); } diff --git a/app/admin/controller/Post.php b/app/admin/controller/Post.php index 7384d1e..53162f0 100644 --- a/app/admin/controller/Post.php +++ b/app/admin/controller/Post.php @@ -82,7 +82,7 @@ class Post extends Common ]); } - return $this->success('添加成功', 'index'); + return $this->success('添加成功',url('index',['type'=>$this->request->param('type')])); } /** @@ -180,7 +180,7 @@ class Post extends Common } } - return $this->success('保存成功', 'index'); + return $this->success('保存成功', url('index',['type'=>$model_post->getData('type')])); } /** diff --git a/app/common/ColumnFormat.php b/app/common/ColumnFormat.php index 55b0cc4..cf3d21e 100644 --- a/app/common/ColumnFormat.php +++ b/app/common/ColumnFormat.php @@ -42,7 +42,7 @@ class ColumnFormat public static function stringShort($name) { return Column::make($name,'string') - ->setLimit(20) + ->setLimit(30) ->setDefault(''); } diff --git a/app/index/controller/Common.php b/app/index/controller/Common.php index 15acaf5..4a98ce4 100644 --- a/app/index/controller/Common.php +++ b/app/index/controller/Common.php @@ -14,31 +14,40 @@ class Common extends BaseController { parent::initialize(); - $list_header_nav = Nav::where('type', 1)->order('sort asc')->where('status', 1)->select(); - View::assign('list_header_nav', $list_header_nav); + $list_nav_slide = Nav::where('type', 3)->order('sort asc')->where('status', 1)->select(); View::assign('list_nav_slide', $list_nav_slide); $list_nav_friend_url = Nav::where('type', 2)->order('sort asc')->where('status', 1)->select(); View::assign('list_nav_friend_url', $list_nav_friend_url); if (!empty($this->indexTplMethod)) { - if (method_exists($this, $this->indexTplMethod)) { $this->{$this->indexTplMethod}(); } - } if (!empty($this->indexTplMethodCurrentAction)) { - if (method_exists($this, $this->indexTplMethodCurrentAction)) { $this->{$this->indexTplMethodCurrentAction}(); } - } } + public function __blog() + { + $list_header_nav = Nav::where('type', 'blog_header_nav')->order('sort asc')->where('status', 1)->select(); + View::assign('list_header_nav', $list_header_nav); + } + + public function __documents() + { + $list_header_nav = Nav::where('type', 'document_header_nav')->order('sort asc')->where('status', 1)->select(); + View::assign('list_header_nav', $list_header_nav); + } + public function __easyBlue() { + $list_header_nav = Nav::where('type', 10)->order('sort asc')->where('status', 1)->select(); + View::assign('list_header_nav', $list_header_nav); $list_nav_index_block_1 = Nav::where('type', 6)->order('sort asc')->where('status', 1)->select(); View::assign('list_nav_index_block_1', $list_nav_index_block_1); $list_nav_index_block_2 = Nav::where('type', 7)->order('sort asc')->where('status', 1)->select(); @@ -47,12 +56,15 @@ class Common extends BaseController public function __articles() { - $list_category_first_level = Category::where('level', 1)->where('status', 1)->select(); + $list_header_nav = Nav::where('type', 11)->order('sort asc')->where('status', 1)->select(); + View::assign('list_header_nav', $list_header_nav); + + $list_category_first_level = Category::where('level', 1)->where('status', 1)->where('type',3)->select(); $this->assign('list_category_first_level', $list_category_first_level); - $list_nav_more = Nav::where('type', 8)->order('sort asc')->where('status', 1)->select(); + $list_nav_more = Nav::where('type', 8)->order('sort asc')->where('status', 1)->where('type',11)->select(); View::assign('list_nav_more', $list_nav_more); - $top_posts = Post::where('is_top',1)->limit(8)->select(); + $top_posts = Post::where('is_top',1)->limit(8)->where('type',3)->select(); $this->assign('top_posts',$top_posts); } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index fe65e72..9606f19 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -24,7 +24,7 @@ class Index extends Common public function __blogIndex() { - $list_category = Category::select(); + $list_category = Category::where('type','blog_post')->select(); $this->assign('list_category',$list_category); @@ -38,6 +38,8 @@ class Index extends Common $model_list_post = Post::order('sort desc'); } + $model_list_post->where('type','blog_post'); + $list_post = $model_list_post->paginate(); $this->assign('list_post',$list_post); @@ -58,12 +60,12 @@ class Index extends Common $sub_category = []; if(!empty($this->request->param('category_id'))){ - $sub_category = Category::where('pid',$this->request->param('category_id'))->select(); + $sub_category = Category::where('pid',$this->request->param('category_id'))->where('type',3)->select(); if(empty($this->request->param('sub_category_id'))){ $categorys = [$this->request->param('category_id')]; - $categorys = array_merge($categorys,array_column((array)Category::getListLevel($this->request->param('category_id')),'id')); + $categorys = array_merge($categorys,array_column((array)Category::getListLevel($this->request->param('category_id')),3)); $categorys_where = PostCategory::whereIn('category_id',$categorys); @@ -77,6 +79,8 @@ class Index extends Common $model_post = Post::where('status',1)->order('id desc'); } + $model_post->where('type',3); + $keywords = $this->request->param('keywords'); if(!empty($keywords)){ diff --git a/database/migrations/20200417060522_create_table_nav.php b/database/migrations/20200417060522_create_table_nav.php index 97e737f..e1fda38 100644 --- a/database/migrations/20200417060522_create_table_nav.php +++ b/database/migrations/20200417060522_create_table_nav.php @@ -37,7 +37,7 @@ class CreateTableNav extends Migrator $table->addColumn(Column::make('create_time','integer')->setSigned(false)->setLimit(10)->setComment('添加时间')); $table->addColumn(ColumnFormat::timestamp('update_time')); $table->addColumn(ColumnFormat::timestamp('delete_time')); - $table->addColumn(Column::make('type','integer')->setLimit(10)->setSigned(false)->setComment('类型,用于区分业务场景:1:PC导航,2:PC轮播图,3:PC友情链接')); + $table->addColumn(ColumnFormat::stringShort('type')->setComment('类型,用于区分业务场景:1:PC导航,2:PC轮播图,3:PC友情链接')); $table->addColumn(Column::make('img','string')->setLimit(100)->setComment('图片')); $table->addColumn(ColumnFormat::stringLong('desc')->setComment('副标题描述')); $table->addColumn(Column::make('target','string')->setLimit(10)->setSigned(false)->setComment('网页链接打开对象,_BLANK,_SELF,iframe_name')); diff --git a/database/migrations/20200418120809_create_table_post.php b/database/migrations/20200418120809_create_table_post.php index 238503b..3631860 100644 --- a/database/migrations/20200418120809_create_table_post.php +++ b/database/migrations/20200418120809_create_table_post.php @@ -45,7 +45,7 @@ class CreateTablePost extends Migrator $table->addColumn(ColumnFormat::stringUrl('jump_to_url')->setComment('跳转链接')); $table->addColumn(ColumnFormat::integerTypeStatus('jump_to_url_status')->setComment('0:不显示,1:显示连接,2:自动跳转')); $table->addColumn(ColumnFormat::integer('sort')->setComment('排序,越大越靠前')); - $table->addColumn(ColumnFormat::integerTypeStatus('type',1)->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途')); + $table->addColumn(ColumnFormat::stringShort('type')->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途')); $table->addColumn(Column::make('files','text')->setComment('附件')); $table->addColumn(Column::make('pictures','text')->setComment('相册')); $table->addColumn(ColumnFormat::stringShort('tpl_name')->setComment('模板名称')); diff --git a/database/migrations/20200418120827_create_table_category.php b/database/migrations/20200418120827_create_table_category.php index 990f0a1..2f827c1 100644 --- a/database/migrations/20200418120827_create_table_category.php +++ b/database/migrations/20200418120827_create_table_category.php @@ -41,7 +41,7 @@ class CreateTableCategory extends Migrator ->addColumn(ColumnFormat::stringUrl('title_img')->setComment('附图')) ->addColumn(ColumnFormat::stringLong('desc')->setComment('副标题描述')) ->addColumn(ColumnFormat::integerTypeStatus('status')->setComment('0:不显示,1:显示')) - ->addColumn(ColumnFormat::integerTypeStatus('type',1)->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途')) + ->addColumn(ColumnFormat::stringShort('type')->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途')) ->addIndex('type') ->addIndex('pid') ->addIndex('status') diff --git a/database/migrations/20200418120831_create_table_tag.php b/database/migrations/20200418120831_create_table_tag.php index 118a096..1adcc35 100644 --- a/database/migrations/20200418120831_create_table_tag.php +++ b/database/migrations/20200418120831_create_table_tag.php @@ -35,7 +35,7 @@ class CreateTableTag extends Migrator ->addColumn(ColumnFormat::timestamp('create_time')) ->addColumn(ColumnFormat::timestamp('update_time')) ->addColumn(ColumnFormat::timestamp('delete_time')) - ->addColumn(ColumnFormat::integerTypeStatus('type',1)->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途')) + ->addColumn(ColumnFormat::stringShort('type')->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途')) ->addIndex('type') ->create(); } diff --git a/public/static/css/skin-1.css b/public/static/css/skin-1.css index a9c2bbb..5506544 100644 --- a/public/static/css/skin-1.css +++ b/public/static/css/skin-1.css @@ -23,7 +23,7 @@ } .layui-layout-admin .layui-header{ - background-color: #66CCFF; + background-color: #39BDFF; } .layui-nav { @@ -138,7 +138,7 @@ } .layui-nav .layui-nav-child dd.layui-this a, .layui-nav-child dd.layui-this{ - background-color: #66CCFF; + background-color: #19B3FF; } .layui-nav-tree .layui-nav-bar{ diff --git a/view/admin/category/create.html b/view/admin/category/create.html index 5f6d356..a5eb721 100644 --- a/view/admin/category/create.html +++ b/view/admin/category/create.html @@ -10,7 +10,7 @@ @@ -36,6 +36,7 @@ 新增分类
+
分类名称
diff --git a/view/admin/category/edit.html b/view/admin/category/edit.html index 92134cb..e8653e5 100644 --- a/view/admin/category/edit.html +++ b/view/admin/category/edit.html @@ -10,7 +10,7 @@ diff --git a/view/admin/category/index.html b/view/admin/category/index.html index cc9cf01..c51be21 100644 --- a/view/admin/category/index.html +++ b/view/admin/category/index.html @@ -10,7 +10,7 @@ diff --git a/view/admin/common/_header.html b/view/admin/common/_header.html index d68a00f..32b8071 100644 --- a/view/admin/common/_header.html +++ b/view/admin/common/_header.html @@ -16,7 +16,7 @@
  • 文档
  • {/if} {if get_system_config('index_tpl_name') == 'blog_' } -
  • 博客
  • +
  • 博客
  • {/if}
  • 管理员管理
  • 系统设置
  • diff --git a/view/admin/common/left_post.html b/view/admin/common/left_post.html index b9b214a..004b73a 100644 --- a/view/admin/common/left_post.html +++ b/view/admin/common/left_post.html @@ -2,13 +2,13 @@
    diff --git a/view/admin/common/left_system.html b/view/admin/common/left_system.html index 2418b09..b68a459 100644 --- a/view/admin/common/left_system.html +++ b/view/admin/common/left_system.html @@ -18,12 +18,14 @@ {if get_system_config('index_tpl_name') == 'easy_blue_' } - + {/if} {if get_system_config('index_tpl_name') == 'articles_' } - + {/if} {if get_system_config('index_tpl_name') == 'documents_' } - + {/if} {if get_system_config('index_tpl_name') == 'blog_' } - +