更换使用adminlte皮肤
This commit is contained in:
@@ -10,6 +10,7 @@ namespace app\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use think\facade\Session;
|
||||
use app\model\Menu;
|
||||
|
||||
/**
|
||||
* @title 后端公共模块
|
||||
@@ -20,6 +21,13 @@ class Index extends Admin{
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function dashboard(){
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
namespace app\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use app\Model\Menu as MenuModel;
|
||||
|
||||
class Menu extends Admin{
|
||||
|
||||
@@ -16,6 +17,13 @@ class Menu extends Admin{
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
if($this->request->isAjax()){
|
||||
$menu = new MenuModel();
|
||||
|
||||
$res = $menu->select();
|
||||
|
||||
$this->data['data'] = $res;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,4 +18,18 @@ class User extends Admin{
|
||||
public function index(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 检测密码正确性
|
||||
*/
|
||||
public function checkPassword(){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修改密码
|
||||
*/
|
||||
public function resetpwd(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ use think\facade\View;
|
||||
*/
|
||||
class AdminAuth {
|
||||
|
||||
protected $data = ['headerMenu' => [], 'asideMenu' => [], 'meta_title' => ''];
|
||||
protected $data = ['menu' => [], 'meta_title' => ''];
|
||||
|
||||
public function handle($request, \Closure $next) {
|
||||
$user = Session::get('user');
|
||||
@@ -50,44 +50,14 @@ class AdminAuth {
|
||||
}
|
||||
Cache::set('menu', $menu);
|
||||
}
|
||||
$current_pid = 0;
|
||||
foreach ($menu as $key => $value) {
|
||||
if (strpos($value['url'], $current_controller.'/') !== false) {
|
||||
if ($value['pid'] == 0) {
|
||||
$current_pid = $value['id'];
|
||||
} else {
|
||||
$current_pid = $value['pid'];
|
||||
}
|
||||
}
|
||||
if ($request->isAdmin || in_array($value['id'], array())) {
|
||||
$list[$value['id']] = $value;
|
||||
}
|
||||
}
|
||||
$headerMenu = list_to_tree($list);
|
||||
foreach ($headerMenu as $key => $value) {
|
||||
if ($value['id'] == $current_pid) {
|
||||
$value['active'] = true;
|
||||
$current_aside = $value['_child'];
|
||||
} else {
|
||||
$value['active'] = false;
|
||||
}
|
||||
$headerMenu[$key] = $value;
|
||||
}
|
||||
|
||||
foreach ($current_aside as $key => $value) {
|
||||
if ($current_url == $value['url']) {
|
||||
$value['active'] = true;
|
||||
} else {
|
||||
$value['active'] = false;
|
||||
}
|
||||
if (strpos($value['url'], $current_url) !== false) {
|
||||
$this->data['meta_title'] = $value['title'];
|
||||
}
|
||||
$asideMenu[$value['group']][] = $value;
|
||||
}
|
||||
|
||||
$this->data['asideMenu'] = $asideMenu;
|
||||
$this->data['headerMenu'] = $headerMenu;
|
||||
$menuList = list_to_tree($list);
|
||||
$this->data['menu'] = $menuList;
|
||||
View::assign($this->data);
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,9 @@ use think\Model;
|
||||
*/
|
||||
class Menu extends Model {
|
||||
|
||||
public function getAuthMenuList(){
|
||||
$list = $this->select();
|
||||
$data = list_to_tree($list->toArray(), 'id', 'pid');
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user