Commit 0ecc717
authored
修复admin个别配置不生效bug
修复admin个别配置不生效bug
更新后如果出现无法登录,或者登录页报null的请求,请将auth入口文件中index方法更新如下
public function index(){
$token = $this->request->cookie($this->getCookieName());
$userInfo = new UserEntity();
$setting = new UISettingEntity(config('admin')); #这里是重点
try {
$user = Admin::user($token);
$userInfo->setUsername($user->username);
$userInfo->setName($user->name);
$userInfo->setId($user->getId());
$userInfo->setAvatar($user->avatar);
$userInfo->setToken($token);
$menuTree = Admin::menu($user);
$setting->setMenu(new MenuEntity($menuTree));
} catch (\Throwable $exception) {
p("登录失败," . $exception->getMessage());
}
$setting->setUser($userInfo);
$setting->setUrl([
'logout' => route('/auth/logout'),
'setting' => route('/auth/setting'),
]);
$setting->setApiRoot(config('admin.route.api_prefix'));
$setting->setHomeUrl(config('admin.route.home'));
return UI::view($setting);
}1 parent 5f6db10 commit 0ecc717
1 file changed
+3
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | | - | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
| |||
0 commit comments