我的联系方式
-微信1234567890
-手机1234567890
-邮箱1234567890@qq.com
-diff --git a/README.md b/README.md index 259e3dc..d9a94bb 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,12 @@ 已实现很好用的`上传文件管理`,`内容管理`,`导航轮播管理(支持小程序)`的后台功能. -已实现`前台简约蓝官网`,`后台清新风格layui`皮肤. +已实现`后台清新风格layui`皮肤. + +> 以去除现有的多皮肤设计,项目单独成立 - 前台简约蓝皮肤 + - [开源地址](https://gitee.com/ulthon/ulthon_site) -  - 实现首页轮播,功能块 - 文章咨询列表详情 @@ -24,6 +27,7 @@ - 关于特别板式模板 - 前台资讯主题 + - [开源地址](https://gitee.com/ulthon/ulthon_information) -  - 首页列表 - 搜索 @@ -93,62 +97,6 @@ php think reset_password - 支持前台多主题 - 适配手机端,实现table转卡片样式 -#### 多主题用法 - -##### 视图文件 - -在index应用下,使用`$this->fetch($template,$vars)`,而不要用`View::fetch($template,$vars)`. - -多主题用法仅当`$template`为空字符串或者字符串有效,使用`跨应用`,`跨控制器`,`木板路径`,`数据内容`的写法无效. - -index应用下控制器有个`BaseController.php`,里面有个属性`$isUseTpls = true`,当关闭时不使用多主题. - -多主题规则,系统设置的`index_tpl_name`拼接`$template`; - -例如下: -假设是`Index`控制器,`index`方法,系统设置的`index_tpl_name`值为`easy_blue_`,模板命名规则和模板目录均为默认情况下. - -``` - $this->fetch(); - // 定位模板为:/view/index/index/easy_blue_index.html - - $this->fetch('index'); - // 定位模板为:/view/index/index/easy_blue_index.html - - $this->fetch('index_1'); - // 定位模板为:/view/index/index/easy_blue_index_1.html - - $this->fetch('index_product'); - // 定位模板为:/view/index/index/easy_blue_index_product.html - -``` - -> 配置文件下的模板命名规则和模板位置仍然按有效,默认在`/view`将方法名转下划线的写法.这些配置仍然有效; - -##### 皮肤特有方法 - -一般的,我们在控制器有一段逻辑只为这个皮肤调用,那么我们可以定义`__indexTplNameActionName`来调用, - -例如,访问`Index`控制器`index`方法,系统设置的`index_tpl_name`值为`article_`,可以定义这样一个方法: - -- 方法前置调用 - - 该方法会在访问index方法时调用不支持传参, - - 建议内部逻辑都通过`Request`类获取参数, - - 该方法也不支持返回值 - - 该方法相当于在执行`index`方法之前调用的前置方法 -``` -public function __articlesIndex(){} -``` -- 基类公共调用 - - 如果想给整个皮肤定义公共方法,可以如下定义: - - 将`__`拼接下划线转小驼峰的`index_tpl_name` - -``` -public function __articles(){} -``` - -> 具体规则可以参考`index`应用下的`BaseController.php`控制器. - ### 完整安装 先执行快速使用的步骤,此时项目已经安装到本地,数据库也安装到本地的sqlite. diff --git a/app/index/controller/BaseController.php b/app/index/controller/BaseController.php index f67d013..936404b 100644 --- a/app/index/controller/BaseController.php +++ b/app/index/controller/BaseController.php @@ -10,58 +10,4 @@ use think\helper\Str; class BaseController extends AppBaseController { - /** - * 是否使用多模板 - * 仅当名称为空或者指定名称有效, - * 使用跨应用,跨控制器,引用模板路径的写法时无效 - * - * @var boolean - */ - protected $isUseTpls = true; - - protected $indexTplName = ''; - protected $indexTplMethod = ''; - protected $indexTplMethodCurrentAction = ''; - - - - public function initialize() - { - parent::initialize(); - - $this->indexTplName = get_system_config('index_tpl_name'); - - $this->indexTplMethod = '__'.Str::camel($this->indexTplName); - - $this->indexTplMethodCurrentAction = $this->indexTplMethod.Str::studly($this->request->action()); - - - } - - public function assign($template, $value) - { - return View::assign($template, $value); - } - - public function fetch($template = '', $vars = []) - { - if ($this->isUseTpls && strpos($template, '@') === false && stripos($template, '/') === false) { - - if ($template === '') { - $config_auto_rule = Config::get('view.auto_rule'); - if (2 == $config_auto_rule) { - $template = $this->request->action(true); - } elseif (3 == $config_auto_rule) { - $template = $this->request->action(); - } else { - $template = Str::snake($this->request->action()); - } - } - - - return View::fetch($this->indexTplName . $template, $vars); - } else { - return View::fetch($template, $vars); - } - } } diff --git a/app/index/controller/Category.php b/app/index/controller/Category.php deleted file mode 100644 index 079d3f5..0000000 --- a/app/index/controller/Category.php +++ /dev/null @@ -1,93 +0,0 @@ -find($id); - - $this->assign('category',$model_category); - - return $this->fetch('read'.$model_category->getData('tpl_name')); - } - - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update(Request $request, $id) - { - // - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - // - } -} diff --git a/app/index/controller/Common.php b/app/index/controller/Common.php index 4a98ce4..d67c22d 100644 --- a/app/index/controller/Common.php +++ b/app/index/controller/Common.php @@ -15,57 +15,6 @@ class Common extends BaseController parent::initialize(); - $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(); - View::assign('list_nav_index_block_2', $list_nav_index_block_2); - } - - public function __articles() - { - $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)->where('type',11)->select(); - View::assign('list_nav_more', $list_nav_more); - - $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 9606f19..f5a8e12 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -22,77 +22,6 @@ class Index extends Common return $this->fetch(); } - public function __blogIndex() - { - $list_category = Category::where('type','blog_post')->select(); - - $this->assign('list_category',$list_category); - - $category_id = $this->request->param('category_id'); - - if(!empty($category_id)){ - - $model_list_post = Post::hasWhere('categorys',['category_id'=>$category_id])->order('sort desc'); - }else{ - - $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); - - - } - - public function __documentsIndex() - { - $list_index_documents_nav = Nav::where('type',9)->select(); - - $this->assign('list_index_documents_nav',$list_index_documents_nav); - } - - public function __articlesIndex() - { - - $sub_category = []; - - if(!empty($this->request->param('category_id'))){ - $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')),3)); - - $categorys_where = PostCategory::whereIn('category_id',$categorys); - - $model_post = Post::hasWhere('categorys',$categorys_where)->where('status',1)->order('id desc'); - }else{ - $model_post = Post::hasWhere('categorys',['category_id'=>$this->request->param('sub_category_id')])->where('status',1)->order('id desc'); - - } - }else{ - - $model_post = Post::where('status',1)->order('id desc'); - } - - $model_post->where('type',3); - - $keywords = $this->request->param('keywords'); - - if(!empty($keywords)){ - $model_post->whereLike('title|desc',"%$keywords%"); - } - - $list_post = $model_post->paginate(); - - $this->assign('sub_category',$sub_category); - - $this->assign('list_post',$list_post); - } /** * 显示创建资源表单页. diff --git a/app/index/controller/Post.php b/app/index/controller/Post.php deleted file mode 100644 index 87912cd..0000000 --- a/app/index/controller/Post.php +++ /dev/null @@ -1,106 +0,0 @@ -assign('post', $model_post); - - return $this->fetch(); - } - - public function __documentsRead() - { - $category_id = $this->request->param('category_id',0); - - $list_post = []; - if(!empty($category_id)){ - $list_post = ModelPost::hasWhere('categorys',['category_id'=>$category_id])->order('sort desc')->select(); - } - - $this->assign('list_post',$list_post); - - } - - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update(Request $request, $id) - { - // - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - // - } -} diff --git a/view/admin/common/_header.html b/view/admin/common/_header.html index cd4a316..e7168ea 100644 --- a/view/admin/common/_header.html +++ b/view/admin/common/_header.html @@ -8,18 +8,7 @@
{$post.desc}
-{$post.desc}
-{$post.title}
-> 职位描述
-我们的蜕变
-{:date('Y 年 m 月 d 日',$post->publish_time)}
-{$post.title}
-{:date('Y 年 m 月 d 日',$post->publish_time)}
-{$post.title}
-{$post.title}
-{$post.desc}
-{:get_system_config('site_copyright')}
- -举报邮箱:{:get_system_config('stie_contact_email')}
- - - -{$nav.title}
-{$nav.desc}
-
- {/empty}
- - {:get_system_config('blog_welcome_tips','欢迎来到'.get_system_config('site_name').'的博客')} -
-{:get_system_config('site_desc')}
-{$nav.title}
-{$nav.desc}
-{:get_system_config('easy_index_block_1_title_1')}{:get_system_config('easy_index_block_1_title_2')}
-{:get_system_config('easy_index_block_2_title_1')}{:get_system_config('easy_index_block_2_title_2')}
-{$nav.title}
- -{$nav.desc}
-实时新闻 > 新闻详情
-发布时间:{$post.publish_time_text}
-{$post.desc_html}
-- -
-