fix: 修复登录后跳转的问题 (#7585)
* fix: 修复登录后跳转的问题 Co-authored-by: CaptainB <bin@fit2cloud.com>
This commit is contained in:
parent
723b8b745a
commit
ac7aab1d23
|
@ -58,10 +58,13 @@ VueRouter.prototype.push = function push(location) {
|
|||
|
||||
// 登入后跳转至原路径
|
||||
function redirectLoginPath(originPath) {
|
||||
let redirectUrl = sessionStorage.getItem('redirectUrl');
|
||||
let redirectUrl = '';
|
||||
let loginSuccess = sessionStorage.getItem('loginSuccess');
|
||||
sessionStorage.setItem('redirectUrl', originPath);
|
||||
if (getCurrentUserId() !== sessionStorage.getItem('lastUser')) {
|
||||
|
||||
if (getCurrentUserId() === sessionStorage.getItem('lastUser')) {
|
||||
redirectUrl = sessionStorage.getItem('redirectUrl');
|
||||
}
|
||||
if (!redirectUrl) {
|
||||
if (hasPermissions('PROJECT_USER:READ', 'PROJECT_ENVIRONMENT:READ', 'PROJECT_OPERATING_LOG:READ', 'PROJECT_FILE:READ+JAR', 'PROJECT_FILE:READ+FILE', 'PROJECT_CUSTOM_CODE:READ')) {
|
||||
redirectUrl = '/project/home';
|
||||
} else if (hasPermissions('WORKSPACE_SERVICE:READ', 'WORKSPACE_MESSAGE:READ', 'WORKSPACE_USER:READ', 'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_ENVIRONMENT:READ', 'WORKSPACE_OPERATING_LOG:READ', 'WORKSPACE_TEMPLATE:READ')) {
|
||||
|
@ -72,11 +75,13 @@ function redirectLoginPath(originPath) {
|
|||
redirectUrl = '/';
|
||||
}
|
||||
}
|
||||
|
||||
if (redirectUrl && loginSuccess) {
|
||||
sessionStorage.removeItem('loginSuccess');
|
||||
router.push(redirectUrl);
|
||||
}
|
||||
sessionStorage.setItem('lastUser', getCurrentUserId());
|
||||
sessionStorage.setItem('redirectUrl', originPath);
|
||||
sessionStorage.removeItem('loginSuccess');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue