问题调整

This commit is contained in:
fan 2019-10-23 19:00:35 +08:00
parent 667b967c06
commit 62de921294
5 changed files with 37 additions and 50 deletions

View File

@ -34,13 +34,13 @@ export default {
data() { data() {
return { return {
}; };
}, },
mounted(){
},
computed: { computed: {
username() { username() {
return this.$store.state.user.nickname; return this.$store.state.user.nickname;
}, }
},
mounted() {
}, },
methods: { methods: {
language() { language() {
@ -50,10 +50,10 @@ export default {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
location.reload(); // vue-router bug location.reload(); // vue-router bug
}); });
}, },
selfPermission(){ selfPermission() {
this.$router.push({ path: `${UrlConfig.permission.prefix}/manage`}); this.$router.push({ path: `${UrlConfig.permission.prefix}/manage`});
} }
} }
}; };
</script> </script>

View File

@ -70,8 +70,7 @@
</template> </template>
<div class="rightGroup"> <div class="rightGroup">
<quick-entry v-if="isShow" ref="quickEntry" /> <quick-entry v-if="isShow" ref="quickEntry" />
<!-- style="right: 80px;" --> <div v-if="!isShow" class="avatar-container" @click="goToTraining">
<div class="avatar-container" v-if="!isShow" @click="goToTraining">
<el-menu-item class="avatar-wrapper" index=""> <el-menu-item class="avatar-wrapper" index="">
<span style="color: white;">城市轨道交通实训平台</span> <span style="color: white;">城市轨道交通实训平台</span>
</el-menu-item> </el-menu-item>
@ -157,13 +156,13 @@ export default {
return true; return true;
} }
return false; return false;
}, },
goToTraining(){ goToTraining() {
let routeData = this.$router.resolve({ const routeData = this.$router.resolve({
path: "/", path: '/'
}); });
window.open(routeData.href, '_blank'); window.open(routeData.href, '_blank');
} }
} }
}; };
</script> </script>
@ -202,26 +201,6 @@ export default {
display: inline-block; display: inline-block;
position: relative; position: relative;
margin-right:10px; 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;
}
}
} }
} }
</style> </style>

View File

@ -5,9 +5,9 @@ import NProgress from 'nprogress'; // Progress 进度条
import 'nprogress/nprogress.css';// Progress 进度条样式 import 'nprogress/nprogress.css';// Progress 进度条样式
import { admin, userDesign} from './router'; import { admin, userDesign} from './router';
import { getToken, getScreenToken, getDesignToken} from '@/utils/auth'; // 验权 import { getToken, getScreenToken, getDesignToken} from '@/utils/auth'; // 验权
// getPlanToken
import { LoginParams } from '@/utils/login'; import { LoginParams } from '@/utils/login';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import localStore from 'storejs';
function hasPermission(roles, permissionRoles) { function hasPermission(roles, permissionRoles) {
if (roles.indexOf(admin) >= 0) return true; if (roles.indexOf(admin) >= 0) return true;
@ -29,7 +29,6 @@ function getRouteInfo(to) {
let getTokenInfo = () => { }; let getTokenInfo = () => { };
let clientId = ''; let clientId = '';
const toRoutePath = to.redirectedFrom || to.path; const toRoutePath = to.redirectedFrom || to.path;
if (/^\/dp/.test(toRoutePath) || /^\/display\/dp/.test(toRoutePath)) { if (/^\/dp/.test(toRoutePath) || /^\/display\/dp/.test(toRoutePath)) {
loginPath = loginScreenPage; loginPath = loginScreenPage;
getTokenInfo = getScreenToken; getTokenInfo = getScreenToken;
@ -88,7 +87,15 @@ function handleRoute(to, from, next, routeInfo) {
} else { } else {
// 除没有动态改变权限的需求可直接next() 删下方权限判断 // 除没有动态改变权限的需求可直接next() 删下方权限判断
if (hasPermission(store.getters.roles, to.meta.roles)) { 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 { } else {
next({ path: '/401', replace: true, query: { noGoBack: true } }); next({ path: '/401', replace: true, query: { noGoBack: true } });
} }

View File

@ -153,13 +153,13 @@ export const userPlan = '015'; // 计划系统
export const userDesign='016'; // 设计系统 export const userDesign='016'; // 设计系统
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const design = getSessionStorage('design'); // const design = getSessionStorage('design');
let redirectPath = ''; // let redirectPath = '';
if (design === 'true') { // if (design === 'true') {
redirectPath = '/design/home'; // redirectPath = '/design/home';
} else { // } else {
redirectPath = '/trainingPlatform'; // redirectPath = '/trainingPlatform';
} // }
export const UrlConfig = { export const UrlConfig = {
display: '/display', display: '/display',
@ -321,11 +321,11 @@ export const constantRoutes = [
component: Jlmap3dedit, component: Jlmap3dedit,
hidden: true hidden: true
}, },
{ // {
path: '/', // path: '/',
redirect: redirectPath, // redirect: redirectPath,
hidden: true // hidden: true
}, // },
{ {
path: '/401', path: '/401',
component: Error401, component: Error401,

View File

@ -11,6 +11,7 @@ const getters = {
roles: state => state.user.roles, roles: state => state.user.roles,
canvasWidth: state => state.config.width, canvasWidth: state => state.config.width,
canvasHeight: state => state.config.height, canvasHeight: state => state.config.height,
id: state => state.user.id,
permission_routes: state => state.permission.routes permission_routes: state => state.permission.routes
}; };
export default getters; export default getters;