更换使用adminlte皮肤
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user