调整竞赛系统登陆权限

This commit is contained in:
zyy 2020-05-18 13:08:45 +08:00
parent fbd0dbee74
commit 9591cbd268
6 changed files with 23 additions and 24 deletions

View File

@ -151,6 +151,7 @@ export const mapCreater = '02'; // 地图创建权限
export const lessonCreater = '03'; // 课程创建权限
export const admin = '04'; // 管理员
export const superAdmin = '05'; // 超级管理员
export const referee = '07'; // 裁判员
export const userExam = '011'; // 考试系统
export const userLesson = '012'; // 教学系统
@ -982,13 +983,13 @@ export const asyncRouter = [
]
}
];
const JSXT = [
export const JSXT = [
{
path: '/jsxt',
component: Layout,
meta: {
i18n: 'router.competitionManage',
roles: [user, userTrainingPlatform]
roles: [user, userTrainingPlatform, referee]
},
pathStr: 'jsxt',
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('jsxt') && !window.document.location.pathname.includes('jsxt') : !window.document.location.pathname.includes('jsxt'),
@ -1009,7 +1010,7 @@ const JSXT = [
component: Layout,
meta: {
i18n: 'router.refereeJManage',
roles: [admin, userTrainingPlatform]
roles: [referee, userTrainingPlatform]
},
pathStr: 'refereeJsxt',
hidden: getSessionStorage('project') ? !getSessionStorage('project').endsWith('refereeJsxt') && !window.document.location.pathname.includes('refereeJsxt') : !window.document.location.pathname.includes('refereeJsxt'),
@ -1036,11 +1037,6 @@ const router = createRouter();
router.beforeEach((to, from, next) => {
const project = getSessionStorage('project');
JSXT.forEach(route => {
if (from.path.includes(route.pathStr)) {
asyncRouter.push(route);
}
});
document.title = loginInfo[project || 'login'].browserTitle || loginInfo[project || 'login'].title;
next();
});

View File

@ -37,7 +37,8 @@ export default {
{ label: '课程生成者', value: '03' },
{ label: '系统管理员', value: '04' },
{ label: '超级管理员', value: '05' },
{ label: '销售用户', value: '06' }
{ label: '销售用户', value: '06' },
{ label: '裁判员', value: '07' }
],
examResultList: [

View File

@ -1,4 +1,4 @@
import { asyncRouter, constantRoutes, user, userLesson, userExam, userSimulation, userScreen, userPlan, superAdmin, admin, userTrainingPlatform } from '@/router/index_APP_TARGET';
import { asyncRouter, constantRoutes, user, userLesson, userExam, userSimulation, userScreen, userPlan, superAdmin, admin, userTrainingPlatform, JSXT } from '@/router/index_APP_TARGET';
import { PermissionType } from '@/utils/PermissionType';
import { UrlConfig } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth';
@ -35,7 +35,7 @@ function hasPermission(roles, route, parentsRoles) {
roles = roles.filter(function (role) {
return route.meta.roles.indexOf(role) >= 0;
});
return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) > 0;
return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userTrainingPlatform) >= 0;
}
} else if (parentsRoles) {
// 如果没有本级路由,有父级路由,则使用父级路由过滤
@ -104,8 +104,9 @@ const permission = {
if (roles.indexOf(superAdmin) >= 0 && roles.indexOf(admin) < 0) {
roles.push(admin);
}
const routeArr = [...asyncRouter, ...JSXT];
const accessedRouters = filterAsyncRouter(asyncRouter, roles);
const accessedRouters = filterAsyncRouter(routeArr, roles);
accessedRouters.forEach(route => {
if (route.children && route.children.length == 0) {
route.hidden = true;

View File

@ -1,9 +1,9 @@
import { setSessionStorage } from '@/utils/auth';
import { login, logout, getInfo } from '@/api/login';
import { getToken, setToken, removeToken } from '@/utils/auth';
import { getToken, setToken, removeToken, removeSessionStorage } from '@/utils/auth';
import { getUserConfigInfo } from '@/api/management/user';
import { LoginParams } from '@/utils/login';
import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic, disconnect} from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, perpetualTopic, disconnect} from '@/utils/stomp';
import Cookies from 'js-cookie';
const user = {
@ -145,6 +145,7 @@ const user = {
commit('SET_ID', '');
commit('SET_ROLES', []);
removeToken();
removeSessionStorage('project');
},
// 登出系统

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.41:9000'; // 张S赛

View File

@ -211,7 +211,7 @@ export default {
rightAxleOffset: {x:0, y:0},
leftAxleOffset: {x:0, y:0},
leftAxlePosition: 0,
rightAxlePosition: 0,
rightAxlePosition: 0
};
models.push(model);
}
@ -294,7 +294,7 @@ export default {
rightAxleOffset: {x:0, y:0},
leftAxleOffset: {x:0, y:0},
leftAxlePosition: 0,
rightAxlePosition: 0,
rightAxlePosition: 0
};
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](lsection.code), { _dispose: true }));
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](rsection.code), { _dispose: true }));