问题调整

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

View File

@ -70,8 +70,7 @@
</template>
<div class="rightGroup">
<quick-entry v-if="isShow" ref="quickEntry" />
<!-- style="right: 80px;" -->
<div class="avatar-container" v-if="!isShow" @click="goToTraining">
<div v-if="!isShow" class="avatar-container" @click="goToTraining">
<el-menu-item class="avatar-wrapper" index="">
<span style="color: white;">城市轨道交通实训平台</span>
</el-menu-item>
@ -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');
}
}
}
};
</script>
@ -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;
}
}
}
}
</style>

View File

@ -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 } });
}

View File

@ -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,

View File

@ -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;