Merge branch 'dev_product' of https://git.cloud.tencent.com/joylink/jl-nclient into dev_product

This commit is contained in:
fan 2019-09-25 14:52:30 +08:00
commit 00f6a41eeb
4 changed files with 80 additions and 39 deletions

View File

@ -8,7 +8,7 @@
text-color="#fff"
active-text-color="#ffd04b"
>
<system-title v-if="isShow"></system-title>
<system-title></system-title>
<template v-for="(item,idx) in routers">
<template v-if="!item.hidden&&item.children">
<template v-if="hasOneScreenShowingChildren(item.children) &&!item.alwaysShow">
@ -121,7 +121,7 @@ export default {
},
hasOneScreenShowingChildren(children) {
const showingChildren = children.filter(item => {
if (!item.hidden && item.target) {
if (!item.hidden && item.target) {
return item;
}
});

View File

@ -1,30 +1,46 @@
<template>
<div class="avatar-container" style="left:40px;">
<img class="logo" :src="logoImg" />
<div class="titleInner" style="margin-left:60px;">城市轨道交通实训平台</div>
<div class="avatar-container" style="margin-left:40px;">
<img class="logo" :src="logoImg" @click="goToMain"/>
<div class="titleInner" style="margin-left:60px;" @click="goToMain">{{systemTitle}}</div>
</div>
</template>
<script>
import logoImg from '@/assets/logo_changan.png';
import { getSessionStorage } from '@/utils/auth';
import { UrlConfig } from '@/router/index';
export default {
data() {
return {
logoImg: logoImg
logoImg: logoImg,
systemTitle:"城市轨道交通实训平台"
};
},
mounted(){
if (getSessionStorage('design')) {
this.systemTitle="城市轨道交通设计平台";
}
else{
this.systemTitle="城市轨道交通实训平台";
}
},
methods:{
goToMain(){
// if (getSessionStorage('design')) {
// this.$router.push({ path: `${UrlConfig.design.prefix}/home`});
// }
}
}
}
</script>
<style lang="scss" scoped>
// .navbar .avatar-container {
// height: 61px;
// display: inline-block;
// position: absolute;
// right: 35px;
// }
.main-container .navbar .avatar-container {
height: 61px;
position: relative;
right: 35px;
float: left;
}
.titleInner{
display:inline-block;
color: #fff;

View File

@ -157,8 +157,8 @@ export const UrlConfig = {
map: {
prefix: '/map',
draft: '/map/draw',
skinCode: '/map/skinCode',
skinCodeDraft: '/map/skinCode/draft',
skinCode: '/system/skinCode',
skinCodeDraft: '/system/skinCode/draft',
runPlan: '/map/runPlan',
runPlanView: '/map/runPlan/view',
product: '/map/product',
@ -457,18 +457,18 @@ export const asyncRouter = [
hidden: true,
component: Layout,
children: [
{
path: 'skinCode',
component: SkinCode,
meta: {
i18n: 'router.skinManage'
}
},
{
path: 'skinCode/draft/:mode/:skinCodeId',
hidden: true,
component: SkinCodeDraft
},
// {
// path: 'skinCode',
// component: SkinCode,
// meta: {
// i18n: 'router.skinManage'
// }
// },
// {
// path: 'skinCode/draft/:mode/:skinCodeId',
// hidden: true,
// component: SkinCodeDraft
// },
{
path: 'draw',
redirect: '/map/draw/0/draft',
@ -484,13 +484,13 @@ export const asyncRouter = [
}
]
},
{
path: 'ibp/edit',
component: IbpEdit,
meta: {
i18n: 'router.ibpDraw'
}
},
// {
// path: 'ibp/edit',
// component: IbpEdit,
// meta: {
// i18n: 'router.ibpDraw'
// }
// },
{
path: 'runPlan',
redirect: '/map/runPlan/view/draft',
@ -1116,6 +1116,25 @@ export const asyncRouter = [
roles: [admin, userDesign]
},
children: [
{
path: 'skinCode',
component: SkinCode,
meta: {
i18n: 'router.skinManage'
}
},
{
path: 'skinCode/draft/:mode/:skinCodeId',
hidden: true,
component: SkinCodeDraft
},
{
path: 'ibp/edit',
component: IbpEdit,
meta: {
i18n: 'router.ibpDraw'
}
},
{
path: 'dictionary',
component: Dictionary,

View File

@ -28,11 +28,18 @@ function hasPermission(roles, route, parentsRoles) {
setHonePagePath(route, roles);
if (route.meta && route.meta.roles) {
// 如果存在本级路由则使用自己的roles过滤
if (getSessionStorage('design')&& route.meta.roles.indexOf(userDesign)===-1 ) {
route.hidden = true;
// debugger;
if (getSessionStorage('design')) {
if (route.meta.roles.indexOf(userDesign)===-1) {
route.hidden = true;
} else {
if (!(route.meta.roles.indexOf(admin)>=0 && roles.indexOf(admin)>=0)) {
route.hidden = true;
}
}
} else {
// debugger;
if (!getSessionStorage('design')&&route.meta.roles.indexOf(userDesign)>0) {
if (route.meta.roles.indexOf(userDesign)>0) {
route.hidden = true;
}
}
@ -109,7 +116,6 @@ const permission = {
// eslint-disable-next-line prefer-const
accessedRouters = filterAsyncRouter(asyncRouter, roles);
// }
commit('SET_ROUTERS', accessedRouters);
resolve();
});