设备登录调整

This commit is contained in:
fan 2020-06-24 18:40:48 +08:00
parent 92000b3d09
commit d7a5b555a2
6 changed files with 44 additions and 23 deletions

View File

@ -17,7 +17,8 @@ const user = {
admin: false,
wxId: '',
wxUnionId: '',
account: ''
account: '',
projectDevice: ''
},
mutations: {
@ -30,6 +31,9 @@ const user = {
SET_NICKNAME: (state, nickname) => {
state.nickname = nickname;
},
SET_PROJECTDEVICE: (state, projectDevice) => {
state.projectDevice = projectDevice;
},
SET_ROLES: (state, roles) => {
state.roles = roles;
},
@ -111,12 +115,15 @@ const user = {
GetInfo({ commit }, token) {
return new Promise((resolve, reject) => {
getInfo(token).then(response => {
const user = response.data;
const user = response.data.userVO;
if (user.roles && user.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', user.roles);
} else {
reject('getInfo: roles must be a non-null array !');
}
if (response.data.deviceVO) {
commit('SET_PROJECTDEVICE', response.data.deviceVO.code);
}
commit('SET_NAME', user.name);
commit('SET_NICKNAME', user.nickname);
commit('SET_ID', user.id);

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -110,16 +110,17 @@ import { setSessionStorage, removeSessionStorage } from '@/utils/auth';
import Cookies from 'js-cookie';
import md5 from 'js-md5';
import QrcodeVue from 'qrcode.vue';
import { getLoginWmurl, checkLoginStatus } from '@/api/login';
import { getLoginWmurl, checkLoginStatus, getInfo } from '@/api/login';
import { LoginParams } from '@/utils/login';
import bgImg from '@/assets/bg1.jpg';
import bgIbpImg from '@/assets/bg_ibp.png';
import { UrlConfig } from '@/scripts/ConstDic';
import { loginInfo, ProjectIcon, GenerateRouteProjectList, VersionBaseNoShow, MainBodyNoShow} from '@/scripts/ProjectConfig';
import { removeToken } from '@/utils/auth';
import { removeToken, getToken } from '@/utils/auth';
import LangStorage from '@/utils/lang';
import FloatPart from './floatPart';
import { getIsSignUp } from '@/api/competition';
import { getSimulationInfoNew } from '@/api/simulation';
export default {
name: 'Login',
@ -373,8 +374,12 @@ export default {
this.$router.push({ path: this.path, query:{ raceId:this.$route.query.raceId } });
}
} else if (this.$route.query.projectDevice) {
const query = { group: '', drawWay: true };
this.$router.push({ path: `/trainroom`, query: query });
getInfo(getToken()).then(res => {
getSimulationInfoNew(res.data.group).then(resp => {
const query = { group: res.data.group, drawWay: true, mapId: resp.data.map.id, lineCode:resp.data.map.lineCode };
this.$router.push({ path: `/jointTrainingNew`, query: query });
});
});
} else if (!this.$route.path.includes('jsxt/login') && !this.$route.path.includes('refereeJsxt/login')) {
this.$router.push({ path: this.path });
} else {

View File

@ -377,17 +377,18 @@ export default {
}
},
async getUserRole() {
const res = await getUserRolesNew(this.group);
const data = res.data || {};
this.userRole = data.userRole;
this.deviceCode = data.deviceCode;
this.ibpPart = data.ibpPart;
if (this.userRole === 'IBP') {
this.showIbp(this.deviceCode);
} else {
this.hideIbp();
}
return res;
// const res = await getUserRolesNew(this.group);
// const data = res.data || {};
// this.userRole = data.userRole;
// this.deviceCode = data.deviceCode;
// this.ibpPart = data.ibpPart;
// if (this.userRole === 'IBP') {
// this.showIbp(this.deviceCode);
// } else {
// this.hideIbp();
// }
// return res;
return '';
},
// 仿
async initLoadDemonData() {

View File

@ -34,7 +34,10 @@ export default {
{label: '信号机', value:'SIGNAL'},
{label: '屏蔽门', value: 'PSD'},
{label: 'IBP盘', value: 'IBP'},
{label: '车站', value: 'LW'}
{label: '车站', value: 'LW'},
{label: '教员机', value: 'IM'},
{label: '行调工作站', value: 'CW'},
{label: '综合监控', value: 'ISCS'}
],
projectList: [{label:'西铁院', value: 'XTY'}, {label: '贵州装备', value:'GZB'}],
gatewayList: []

View File

@ -34,7 +34,10 @@ export default {
{label: '信号机', value:'SIGNAL'},
{label: '屏蔽门', value: 'PSD'},
{label: 'IBP盘', value: 'IBP'},
{label: '车站', value: 'LW'}
{label: '现地工作站', value: 'LW'},
{label: '教员机', value: 'IM'},
{label: '行调工作站', value: 'CW'},
{label: '综合监控', value: 'ISCS'}
],
projectList: [{label:'西铁院', value: 'XTY'}, {label: '贵州装备', value:'GZB'}],
projectMap: {
@ -113,7 +116,7 @@ export default {
{
name: '登录路径',
handleClick: this.getPath,
showControl: (row) => { return row.type === 'LW' || row.type === 'IBP'; }
showControl: (row) => { return row.type !== 'SWITCH' && row.type !== 'SIGNAL' && row.type !== 'PSD'; }
}
]
}
@ -184,8 +187,10 @@ export default {
editConfig(index, row) {
if (row.type === 'LW' || row.type === 'IBP') {
this.$refs.editConfig.doShow(row);
} else {
} else if (row.type === 'SWITCH' || row.type === 'SIGNAL' || row.type === 'PSD') {
this.$refs.editConfigGateway.doShow(row);
} else {
this.$messageBox('暂无配置内容');
}
},
reloadTable() {