diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index 142b362..7ccf188 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -33,10 +33,17 @@ class BaseController extends BaseCtrl $this->uid = Session::get('user_id'); //系统配置 $this->showSystem(); - //显示分类导航 - $this->showNav(); - //用户 - $this->showUser($this->uid); + + //变量赋给模板 + View::assign([ + //显示分类导航 + 'cateList' => $this->showNav(), + //显示子分类导航 + 'subcatelist' => $this->showSubnav(), + //当前登录用户 + 'user' => $this->showUser($this->uid), + + ]); } @@ -56,18 +63,47 @@ class BaseController extends BaseCtrl } } - // 显示导航 + // 显示导航nav protected function showNav() { //1.查询分类表获取所有分类 - $cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order('sort','asc')->cache('catename',3600)->select()->toArray(); + $cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order(['id' => 'ASC','sort' => 'ASC'])->cache('catename',3600)->select()->toArray(); $cateList = array2tree($cateList); // $cateList = getTree($cateList); - // dump($cateList); - //2.将catelist变量赋给模板 公共模板nav.html - View::assign('cateList',$cateList); + return $cateList; + } + + // 显示子导航subnav + protected function showSubnav() + { + // dump($this->showNav()); + //1.查询父分类id + $pCate = Db::name('cate')->field('id,pid,ename,catename,is_hot')->where(['ename'=>input('ename'),'status'=>1,'delete_time'=>0])->find(); + + if(empty($pCate)) { // 没有点击任何分类,点击首页获取全部分类信息 + $subCateList = $this->showNav(); + } else { // 点击分类,获取子分类信息 + $parentId = $pCate['id']; + $subCate = Db::name('cate')->field('id,ename,catename,is_hot,pid')->where(['pid'=>$parentId,'status'=>1,'delete_time'=>0])->order(['id' => 'ASC','sort' => 'ASC'])->select()->toArray(); + if(!empty($subCate)) { // 有子分类 + $subCateList = array2tree($subCate); + } else { //无子分类 + if($pCate['pid'] == 0) { + //一级菜单 + $subCateList[] = $pCate; + } else { + //子菜单下如果无子菜单,则显示全部兄弟分类 + $parament = Db::name('cate')->field('id,ename,catename,is_hot,pid')->where(['pid'=>$pCate['pid'],'status'=>1,'delete_time'=>0])->order(['sort' => 'asc'])->select()->toArray(); + $subCateList = array2tree($parament); + } + + } + } + + return $subCateList; + } //显示当前登录用户 @@ -79,9 +115,6 @@ class BaseController extends BaseCtrl $user = Db::name('user')->field('id,name,nickname,user_img,sex,area_id,auth,city,email,active,sign,point,vip,create_time')->find($id); Cache::tag('user')->set('user'.$id,$user,600); } - - //2.将User变量赋给模板 公共模板nav.html - View::assign('user',$user); return $user; } diff --git a/app/index/route/route.php b/app/index/route/route.php index aa38514..e813d26 100644 --- a/app/index/route/route.php +++ b/app/index/route/route.php @@ -57,6 +57,8 @@ Route::group('art',function () use($detail_as,$cate_as){ Route::rule('tags','Article/tags')->allowCrossDomain(); Route::rule('edit/[:id]','Article/edit'); Route::get('article/catetree','Article/getCateTree'); + Route::get('download/[:id]','Article/download'); + }); //tag diff --git a/config/taoler.php b/config/taoler.php index 3a23395..989e474 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -16,7 +16,7 @@ return [ // 应用名,此项不可更改 'appname' => 'TaoLer', // 版本配置 - 'version' => '1.9.23', + 'version' => '1.9.26', // 加盐 'salt' => 'taoler', // 数据库备份目录 diff --git a/public/static/res/css/global.css b/public/static/res/css/global.css index 4fc6319..7cce69a 100644 --- a/public/static/res/css/global.css +++ b/public/static/res/css/global.css @@ -180,8 +180,9 @@ pre{position: relative; margin: 10px 0; padding: 15px; line-height: 20px; border /* 头部 */ .fly-header{position: fixed; left: 0; top: 0; z-index: 10000; width: 100%; height: 60px; border-bottom: 1px solid #404553; border-right: 1px solid #404553; border-radius: 0;} .fly-logo{position: absolute; left: 15px; top: 11px;} +.fly-logo-m{position: absolute; left:calc(50% - 45px); top: 11px;} .fly-nav{margin-left: 200px;} -.fly-nav a i{position: absolute; left: 25px; top: 0; padding-right: 10px; font-size: 26px;} +.fly-nav a i{position: absolute; left: 15px; top: 0; padding-right: 10px; font-size: 22px;} .fly-nav a .icon-shouye, .nav a .icon-shezhi{top: 2px;} .fly-nav-user{position: absolute; top: 0; right: 0;} @@ -191,7 +192,7 @@ pre{position: relative; margin: 10px 0; padding: 15px; line-height: 20px; border .fly-nav-avatar .fly-badge-vip{position: relative; margin-left: 10px;} .fly-nav-user .layui-nav-child a i{position: relative; top: 2px; margin-right: 10px; font-size: 26px;} -.fly-nav-msg{position:absolute; top: 50%; left: -25px; height: 20px; line-height: 20px; margin-top: -10px; padding:0 6px; background-color: #FF7200; color: #fff; border-radius: 2px;} +.fly-nav-msg{position:absolute; top: 50%; right: 5px; height: 20px; line-height: 20px; margin-top: -10px; padding:0 6px; background-color: #FF7200; color: #fff; border-radius: 2px;} .fly-nav-msg:hover{color:#fff;} .fly-header .layui-nav{padding: 0; background: none;} @@ -216,6 +217,12 @@ pre{position: relative; margin: 10px 0; padding: 15px; line-height: 20px; border .fly-layui-user .layui-nav-child{left: auto; right: 0; min-width: 0; width: 120px;} */ +/* 搜索 */ +.fly-header .layui-nav .fly-search{display: inline-block; vertical-align: top; width: 50px; height: 50px; padding-top:20px;margin-right: 10px; text-align: center; cursor: pointer; font-size: 20px;} +.fly-header .layui-nav .fly-search .layui-icon{font-size: 20px;} +.fly-header .layui-nav .fly-search:hover{color: #5FB878;} +.fly-header .layui-nav .fly-layer-search input{height: 75px; line-height: 75px; width: 500px; padding: 0 15px; font-size: 20px; border: none 0; background: none;} + /* 底部 */ .fly-footer {margin: 50px 0 0; padding: 20px 0 30px; line-height: 30px; text-align: center; color: #737573; border-top: 1px solid #e2e2e2;} @@ -247,12 +254,6 @@ pre{position: relative; margin: 10px 0; padding: 15px; line-height: 20px; border .fly-column-right .layui-btn{vertical-align: initial;} .fly-column .layui-badge-dot{position: absolute; top: 50%; left: 50%; margin: -4px 0 0 20px;} -/* 搜索 */ -.fly-search{display: inline-block; vertical-align: top; width: 50px; height: 50px; margin-right: 10px; text-align: center; cursor: pointer; font-size: 20px;} -.fly-search .layui-icon{font-size: 20px;} -.fly-search:hover{color: #5FB878;} -.fly-layer-search input{height: 75px; line-height: 75px; width: 500px; padding: 0 15px; font-size: 20px; border: none 0; background: none;} - /* 幻灯 */ .fly-topline{height: 195px;} .fly-topline img{max-width: 100%;} @@ -459,7 +460,6 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co .detail-assist{ position: fixed; width: 35px; - height:185px; right: calc(50% - 625px); top: 200px; margin: 0 auto; diff --git a/view/taoler/index/article/ask/detail.html b/view/taoler/index/article/ask/detail.html index 028c93e..1b47b61 100644 --- a/view/taoler/index/article/ask/detail.html +++ b/view/taoler/index/article/ask/detail.html @@ -44,7 +44,13 @@
问题描述:

{$article.content|raw}
- + {if (($article.upzip !== '') || session('?user_name'))} +
+ {notempty name="$article.upzip"} + + {/notempty} +
+ {/if}
本文链接:{$Request.domain}{$Request.url}
{notempty name="tags"}
标签 @@ -112,7 +118,7 @@

-
{$vo.user.sign|raw}
+
{$vo.user.sign|raw}
{/volist} diff --git a/view/taoler/index/article/edit.html b/view/taoler/index/article/edit.html index cbc9f3e..21d8eea 100644 --- a/view/taoler/index/article/edit.html +++ b/view/taoler/index/article/edit.html @@ -144,6 +144,7 @@