fix(用户组和权限): 修复没有项目权限的用户登录之后展示页面的问题
--bug=1009874 --user=刘瑞斌 [用户组和权限]-仅是工作空间成员登录系统提示error https://www.tapd.cn/55049933/s/1096141
This commit is contained in:
parent
15a3227135
commit
d9439c8d59
|
@ -9,9 +9,6 @@ import ReportStatistics from "@/business/components/reportstatistics/router";
|
||||||
import Project from "@/business/components/project/router";
|
import Project from "@/business/components/project/router";
|
||||||
import {getCurrentUserId, hasPermissions} from "@/common/js/utils";
|
import {getCurrentUserId, hasPermissions} from "@/common/js/utils";
|
||||||
|
|
||||||
// const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/);
|
|
||||||
// const Report = requireContext.keys().map(key => requireContext(key).report);
|
|
||||||
// const ReportObj = Report && Report != null && Report.length > 0 && Report[0] != undefined ? Report : [{path: "/sidebar"}];
|
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/);
|
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/);
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
|
@ -30,7 +27,6 @@ const router = new VueRouter({
|
||||||
Track,
|
Track,
|
||||||
ReportStatistics,
|
ReportStatistics,
|
||||||
Project
|
Project
|
||||||
// ...ReportStatistics
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils';
|
import {hasPermissions, publicKeyEncrypt, saveLocalStorage} from '@/common/js/utils';
|
||||||
import {CURRENT_LANGUAGE, DEFAULT_LANGUAGE, PRIMARY_COLOR} from "@/common/js/constants";
|
import {CURRENT_LANGUAGE, DEFAULT_LANGUAGE, PRIMARY_COLOR} from "@/common/js/constants";
|
||||||
|
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
@ -186,6 +186,8 @@ export default {
|
||||||
saveLocalStorage(response);
|
saveLocalStorage(response);
|
||||||
sessionStorage.setItem('loginSuccess', 'true');
|
sessionStorage.setItem('loginSuccess', 'true');
|
||||||
this.getLanguage(response.data.language);
|
this.getLanguage(response.data.language);
|
||||||
|
// 检查登录用户的权限
|
||||||
|
this.checkRedirectUrl();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getLanguage(language) {
|
getLanguage(language) {
|
||||||
|
@ -207,13 +209,27 @@ export default {
|
||||||
getDefaultRules() { // 设置完语言要重新赋值
|
getDefaultRules() { // 设置完语言要重新赋值
|
||||||
return {
|
return {
|
||||||
username: [
|
username: [
|
||||||
{required: true, message: this.$t('commons.input_login_username'), trigger: 'blur'},
|
{required: true, message: this.$t('commons.input_login_username'), trigger: 'blur'},
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{required: true, message: this.$t('commons.input_password'), trigger: 'blur'},
|
{required: true, message: this.$t('commons.input_password'), trigger: 'blur'},
|
||||||
{min: 6, max: 30, message: this.$t('commons.input_limit', [6, 30]), trigger: 'blur'}
|
{min: 6, max: 30, message: this.$t('commons.input_limit', [6, 30]), trigger: 'blur'}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
checkRedirectUrl() {
|
||||||
|
let 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')) {
|
||||||
|
redirectUrl = '/setting/project/:type';
|
||||||
|
} else if (hasPermissions('SYSTEM_USER:READ', 'SYSTEM_WORKSPACE:READ', 'SYSTEM_GROUP:READ', 'SYSTEM_TEST_POOL:READ', 'SYSTEM_SETTING:READ', 'SYSTEM_AUTH:READ', 'SYSTEM_QUOTA:READ', 'SYSTEM_OPERATING_LOG:READ')) {
|
||||||
|
redirectUrl = '/setting';
|
||||||
|
} else {
|
||||||
|
redirectUrl = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
sessionStorage.setItem('redirectUrl', redirectUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue