问题调整

This commit is contained in:
fan 2019-10-25 12:59:24 +08:00
parent 0c67d2a077
commit bfce5a2103
13 changed files with 40 additions and 66 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -31,22 +31,22 @@ export default {
{ {
name: 'global.designPlatformEntrance', name: 'global.designPlatformEntrance',
handle: this.goToDesign, handle: this.goToDesign,
hidden: getSessionStorage('design') hidden: getSessionStorage('project') === 'design'
}, },
{ {
name: 'global.trainingPlatformEntrance', name: 'global.trainingPlatformEntrance',
handle: this.goToTraining, handle: this.goToTraining,
hidden: !getSessionStorage('design') hidden: getSessionStorage('project') !== 'design'
}, },
{ {
name: 'global.scan', name: 'global.scan',
handle: this.qcodeEntry, handle: this.qcodeEntry,
hidden: process.env.NODE_ENV != 'development' || getSessionStorage('design') hidden: process.env.NODE_ENV != 'development' || getSessionStorage('project') === 'design'
}, },
{ {
name: 'global.quickEntry', name: 'global.quickEntry',
handle: this.quickEntry, handle: this.quickEntry,
hidden: getSessionStorage('design') hidden: getSessionStorage('project') === 'design'
}, },
{ {
name: LangStorage.getLang('zh')==='zh'?'English':'中文', name: LangStorage.getLang('zh')==='zh'?'English':'中文',

View File

@ -1,39 +1,30 @@
<template> <template>
<div class="avatar-container" style="margin-left:40px;"> <div class="avatar-container" style="margin-left:40px;">
<img class="logo" :src="logoImg" @click="goToMain"/> <img class="logo" :src="logoImg" @click="goToMain">
<div class="titleInner" style="margin-left:60px;" @click="goToMain">{{systemTitle}}</div> <div class="titleInner" style="margin-left:60px;" @click="goToMain">{{ systemTitle }}</div>
</div> </div>
</template> </template>
<script> <script>
import logoImg from '@/assets/logo_changan.png'; import logoImg from '@/assets/logo_changan.png';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { UrlConfig } from '@/router/index';
import { loginTitle } from '@/scripts/ConstDic'; import { loginTitle } from '@/scripts/ConstDic';
export default { export default {
data() { data() {
return { return {
logoImg: logoImg, logoImg: logoImg,
systemTitle:"城市轨道交通实训平台" systemTitle: '城市轨道交通实训平台'
}; };
}, },
mounted(){ mounted() {
if (getSessionStorage('design')) { this.systemTitle=loginTitle[getSessionStorage('project')];
this.systemTitle="城市轨道交通设计平台"; },
} methods: {
else{ goToMain() {
this.systemTitle=loginTitle[getSessionStorage('project')||'default']; }
} }
}, };
methods:{
goToMain(){
// if (getSessionStorage('design')) {
// this.$router.push({ path: `${UrlConfig.design.prefix}/home`});
// }
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main-container .navbar .avatar-container { .main-container .navbar .avatar-container {

View File

@ -32,8 +32,7 @@ function getRouteInfo(to) {
getTokenInfo = getDesignToken; getTokenInfo = getDesignToken;
clientId = LoginParams.Design.clientId; clientId = LoginParams.Design.clientId;
} else if (/^\/plan/.test(toRoutePath) || /^\/display\/plan/.test(toRoutePath)) { } else if (/^\/plan/.test(toRoutePath) || /^\/display\/plan/.test(toRoutePath)) {
const flag = getSessionStorage('design'); if (getSessionStorage('project')==='design') {
if (flag == 'true') {
loginPath = loginDesignPage; loginPath = loginDesignPage;
getTokenInfo = getDesignToken; getTokenInfo = getDesignToken;
clientId = LoginParams.Design.clientId; clientId = LoginParams.Design.clientId;
@ -56,9 +55,8 @@ function handleRoute(to, from, next, routeInfo) {
// 拉取用户信息 // 拉取用户信息
store.dispatch('GetInfo', routeInfo.getTokenInfo).then(res => { store.dispatch('GetInfo', routeInfo.getTokenInfo).then(res => {
// 根据roles权限生成可访问的路由表 // 根据roles权限生成可访问的路由表
// debugger;
const roles = res.roles; const roles = res.roles;
if (getSessionStorage('design')) { if (getSessionStorage('project')==='design') {
roles.push(userDesign); roles.push(userDesign);
} }
store.dispatch('GenerateRoutes', { roles, clientId: routeInfo.clientId }).then(() => { store.dispatch('GenerateRoutes', { roles, clientId: routeInfo.clientId }).then(() => {
@ -82,7 +80,7 @@ function handleRoute(to, from, next, routeInfo) {
// 除没有动态改变权限的需求可直接next() 删下方权限判断 // 除没有动态改变权限的需求可直接next() 删下方权限判断
if (hasPermission(store.getters.roles, to.meta.roles)) { if (hasPermission(store.getters.roles, to.meta.roles)) {
if (to.path==='/404' && to.redirectedFrom==='/') { if (to.path==='/404' && to.redirectedFrom==='/') {
if (getSessionStorage('design') === 'true') { if (getSessionStorage('project') === 'design') {
next('/design/home'); next('/design/home');
} else { } else {
next(localStore.get('trainingPlatformRoute'+store.getters.id) ||'/trainingPlatform'); next(localStore.get('trainingPlatformRoute'+store.getters.id) ||'/trainingPlatform');

View File

@ -1065,7 +1065,7 @@ const router = createRouter();
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const project = getSessionStorage('project'); const project = getSessionStorage('project');
document.title = loginTitle[project]; document.title = loginTitle[project||'login'];
next(); next();
}); });

View File

@ -1,6 +1,6 @@
module.exports = { module.exports = {
title: '城市轨道交通实训平台', title: '',
/** /**
* @type {boolean} true | false * @type {boolean} true | false

View File

@ -48,7 +48,7 @@ function hasPermission(roles, route, parentsRoles) {
// } // }
// } // }
// return roles.some(role => route.meta.roles.indexOf(role) >= 0); // return roles.some(role => route.meta.roles.indexOf(role) >= 0);
if (getSessionStorage('design')) { if (getSessionStorage('project')==='design') {
roles= roles.filter(function (role) { roles= roles.filter(function (role) {
return route.meta.roles.indexOf(role) >= 0; return route.meta.roles.indexOf(role) >= 0;
}); });

View File

@ -1,4 +1,4 @@
import { setSessionStorage, removeSessionStorage } from '@/utils/auth'; import { setSessionStorage } from '@/utils/auth';
import { login, logout, getInfo } from '@/api/login'; import { login, logout, getInfo } from '@/api/login';
import { getToken, setToken, removeToken, getDesignToken, setDesignToken, removeDesignToken, handleToken, handleRemoveToken } from '@/utils/auth'; import { getToken, setToken, removeToken, getDesignToken, setDesignToken, removeDesignToken, handleToken, handleRemoveToken } from '@/utils/auth';
import { getUserConfigInfo } from '@/api/management/user'; import { getUserConfigInfo } from '@/api/management/user';
@ -88,12 +88,6 @@ const user = {
// 登录系统 // 登录系统
login(params).then(resp => { login(params).then(resp => {
if (userInfo.type == 'design') {
removeSessionStorage('design');
setSessionStorage('design', true);
} else {
removeSessionStorage('design');
}
execFc(resp.data); execFc(resp.data);
resolve(); resolve();
}).catch(error => { reject(error); }); }).catch(error => { reject(error); });
@ -104,7 +98,6 @@ const user = {
QrLoginSetting({ dispatch, commit }, token) { QrLoginSetting({ dispatch, commit }, token) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 设置user域token值 // 设置user域token值
removeSessionStorage('design');
commit(token.key, token.value); commit(token.key, token.value);
const header = { group: '', 'X-Token': token.value }; const header = { group: '', 'X-Token': token.value };
creatSubscribe(perpetualTopic, header); creatSubscribe(perpetualTopic, header);
@ -173,7 +166,6 @@ const user = {
commit('SET_TOKEN', ''); commit('SET_TOKEN', '');
commit('SET_ROLES', []); commit('SET_ROLES', []);
commit('SET_ID', ''); commit('SET_ID', '');
removeSessionStorage('design');
Cookies.remove('UserDesignName'); Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken'); Cookies.remove('UserDesignToken');
Cookies.remove('UserName'); Cookies.remove('UserName');

View File

@ -105,7 +105,7 @@ export default {
launchFullscreen(); launchFullscreen();
await putJointTrainingSimulationEntrance(this.group); await putJointTrainingSimulationEntrance(this.group);
const rest = await getPublishMapInfo(this.mapId); const rest = await getPublishMapInfo(this.mapId);
const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.group }; const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.group, subSystem: this.$route.query.subSystem };
this.$router.push({ path: `/jointTraining`, query: query }); this.$router.push({ path: `/jointTraining`, query: query });
} else if (this.state == '01') { } else if (this.state == '01') {
const query = { group: this.group }; const query = { group: this.group };

View File

@ -298,7 +298,7 @@ export default {
back() { back() {
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => { putJointTrainingSimulationUser(this.group).then(() => {
this.$router.push({ path: `/trainroom`, query: { skinCode: this.$route.query.skinCode, group: this.group, subSystem: this.$route.query.subSystem } }); this.$router.replace({ path: `/trainroom`, query: { skinCode: this.$route.query.skinCode, group: this.group, subSystem: this.$route.query.subSystem } });
exitFullscreen(); exitFullscreen();
}); });
}); });

View File

@ -173,7 +173,6 @@ export default {
model.type = this.modelType; model.type = this.modelType;
this.$store.dispatch('Login', model).then(() => { this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('SetAccount', model.username); this.$store.dispatch('SetAccount', model.username);
this.setProjectSession();
this.handleLoginSucessRoute(); this.handleLoginSucessRoute();
}).catch(error => { }).catch(error => {
if (error.code==='30001') { if (error.code==='30001') {
@ -204,12 +203,6 @@ export default {
removeDesignToken(); removeDesignToken();
setSessionStorage('project', this.project); setSessionStorage('project', this.project);
}, },
setProjectSession() {
if (this.project === 'design') {
removeSessionStorage('design');
setSessionStorage('design', true);
}
},
clearTimer(timer) { clearTimer(timer) {
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer);
@ -289,7 +282,6 @@ export default {
} }
this.$store.dispatch('Login', model).then(() => { this.$store.dispatch('Login', model).then(() => {
this.$store.dispatch('SetAccount', model.username); this.$store.dispatch('SetAccount', model.username);
this.setProjectSession();
this.handleLoginSucessRoute(); this.handleLoginSucessRoute();
}).catch(error => { }).catch(error => {
if (error.code==='30001') { if (error.code==='30001') {

View File

@ -3,7 +3,7 @@
<pop-menu ref="popMenu" :menu="menu" /> <pop-menu ref="popMenu" :menu="menu" />
<map-edit ref="edit" :basic-info="true" :map="editModel" :skin-code="skinCode" @refresh="refresh" /> <map-edit ref="edit" :basic-info="true" :map="editModel" :skin-code="skinCode" @refresh="refresh" />
<!-- <map-edit ref="axisEdit" :basic-info="false" :map="editModel" :skin-code="skinCode" @refresh="refresh" /> --> <!-- <map-edit ref="axisEdit" :basic-info="false" :map="editModel" :skin-code="skinCode" @refresh="refresh" /> -->
<!-- <map-save-as ref="saveAs" :map="editModel" @refresh="refresh" /> --> <map-save-as ref="saveAs" :map="editModel" @refresh="refresh" />
<map-publish ref="publish" :map="editModel" /> <map-publish ref="publish" :map="editModel" />
</div> </div>
</template> </template>
@ -14,7 +14,7 @@ import { DeviceMenu } from '@/scripts/ConstDic';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import PopMenu from '@/components/PopMenu'; import PopMenu from '@/components/PopMenu';
import MapEdit from './edit'; import MapEdit from './edit';
// import MapSaveAs from './saveAs'; import MapSaveAs from './saveAs';
import MapPublish from './publish'; import MapPublish from './publish';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
@ -23,7 +23,7 @@ export default {
components: { components: {
PopMenu, PopMenu,
MapEdit, MapEdit,
// MapSaveAs, MapSaveAs,
MapPublish MapPublish
}, },
props: { props: {
@ -51,10 +51,10 @@ export default {
// label: this.$t('map.updateObjAxis'), // label: this.$t('map.updateObjAxis'),
// handler: this.updateObjAxis // handler: this.updateObjAxis
// }, // },
// { {
// label: this.$t('map.saveAs'), label: this.$t('map.saveAs'),
// handler: this.saveAs handler: this.saveAs
// }, },
{ {
label: this.$t('map.deleteObj'), label: this.$t('map.deleteObj'),
handler: this.deleteObj handler: this.deleteObj

View File

@ -462,7 +462,8 @@ export default {
}; };
if (data.state == '03') { // if (data.state == '03') { //
this.$router.push({ path: `/trainingPlatform/detail/${this.$route.query.subSystem}`, query: {mapId: this.mapId}}); // this.$router.push({ path: `/trainingPlatform/detail/${this.$route.query.subSystem}`, query: {mapId: this.mapId}});
this.$router.go(-1);
} else if (data.state == '01') { // } else if (data.state == '01') { //
this.starting = false; this.starting = false;
} else if (data.state == '02') { } else if (data.state == '02') {
@ -470,7 +471,7 @@ export default {
await putJointTrainingSimulationEntrance(param.group); await putJointTrainingSimulationEntrance(param.group);
const rest = await getPublishMapInfo(param.mapId); const rest = await getPublishMapInfo(param.mapId);
const query = { skinCode: rest.data.skinCode, mapId: param.mapId, group: param.group, subSystem: this.$route.query.subSystem }; const query = { skinCode: rest.data.skinCode, mapId: param.mapId, group: param.group, subSystem: this.$route.query.subSystem };
this.$router.push({ path: `/jointTraining`, query: query }); this.$router.replace({ path: `/jointTraining`, query: query });
launchFullscreen(); launchFullscreen();
} }
this.$store.dispatch('socket/setJointRoomInfo'); // this.$store.dispatch('socket/setJointRoomInfo'); //
@ -492,7 +493,7 @@ export default {
await putJointTrainingSimulationEntrance(this.$route.query.group); await putJointTrainingSimulationEntrance(this.$route.query.group);
const rest = await getPublishMapInfo(this.mapId); const rest = await getPublishMapInfo(this.mapId);
const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.$route.query.group, subSystem: this.$route.query.subSystem }; const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.$route.query.group, subSystem: this.$route.query.subSystem };
this.$router.push({ path: `/jointTraining`, query: query }); this.$router.replace({ path: `/jointTraining`, query: query });
launchFullscreen(); launchFullscreen();
}, },
// 线/线 // 线/线