perf: 优化鉴权和跳转模板

This commit is contained in:
Ying
2023-08-02 18:17:48 +08:00
parent b1623b2f3e
commit 295adfbd04
2 changed files with 17 additions and 20 deletions

View File

@@ -44,7 +44,6 @@ body{font-family: '微软雅黑',serif; color: #CCC; font-size: 16px;background:
</div> </div>
</body> </body>
<!-- 公共js部分 --> <!-- 公共js部分 -->
<script type="text/javascript"> <script type="text/javascript">
let wait = document.getElementById('wait'), let wait = document.getElementById('wait'),
href = document.getElementById('href').href, href = document.getElementById('href').href,
@@ -52,20 +51,18 @@ body{font-family: '微软雅黑',serif; color: #CCC; font-size: 16px;background:
let interval = setInterval(function(){ let interval = setInterval(function(){
let time = --wait.innerHTML; let time = --wait.innerHTML;
if(time <= 0) { if(time <= 0) {
if (window.top !== window.self) { let host = window.location.host;
let protocol = window.location.protocol;
let domain = href.replace(protocol+ '//', '').replace('/', '').replace(/(^\s*)|(\s*$)/g, "");
if (window.top !== window.self && host === domain) {
let id = window.frameElement.getAttribute('id');
parent.layui.layer.close(id);
}
if ('_parent' === target) { if ('_parent' === target) {
parent.location.href = href; parent.location.href = href;
} else { } else {
location.href = href; location.href = href;
} }
}
else {
if ('_parent' === target) {
parent.location.href = href;
} else {
location.href = href;
}
}
clearInterval(interval); clearInterval(interval);
} }
}, 1000); }, 1000);

View File

@@ -11,7 +11,7 @@ use Webman\Http\Response;
use Webman\Http\Request; use Webman\Http\Request;
/** /**
* 管理员权限 * 前端权限
* @package app\admin\middleware\system * @package app\admin\middleware\system
* @author meystack < * @author meystack <
*/ */
@@ -64,7 +64,7 @@ class IndexPermissions implements MiddlewareInterface
// 是否验证登录器 // 是否验证登录器
$userInfo = UserTokenService::isLogin(); $userInfo = UserTokenService::isLogin();
if (!empty($userInfo)) { if (!empty($userInfo) && isset($userInfo['id'])) {
if (in_array($action, $this->repeatLogin)) { if (in_array($action, $this->repeatLogin)) {
return redirect($this->JumpUrl); return redirect($this->JumpUrl);
} }