提交 85b23e27 编写于 作者: jlj05024111@163.com's avatar jlj05024111@163.com

feat: 新增支持环境参数noAuthRedirectUrl:无权限重定向地址,disabledLogin: 禁止跳转登录

上级 7ec6cc8e
...@@ -62,9 +62,16 @@ export class UnauthorizedHandler { ...@@ -62,9 +62,16 @@ export class UnauthorizedHandler {
* @returns {*} {Promise<void>} * @returns {*} {Promise<void>}
*/ */
protected static async normalLogin(): Promise<void> { protected static async normalLogin(): Promise<void> {
if (ibiz.env.noAuthRedirectUrl) {
window.open(ibiz.env.noAuthRedirectUrl, '_self');
return;
}
// 禁止跳转登录视图时不处理
if (!ibiz.env.disabledLogin) {
const ru = window.location.hash.replace('#', ''); const ru = window.location.hash.replace('#', '');
router.push({ path: '/login', query: { ru } }); router.push({ path: '/login', query: { ru } });
} }
}
/** /**
* 没有权限处理 * 没有权限处理
......
...@@ -34,6 +34,16 @@ const router = new Router({ ...@@ -34,6 +34,16 @@ const router = new Router({
{ {
path: '/login', path: '/login',
name: 'loginView', name: 'loginView',
beforeEnter: async (_to, _from, next) => {
if (ibiz.env.noAuthRedirectUrl) {
window.open(ibiz.env.noAuthRedirectUrl, '_self');
}
if (ibiz.env.disabledLogin) {
next(false);
} else {
next();
}
},
component: loginView, component: loginView,
}, },
{ {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册