更新后面管理布局

This commit is contained in:
邹景立 2017-02-15 10:46:09 +08:00
parent 92e2f3b031
commit b2ae279be7
5 changed files with 26 additions and 12 deletions

View File

@ -6,26 +6,36 @@ use controller\BasicAdmin;
use library\Tools; use library\Tools;
use think\Db; use think\Db;
/**
* 后台入口
*
* @package app\admin\controller
* @author Anyon <zoujingli@qq.com>
* @date 2017/02/15 10:41
*/
class Index extends BasicAdmin { class Index extends BasicAdmin {
/**
* 后台框架布局
* @return \think\response\View
*/
public function index() { public function index() {
$this->assign('ptitle', '后台管理'); $list = Db::name('SystemMenu')->field('title,id,pid,url,icon')->where('status', '1')->select();
$menuList = Db::name('SystemMenu')->field('title,id,pid,url,icon')->where('status', '1')->select(); $menus = $this->_filter_menu(Tools::arr2tree($list));
$result = Tools::arr2tree($menuList); $this->assign('title', '后台管理');
$this->assign('menus', $this->_filterMenu($result)); $this->assign('menus', $menus);
return view(); return view();
} }
/** /**
* 后台主菜单权限过滤 * 后台主菜单权限过滤
* --- 权限只检测节点三级
* @param array $menus * @param array $menus
* @return array * @return array
*/ */
private function _filterMenu($menus) { private function _filter_menu($menus) {
foreach ($menus as $key => &$menu) { foreach ($menus as $key => &$menu) {
if (!empty($menu['sub'])) { if (!empty($menu['sub'])) {
$menu['sub'] = $this->_filterMenu($menu['sub']); $menu['sub'] = $this->_filter_menu($menu['sub']);
} }
if (!empty($menu['sub'])) { if (!empty($menu['sub'])) {
$menu['url'] = '#'; $menu['url'] = '#';
@ -40,6 +50,10 @@ class Index extends BasicAdmin {
return $menus; return $menus;
} }
/**
* 主机信息显示
* @return \think\response\View
*/
public function main() { public function main() {
$version = Db::query('select version() as ver'); $version = Db::query('select version() as ver');
$version = array_pop($version); $version = array_pop($version);

View File

@ -29,7 +29,7 @@ class Login extends BasicAdmin {
*/ */
public function index() { public function index() {
if ($this->request->isGet()) { if ($this->request->isGet()) {
$this->assign('ptitle', '用户登录'); $this->assign('title', '用户登录');
return $this->fetch(); return $this->fetch();
} else { } else {
$username = $this->request->post('username', '', 'trim'); $username = $this->request->post('username', '', 'trim');

View File

@ -15,7 +15,7 @@ class Menu extends BasicAdmin {
* 模块标题 * 模块标题
* @var string * @var string
*/ */
public $ptitle = '系统菜单'; public $title = '系统菜单';
/** /**
* 绑定操作模型 * 绑定操作模型
@ -116,7 +116,7 @@ class Menu extends BasicAdmin {
$db = Db::name("SystemNode")->field('node,is_menu,menu_desc')->where('is_menu', '1')->order('node ASC'); $db = Db::name("SystemNode")->field('node,is_menu,menu_desc')->where('is_menu', '1')->order('node ASC');
$nodes = parent::_list($db, false, false); $nodes = parent::_list($db, false, false);
$this->assign('nodes', $nodes['list']); $this->assign('nodes', $nodes['list']);
$this->assign("ptitle", "编辑菜单"); $this->assign("title", "编辑菜单");
return $this->fetch(); return $this->fetch();
} }
} }

View File

@ -5,7 +5,7 @@
<meta name="renderer" content="webkit"/> <meta name="renderer" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="{:sysconf('app_logo')}" /> <link rel="shortcut icon" href="{:sysconf('app_logo')}" />
<title>{block name="title"}{$ptitle|default=''}{/block}</title> <title>{block name="title"}{$title|default=''}{/block}</title>
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css"/> <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
<link rel="stylesheet" href="__STATIC__/theme/default/css/console.css"> <link rel="stylesheet" href="__STATIC__/theme/default/css/console.css">
<link rel="stylesheet" href="__STATIC__/theme/default/css/animate.css"> <link rel="stylesheet" href="__STATIC__/theme/default/css/animate.css">

View File

@ -113,7 +113,7 @@ class BasicAdmin extends Controller {
} }
$this->_callback('_form_filter', $vo); $this->_callback('_form_filter', $vo);
$this->assign('vo', $vo); $this->assign('vo', $vo);
empty($this->ptitle) or $this->assign('ptitle', $this->ptitle); empty($this->title) or $this->assign('title', $this->title);
return is_null($tpl) ? $vo : $this->display($tpl); return is_null($tpl) ? $vo : $this->display($tpl);
} }