+
城市轨道交通实训平台
@@ -157,13 +156,13 @@ export default {
return true;
}
return false;
- },
- goToTraining(){
- let routeData = this.$router.resolve({
- path: "/",
+ },
+ goToTraining() {
+ const routeData = this.$router.resolve({
+ path: '/'
});
window.open(routeData.href, '_blank');
- }
+ }
}
};
@@ -202,26 +201,6 @@ export default {
display: inline-block;
position: relative;
margin-right:10px;
- // position: absolute;
- // right: 35px;
-
- .avatar-wrapper {
- cursor: pointer;
- position: relative;
-
- .user-avatar {
- width: 40px;
- height: 40px;
- border-radius: 10px;
- }
-
- .el-icon-caret-bottom {
- position: absolute;
- right: -20px;
- top: 25px;
- font-size: 12px;
- }
- }
}
}
diff --git a/src/permission.js b/src/permission.js
index f26e99c7d..f26236303 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -5,9 +5,9 @@ import NProgress from 'nprogress'; // Progress 进度条
import 'nprogress/nprogress.css';// Progress 进度条样式
import { admin, userDesign} from './router';
import { getToken, getScreenToken, getDesignToken} from '@/utils/auth'; // 验权
-// getPlanToken
import { LoginParams } from '@/utils/login';
import { getSessionStorage } from '@/utils/auth';
+import localStore from 'storejs';
function hasPermission(roles, permissionRoles) {
if (roles.indexOf(admin) >= 0) return true;
@@ -29,7 +29,6 @@ function getRouteInfo(to) {
let getTokenInfo = () => { };
let clientId = '';
const toRoutePath = to.redirectedFrom || to.path;
-
if (/^\/dp/.test(toRoutePath) || /^\/display\/dp/.test(toRoutePath)) {
loginPath = loginScreenPage;
getTokenInfo = getScreenToken;
@@ -88,7 +87,15 @@ function handleRoute(to, from, next, routeInfo) {
} else {
// 除没有动态改变权限的需求可直接next() 删下方权限判断
if (hasPermission(store.getters.roles, to.meta.roles)) {
- next();
+ if (to.path==='/404' && to.redirectedFrom==='/') {
+ if (getSessionStorage('design') === 'true') {
+ next('/design/home');
+ } else {
+ next(localStore.get('trainingPlatformRoute'+store.getters.id) ||'/trainingPlatform');
+ }
+ } else {
+ next();
+ }
} else {
next({ path: '/401', replace: true, query: { noGoBack: true } });
}
diff --git a/src/router/index.js b/src/router/index.js
index 5199ad88b..1898707c2 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -153,13 +153,13 @@ export const userPlan = '015'; // 计划系统
export const userDesign='016'; // 设计系统
const isDev = process.env.NODE_ENV === 'development';
-const design = getSessionStorage('design');
-let redirectPath = '';
-if (design === 'true') {
- redirectPath = '/design/home';
-} else {
- redirectPath = '/trainingPlatform';
-}
+// const design = getSessionStorage('design');
+// let redirectPath = '';
+// if (design === 'true') {
+// redirectPath = '/design/home';
+// } else {
+// redirectPath = '/trainingPlatform';
+// }
export const UrlConfig = {
display: '/display',
@@ -321,11 +321,11 @@ export const constantRoutes = [
component: Jlmap3dedit,
hidden: true
},
- {
- path: '/',
- redirect: redirectPath,
- hidden: true
- },
+ // {
+ // path: '/',
+ // redirect: redirectPath,
+ // hidden: true
+ // },
{
path: '/401',
component: Error401,
diff --git a/src/store/getters.js b/src/store/getters.js
index 843d1289b..a1071dd74 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -11,6 +11,7 @@ const getters = {
roles: state => state.user.roles,
canvasWidth: state => state.config.width,
canvasHeight: state => state.config.height,
+ id: state => state.user.id,
permission_routes: state => state.permission.routes
};
export default getters;