修改代码

This commit is contained in:
ival 2019-11-14 13:59:33 +08:00
parent 93546fe1fc
commit c5c813753c
108 changed files with 9988 additions and 9902 deletions

View File

@ -1,9 +1,9 @@
module.exports = {
presets: [
'@vue/app'
],
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-dynamic-import'
]
// plugins: [
// '@babel/plugin-transform-runtime',
// '@babel/plugin-syntax-dynamic-import'
// ]
};

View File

@ -6,13 +6,12 @@
</template>
<script>
import { handleToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import { getToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import { getSessionStorage } from '@/utils/auth';
import { ProjectIcon, loginInfo } from '@/scripts/ConstDic';
import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Cookies from 'js-cookie';
import { ProjectIcon } from '@/scripts/ConstDic';
import { logout } from '@/api/login';
export default {
name: 'App',
@ -27,6 +26,16 @@ export default {
if (val.creatorId) {
this.subscribeMessage(val);
}
},
'$store.state.socket.beLogout': async function(val) {
this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
callback: action => {
this.$store.dispatch('LogOut').then(resp => {
this.$router.push({path: loginInfo[getSessionStorage('project')].loginPath});
});
}
});
}
},
mounted() {
@ -40,28 +49,19 @@ export default {
window.addEventListener('unload', async e => {
gap_time = new Date().getTime() - beforeUnload_time;
if (gap_time <= 5) {
await this.pageDestory();
await this.$store.dispatch('LogOut');
}
});
window.addEventListener('beforeunload', async e => {
beforeUnload_time = new Date().getTime();
if (isFireFox) {
await this.pageDestory();
await this.$store.dispatch('LogOut');
}
});
this.subscribe();
},
methods: {
async pageDestory() {
this.clearSubscribe();
const token = handleToken();
Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken');
Cookies.remove('UserName');
Cookies.remove('UserToken');
await logout(token);
},
resizeHandler() {
this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight});
},
@ -78,17 +78,13 @@ export default {
},
subscribe() {
this.$nextTick(() => {
const token = handleToken();
const token = getToken();
if (token && this.$route.path != '/404') {
const header = { group: '', 'X-Token': token };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
}
});
},
clearSubscribe() {
clearSubscribe(perpetualTopic);
clearSubscribe(commonTopic);
}
}
};

View File

@ -76,17 +76,6 @@ export function simulationNotify({ mapId, mapPrdId }) {
});
}
/**
* 大屏系统CBTC
* @param {*} mapId
*/
export function bitScreenNotify({ mapId }) {
return request({
url: `/api/simulation/bigScreen/${mapId}`,
method: 'get'
});
}
/**
* 实训系统CBTC
* @param {*} data

View File

@ -125,7 +125,7 @@
</el-table-column>
</template>
</el-table>
<div v-if="queryList.selectCheckShow" style="margin-top: 8px; margin-left: 8px;">
<div v-if="!queryList.selectCheckShow" style="margin-top: 8px; margin-left: 8px;">
<el-button
size="mini"
:type="'primary'"

View File

@ -0,0 +1,41 @@
import Vue from 'vue';
import dLoading from './dialogLoading.vue';
const Mask = Vue.extend(dLoading);
const toggleLoading = (el, binding) => {
if (binding.value) {
Vue.nextTick(() => {
el.instance.visible = true;
});
} else {
el.instance.visible = false;
}
};
export default {
bind: function (em, binding, vnode) {
const el = em.querySelector('.el-dialog');
const mask = new Mask({
el: document.createElement('div'),
data () {}
});
el.instance = mask;
el.mask = mask.$el;
el.maskStyle = {};
el.appendChild(el.mask);
binding.value && toggleLoading(el, binding);
},
update: function (em, binding) {
const el = em.querySelector('.el-dialog');
if (binding.oldValue !== binding.value) {
toggleLoading(el, binding);
}
},
unbind: function (em, binding) {
const el = em.querySelector('.el-dialog');
el.instance && el.instance.$destroy();
}
};

View File

@ -0,0 +1,86 @@
<template>
<div v-show="visible" class="loading">
<div class="loading__container">
<div class="loader-inner ball-beat">
<div />
<div />
<div />
</div>
</div>
</div>
</template>
<script>
export default {
data () {
return {
visible: false
};
}
};
</script>
<style lang="scss" scoped>
.loading {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.5);
z-index:100;
&__container {
top: 50%;
margin-top: -30px;
position: absolute;
text-align: center;
width: 100%;
}
@-webkit-keyframes ball-beat {
50% {
opacity: 0.2;
-webkit-transform: scale(0.75);
transform: scale(0.75);
}
100% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes ball-beat {
50% {
opacity: 0.2;
-webkit-transform: scale(0.75);
transform: scale(0.75);
}
100% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
}
.ball-beat > div {
background-color: #279fcf;
width: 15px;
height: 15px;
border-radius: 100% !important;
margin: 2px;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
display: inline-block;
-webkit-animation: ball-beat 0.7s 0s infinite linear;
animation: ball-beat 0.7s 0s infinite linear;
}
.ball-beat > div:nth-child(2n-1) {
animation-delay: 0.35s !important;
}
}
</style>

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './dialogLoading';
const dialogLoading = function(Vue) {
Vue.directive('dialogLoading', install);
};
Vue.use(dialogLoading);

View File

@ -1,6 +1,8 @@
export default {
confirm: 'confirm',
cancel: 'cancel',
confirmLogin: 'Relanding',
logoutTips: 'You have been signed out. Please sign in again!',
creatingSuccessful: 'Created successfully!',
creatingFailed: 'Create a failure',
confirmDeletion: 'Confirm deletion?',

View File

@ -1,6 +1,8 @@
export default {
confirm: '确 定',
cancel: '取 消',
confirmLogin: '重新登陆',
logoutTips: '你已被登出,请重新登录',
creatingSuccessful: '创建成功!',
creatingFailed: '创建失败',
confirmDeletion: '是否确认删除?',

View File

@ -3,7 +3,7 @@ import StompClient from '@/utils/sock';
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
import { handleToken } from '@/utils/auth';
import { getToken } from '@/utils/auth';
import router from '@/router';
// 定于仿真socket接口
@ -41,7 +41,7 @@ export function Jl3dDriving(updatemmi, sound) {
var datatype = '00';
this.teststomp = new StompClient();
this.topic = '/user/queue/simulation/jl3d';
const header = {'X-Token': handleToken() };
const header = {'X-Token': getToken() };
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
// console.log(mapdata);

View File

@ -3,7 +3,7 @@ import StompClient from '@/utils/sock';
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
import { handleToken } from '@/utils/auth';
import { getToken } from '@/utils/auth';
import router from '@/router';
// 定于仿真socket接口
@ -41,7 +41,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
var datatype = '00';
this.teststomp = new StompClient();
this.topic = '/user/queue/simulation/jl3d';
const header = {'X-Token': handleToken() };
const header = {'X-Token': getToken() };
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
// console.log(mapdata);

View File

@ -1,6 +1,6 @@
import StompClient from '@/utils/sock';
import { displayTopic } from '@/utils/stomp';
import { handleToken } from '@/utils/auth';
import { getToken } from '@/utils/auth';
import router from '@/router';
// 定于仿真socket接口
@ -23,7 +23,7 @@ export function Jlmap3dSubscribe(worker) {
this.teststomp = new StompClient();
this.topic = displayTopic;
const header = { group: router.currentRoute.query.group, 'X-Token': handleToken() };
const header = { group: router.currentRoute.query.group, 'X-Token': getToken() };
this.updatamap = function (mapdata, materiallist, nowaction, scene) {
// console.log(mapdata);

View File

@ -402,19 +402,19 @@ export default {
if (this.operation == OperationEvent.Section.setSpeed.menu.operation) {
/** 区段设置限速*/
operate.operation = OperationEvent.Section.setSpeed.order.operation;
operate.message = this.$t('menu.in') + `${this.name}`+ this.$t('menu.sectionSetLimitPrefix') +`${this.speed}` + this.$t('menu.sectionLimitSuffix');
operate.message = this.$t('menu.in') + `${this.name}` + this.$t('menu.sectionSetLimitPrefix') + `${this.speed}` + this.$t('menu.sectionLimitSuffix');
} else if (this.operation == OperationEvent.Section.cancelSpeed.menu.operation) {
/** 区段取消限速*/
operate.operation = OperationEvent.Section.cancelSpeed.order.operation;
operate.message = this.$t('menu.in') + `${this.name}`+ this.$t('menu.sectionCancelLimitPrefix') +`${this.speed}` + this.$t('menu.sectionLimitSuffix');
operate.message = this.$t('menu.in') + `${this.name}` + this.$t('menu.sectionCancelLimitPrefix') + `${this.speed}` + this.$t('menu.sectionLimitSuffix');
} else if (this.operation == OperationEvent.Switch.setSpeed.menu.operation) {
/** 道岔设置限速*/
operate.operation = OperationEvent.Switch.setSpeed.order.operation;
operate.message = this.$t('menu.in') + `${this.name}`+ this.$t('menu.switchSetLimitPrefix') +`${this.speed}` + this.$t('menu.sectionLimitSuffix');
operate.message = this.$t('menu.in') + `${this.name}` + this.$t('menu.switchSetLimitPrefix') + `${this.speed}` + this.$t('menu.sectionLimitSuffix');
} else if (this.operation == OperationEvent.Switch.cancelSpeed.menu.operation) {
/** 道岔取消限速*/
operate.operation = OperationEvent.Switch.cancelSpeed.order.operation;
operate.message = this.$t('menu.in') + `${this.name}`+ this.$t('menu.switchCancelLimitPrefix') +`${this.speed}` + this.$t('menu.sectionLimitSuffix');
operate.message = this.$t('menu.in') + `${this.name}` + this.$t('menu.switchCancelLimitPrefix') + `${this.speed}` + this.$t('menu.sectionLimitSuffix');
}
this.setMessage(this.$t('tip.firstConfirmTip'));

View File

@ -115,7 +115,7 @@ export default {
if (!stationStand || !station) {
this.tempData.push({ item: this.$t('menu.runLevel'), status: this.$t('menu.automatic2') });
} else {
this.tempData.push({ item: this.$t('menu.runLevel'), status: opts.intervalRunTime > 0 ? this.$t('menu.to')+station.name+stationStand.name+ this.$t('global.colon') + this.$t('menu.artificial') : this.$t('menu.to')+station.name+stationStand.name+ this.$t('menu.automatic2') });
this.tempData.push({ item: this.$t('menu.runLevel'), status: opts.intervalRunTime > 0 ? this.$t('menu.to') + station.name + stationStand.name + this.$t('global.colon') + this.$t('menu.artificial') : this.$t('menu.to') + station.name + stationStand.name + this.$t('menu.automatic2') });
}
this.tempData.push({ item: this.$t('menu.jumpStop'), status: opts.jumpStopStatus != '01' ? this.$t('menu.hasBeenSet') : this.$t('menu.notSet') });
this.tempData.push({ item: this.$t('menu.downSwitchbackStrategy'), status: this.strategyMap[opts.reentryStrategy] ? this.strategyMap[opts.reentryStrategy] : this.$t('menu.default') });

View File

@ -84,12 +84,8 @@ export default {
} else if (this.operation == OperationEvent.Switch.turnoutForce.menu.operation) {
return this.$t('menu.menuSwitch.switchForcedPull');
} else if (this.operation == OperationEvent.Switch.split.menu.operation) {
this.activeShow = true;
this.radio = '2';
return this.$t('menu.menuSwitch.sectionResection');
} else if (this.operation == OperationEvent.Switch.active.menu.operation) {
this.activeShow = true;
this.radio = '1';
return this.$t('menu.menuSwitch.sectionActive');
}
return '';
@ -112,7 +108,15 @@ export default {
this.stationName = station.name;
}
}
this.operation = operate.operation;
if (this.operation == OperationEvent.Switch.split.menu.operation) {
this.activeShow = true;
this.radio = '2';
} else if (this.operation == OperationEvent.Switch.active.menu.operation) {
this.activeShow = true;
this.radio = '1';
}
}
this.dialogShow = true;
this.$nextTick(function () {

View File

@ -288,7 +288,7 @@ export default {
const index = this.tableData.indexOf(this.tableData.find(elem => { return elem.jobNumber === data.jobNumber; }));
if (index >= 0) {
this.tableData.splice(index, 1);
this.selected=null;
this.selected = null;
} else {
this.$messageBox(this.$t('menu.menuDialog.deleteFail'));
}

View File

@ -82,10 +82,10 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/ConstDic';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/ConstDic';
export default {
export default {
name: 'AlarmDetail',
data() {
return {
@ -203,7 +203,7 @@
return this.dialogShow;
}
}
};
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,6 +1,6 @@
<template>
<el-dropdown class="avatar-container" trigger="hover" :show-timeout="100" style="height:58px">
<div class="avatar-wrapper" >
<div class="avatar-wrapper">
<span style="color: white;">
{{ username }}
</span>

View File

@ -1,9 +1,9 @@
<template>
<el-dialog v-dialogDrag :title="$t('global.chooseRoom')" :visible.sync="centerDialogVisible" width="30%" center>
<el-dialog v-dialogDrag :title="$t('global.chooseRoom')" :visible.sync="dialogShow" width="30%" center>
<el-input v-model="input" :placeholder="$t('global.inputRoomNumber')" />
<span slot="footer" class="dialog-footer">
<el-button @click="centerDialogVisible = false">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" @click="comit">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
<el-button v-loading="loading" :disabled="!input.length" type="primary" @click="comit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
@ -15,8 +15,9 @@ export default {
name: 'Dashboard',
data() {
return {
centerDialogVisible: false,
input: ''
input: '',
dialogShow: false,
loading: false
};
},
computed: {
@ -26,21 +27,20 @@ export default {
},
methods: {
doShow() {
this.centerDialogVisible = true;
this.dialogShow = true;
},
doClose() {
this.centerDialogVisible = false;
this.dialogShow = false;
},
async comit() {
if (this.input) {
try {
this.loading = true;
await getPermissionJoint(`${this.input}`);
this.centerDialogVisible = false;
this.dialogShow = false;
} catch (error) {
this.$messageBox(`${this.$t('error.scanningError')}:${error.message}`);
}
} else {
this.$messageBox(this.$t('global.inputRoomNumber'));
} finally {
this.loading = false;
}
}
}

View File

@ -9,7 +9,7 @@
import logoImg from '@/assets/logo_changan.png';
import logoImgXty from '@/assets/logo_xty.png';
import { getSessionStorage } from '@/utils/auth';
import { loginTitle } from '@/scripts/ConstDic';
import { loginInfo } from '@/scripts/ConstDic';
export default {
data() {
@ -20,7 +20,7 @@ export default {
},
mounted() {
const project = getSessionStorage('project');
this.systemTitle = loginTitle[project];
this.systemTitle = loginInfo[project].title;
if (project.endsWith('xty')) {
this.logoImg = logoImgXty;
} else {

View File

@ -20,6 +20,7 @@ import '@/permission'; // permission control
import '@/scripts/GlobalPlugin';
import '@/directive/dialogDrag/index.js';
import '@/directive/dialogDragWidth/index.js';
import '@/directive/dialogLoading/index.js';
import '@/directive/drag/index.js';
import '@/directive/focus/index.js';
import '@/directive/quickMenuDrag/index.js';

View File

@ -1,10 +1,9 @@
import Vue from 'vue';
import store from '@/store';
import router from './router';
import NProgress from 'nprogress'; // Progress 进度条
// import 'nprogress/nprogress.css';// Progress 进度条样式
import NProgress from 'nprogress';
import { admin, userDesign} from './router';
import { getToken, getDesignToken} from '@/utils/auth'; // 验权
import { getToken} from '@/utils/auth';
import { LoginParams } from '@/utils/login';
import { getSessionStorage } from '@/utils/auth';
import localStore from 'storejs';
@ -28,44 +27,37 @@ const loginDesignXtyPage = whiteList[3];
// 获取路径数据
function getRouteInfo(to) {
let loginPath = '/';
let getTokenInfo = () => { };
let clientId = '';
const toRoutePath = to.redirectedFrom || to.path;
if (/^\/designxty/.test(toRoutePath)) {
loginPath = loginDesignXtyPage;
getTokenInfo = getDesignToken;
clientId = LoginParams.Design.clientId;
} else if (/^\/design/.test(toRoutePath) || /^\/scriptDisplay/.test(toRoutePath) || /^\/publish/.test(toRoutePath) || /^\/orderauthor/.test(toRoutePath) || /^\/system/.test(toRoutePath) || /^\/display\/record/.test(toRoutePath) || /^\/display\/manage/.test(toRoutePath) || /^\/apply/.test(toRoutePath)) {
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
getTokenInfo = getDesignToken;
clientId = LoginParams.Design.clientId;
} else if (/^\/plan/.test(toRoutePath) || /^\/display\/plan/.test(toRoutePath)) {
if (getSessionStorage('project').startsWith('design')) {
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
getTokenInfo = getDesignToken;
clientId = LoginParams.Design.clientId;
} else {
loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
getTokenInfo = getToken;
clientId = null;
}
} else if ( /^\/xty/.test(toRoutePath)) {
loginPath = loginXtyPage;
getTokenInfo = getToken;
clientId = null;
} else {
loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
getTokenInfo = getToken;
clientId = null;
}
return { clientId, loginPath, getTokenInfo };
return { clientId, loginPath };
}
function handleRoute(to, from, next, routeInfo) {
if (store.getters.roles.length === 0) {
// 拉取用户信息
store.dispatch('GetInfo', routeInfo.getTokenInfo).then(res => {
store.dispatch('GetInfo', getToken()).then(res => {
// 根据roles权限生成可访问的路由表
const roles = res.roles;
if (getSessionStorage('project').startsWith('design')) {
@ -83,7 +75,7 @@ function handleRoute(to, from, next, routeInfo) {
});
}).catch(() => {
store.dispatch('FedLogOut', routeInfo.clientId).then(() => {
store.dispatch('FedLogOut').then(() => {
Vue.prototype.$messageBox('验证失败,请重新登录!');
next({ path: routeInfo.loginPath });
});
@ -104,9 +96,8 @@ function handleRoute(to, from, next, routeInfo) {
router.beforeEach((to, from, next) => {
NProgress.start();
const routeInfo = getRouteInfo(to);
if (routeInfo.getTokenInfo()) {
if (getToken()) {
// 已登录
if (to.path === routeInfo.loginPath) {
// 登录页面不拦截

View File

@ -101,7 +101,7 @@ const ScriptApproval = () => import('@/views/approval/script/index');
const RunPlanApproval = () => import('@/views/approval/runPlan/index');
const News = () => import('@/views/news/index');
import { loginTitle } from '@/scripts/ConstDic';
import { loginInfo } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth';
/**
@ -863,7 +863,7 @@ const router = createRouter();
router.beforeEach((to, from, next) => {
const project = getSessionStorage('project');
document.title = loginTitle[project || 'login'];
document.title = loginInfo[project || 'login'].title;
next();
});

View File

@ -2200,12 +2200,26 @@ export const IbpOperation = {
import LangStorage from '@/utils/lang';
import Favicon from '@/assets/icon/favicon.png';
import FaviconXty from '@/assets/icon/favicon_xty.png';
export const loginTitle = {
xty: '西安铁路职业技术学院城市轨道交通实训平台',
login: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Practical Training Platform' : '城市轨道交通实训平台',
design: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Design Platform' : '城市轨道交通设计平台',
designxty: '西安铁路职业技术学院城市轨道交通设计平台'
export const loginInfo = {
xty: {
title: '西安铁路职业技术学院城市轨道交通实训平台',
loginPath: '/xty/login'
},
login: {
title: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Practical Training Platform' : '城市轨道交通实训平台',
loginPath: '/login'
},
design: {
title: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Design Platform' : '城市轨道交通设计平台',
loginPath: '/design/login'
},
designxty: {
title: '西安铁路职业技术学院城市轨道交通设计平台',
loginPath: '/designxty/login'
}
};
export const ProjectIcon = {
xty: FaviconXty,
login: Favicon,

View File

@ -27,38 +27,17 @@ function setHonePagePath(route, roles) {
function hasPermission(roles, route, parentsRoles) {
setHonePagePath(route, roles);
if (route.meta && route.meta.roles) {
// 如果存在本级路由则使用自己的roles过滤
// 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 = false;
// } else if (route.meta.roles.indexOf(user)>=0 && roles.indexOf(user)>=0) {
// route.hidden = false;
// } else {
// route.hidden = true;
// }
// }
// } else {
// if (route.meta.roles.indexOf(userDesign)>0) {
// route.hidden = true;
// }
// }
// return roles.some(role => route.meta.roles.indexOf(role) >= 0);
if (getSessionStorage('project').startsWith('design')) {
roles= roles.filter(function (role) {
roles = roles.filter(function (role) {
return route.meta.roles.indexOf(role) >= 0;
});
const result=roles.every(role => route.meta.roles.indexOf(role) >= 0);
return result && ((roles.indexOf(admin)>=0 && route.meta.roles.indexOf(admin)>=0) || (roles.indexOf(user)>=0 && route.meta.roles.indexOf(user)>=0 ));
const result = roles.every(role => route.meta.roles.indexOf(role) >= 0);
return result && ((roles.indexOf(admin) >= 0 && route.meta.roles.indexOf(admin) >= 0) || (roles.indexOf(user) >= 0 && route.meta.roles.indexOf(user) >= 0 ));
} else {
roles= roles.filter(function (role) {
roles = roles.filter(function (role) {
return route.meta.roles.indexOf(role) >= 0;
});
return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userDesign)<0;
return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userDesign) < 0;
}
} else if (parentsRoles) {
// 如果没有本级路由,有父级路由,则使用父级路由过滤
@ -95,7 +74,7 @@ function convertRouterRoles({ roles, permissionType }) {
*/
function filterAsyncRouter(asyncRouter, roles, parentsRoles) {
return asyncRouter.filter(route => {
if (route.name === '大屏系统' && roles.indexOf(admin)===-1 && roles.indexOf(userScreen) ===-1) {
if (route.name === '大屏系统' && roles.indexOf(admin) == -1 && roles.indexOf(userScreen) == -1) {
route.hidden = true;
}
if (hasPermission(roles, route, parentsRoles)) {
@ -124,16 +103,11 @@ const permission = {
GenerateRoutes({ commit }, data) {
return new Promise(resolve => {
const { roles } = convertRouterRoles(data);
let accessedRouters;
if (roles.indexOf(superAdmin) >= 0 && roles.indexOf(admin) < 0) {
roles.push(admin);
}
// if (roles.indexOf(superAdmin) >= 0) {
// accessedRouters = asyncRouter;
// } else {
// eslint-disable-next-line prefer-const
accessedRouters = filterAsyncRouter(asyncRouter, roles);
// }
const accessedRouters = filterAsyncRouter(asyncRouter, roles);
commit('SET_ROUTERS', accessedRouters);
resolve();
});

View File

@ -9,6 +9,9 @@ function handle(state, data) {
case 'Order_Pay_Result': // 订单支付结果消息
state.payOrder = msg;
break;
case 'Be_Logged_Out': // 重复登录被登出
state.beLogout = msg;
break;
case 'JointTraining_Room': // 综合演练室-房间消息
if (!path.includes('/plan') || !path.includes('/dp/')) {
state.jointRoomInfo = msg; // 房间信息
@ -193,6 +196,7 @@ const socket = {
state: {
payOrder: {}, // 支付消息
beLogout: {}, // 被登出
jointRoomInfo: {}, // 受邀请房间信息
chatContent: {}, // 聊天室聊天内容
roleList: [], // 设置角色信息

View File

@ -1,15 +1,14 @@
import { setSessionStorage } from '@/utils/auth';
import { login, logout, getInfo } from '@/api/login';
import { getToken, setToken, removeToken, getDesignToken, setDesignToken, removeDesignToken, handleToken, handleRemoveToken } from '@/utils/auth';
import { getToken, setToken, removeToken } from '@/utils/auth';
import { getUserConfigInfo } from '@/api/management/user';
import { LoginParams } from '@/utils/login';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import Cookies from 'js-cookie';
const user = {
state: {
token: getToken(),
tokenDesign: getDesignToken(),
name: '',
nickname: '',
nationcode: '',
@ -25,15 +24,6 @@ const user = {
SET_TOKEN: (state, token) => {
state.token = token;
},
SET_TOKENSCREEN: (state, token) => {
state.tokenScreen = token;
},
SET_TOKENDESIGN: (state, token) => {
state.tokenDesign = token;
},
SET_TOKENPLAN: (state, token) => {
state.tokenPlan = token;
},
SET_NAME: (state, name) => {
state.name = name;
},
@ -57,6 +47,12 @@ const user = {
},
SET_ACCOUNT: (state, account) => {
state.account = account;
},
CLEAR_AUTO_PARAMS: () => {
Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken');
Cookies.remove('UserName');
Cookies.remove('UserToken');
}
},
@ -67,21 +63,15 @@ const user = {
const password = userInfo.password.trim();
return new Promise((resolve, reject) => {
let params = null;
let execFc = null;
let execFunc = null;
if (userInfo.type == 'design') {
params = Object.assign({ account: username, password }, LoginParams.Design);
execFc = (token) => {
setDesignToken(token);
commit('SET_TOKENDESIGN', token);
const header = { group: '', 'X-Token': getDesignToken() };
execFunc = (header) => {
creatSubscribe(commonTopic, header);
};
} else {
params = Object.assign({ account: username, password }, LoginParams.LianKeTang);
execFc = (token) => {
setToken(token);
commit('SET_TOKEN', token);
const header = { group: '', 'X-Token': getToken() };
execFunc = (header) => {
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
};
@ -89,7 +79,10 @@ const user = {
// 登录系统
login(params).then(resp => {
execFc(resp.data);
const token = resp.data;
commit('SET_TOKEN', token);
setToken(token);
execFunc({ group: '', 'X-Token': token });
resolve();
}).catch(error => { reject(error); });
});
@ -113,9 +106,9 @@ const user = {
},
// 获取用户信息
GetInfo({ commit }, getTokenInfo) {
GetInfo({ commit }, token) {
return new Promise((resolve, reject) => {
getInfo(getTokenInfo()).then(response => {
getInfo(token).then(response => {
const user = response.data;
if (user.roles && user.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', user.roles);
@ -145,39 +138,29 @@ const user = {
}
});
},
// 前端登出
FedLogOut({ commit }, clientId) {
return new Promise(resolve => {
if (clientId == LoginParams.Design.clientId) {
commit('SET_TOKENDESIGN', '');
removeDesignToken();
} else {
FedLogOut({ commit }) {
clearSubscribe(perpetualTopic);
clearSubscribe(commonTopic);
commit('SET_TOKEN', '');
commit('SET_ID', '');
removeToken();
}
resolve();
});
},
// 登出系统
LogOut({ commit }) {
LogOut({ commit, dispatch }) {
// 清楚自动登陆参数
commit('CLEAR_AUTO_PARAMS');
const token = getToken();
return new Promise((resolve, reject) => {
logout(handleToken()).then(() => {
commit('SET_TOKEN', '');
commit('SET_ROLES', []);
commit('SET_ID', '');
Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken');
Cookies.remove('UserName');
Cookies.remove('UserToken');
handleRemoveToken();
dispatch('FedLogOut').then(resp => {
logout(token).then(() => {
resolve();
}).catch(error => {
reject(error);
});
});
});
},
SetAccount({ commit }, account) {

View File

@ -1,10 +1,8 @@
import SessionStorage from 'sessionstorage';
import { LoginParams } from '@/utils/login';
const TokenKey = 'Admin-Token';
const TokenDesignKey = 'Design-Token';
// 设置教学实训仿真系统token
// 设置教学实训仿真系统token, 设置城市轨道交通设计平台token
export function getToken() {
return SessionStorage.getItem(TokenKey);
}
@ -15,17 +13,6 @@ export function removeToken() {
return SessionStorage.removeItem(TokenKey);
}
// 设置城市轨道交通设计平台token
export function getDesignToken() {
return SessionStorage.getItem(TokenDesignKey);
}
export function setDesignToken(token) {
return SessionStorage.setItem(TokenDesignKey, token);
}
export function removeDesignToken() {
return SessionStorage.removeItem(TokenDesignKey);
}
// 操作sessionStorage
export function getSessionStorage(key) {
return SessionStorage.getItem(key);
@ -36,42 +23,3 @@ export function setSessionStorage(key, value) {
export function removeSessionStorage(key) {
return SessionStorage.removeItem(key);
}
// 根据路径判断获取token
export function handleToken() {
const path = window.location.href;
if (path.includes('/design') || path.includes('/scriptDisplay') || path.includes('/publish') || path.includes('/orderauthor') || path.includes('/system') || path.includes('/display/manage') || path.includes('/apply/')) {
return getDesignToken();
} else if (path.includes('/plan') || path.includes('/display/plan')) {
return getDesignToken() || getToken();
} else {
return getToken();
}
}
// 根据路径清除token
export function handleRemoveToken() {
const path = window.location.href;
if (path.includes('/design') || path.includes('/scriptDisplay') || path.includes('/plan') || path.includes('/publish') || path.includes('/orderauthor') || path.includes('/system') || path.includes('/display/plan') || path.includes('/display/manage') || path.includes('/apply/')) {
return removeDesignToken();
} else {
return removeToken();
}
}
// 根据route路径判断系统类型
export function gainClientId() {
const path = window.location.href;
let clientId = null;
if (path.includes('/dp/') || path.includes('/display/dp')) {
clientId = LoginParams.DaPing.clientId;
}
// else if (path.includes('/plan') || path.includes('/display/plan')) {
// clientId = LoginParams.LianJiHua.clientId;
// }
else if (path.includes('/design') || path.includes('/scriptDisplay') || path.includes('/plan') || path.includes('/publish') || path.includes('/orderauthor') || path.includes('/system') || path.includes('/display/plan') || path.includes('/display/manage') || path.includes('/apply/')) {
clientId = LoginParams.Design.clientId;
}
return clientId;
}

View File

@ -3,8 +3,8 @@ 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 = 'http://192.168.3.5:9000'; // 袁琪
// 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.41:9000'; // 杜闪
// BASE_API = 'http://192.168.3.82:9000'; // 杜康

View File

@ -2,8 +2,6 @@
// 登陆配置参数
export const LoginParams = {
LianKeTang: { clientId: '1', secret: 'joylink' }, // "城市轨道交通实训平台"
// DaPing: { clientId: '2', secret: 'bigscreen' }, // "大屏系统"
// LianJiHua: { clientId: '3', secret: 'linkplan' }, // "琏计划"
Assistant: { clientId: '4', secret: 'linkassistant' }, // "琏课堂助手"
Design: { clientId: '2', secret: 'design' } // "城市轨道交通设计平台"
};

View File

@ -1,7 +1,7 @@
import axios from 'axios';
import store from '../store';
import { MessageBox } from 'element-ui';
import { handleToken, gainClientId } from '@/utils/auth';
import { getToken } from '@/utils/auth';
import { getBaseUrl } from '@/utils/baseUrl';
import { EventBus } from '@/scripts/event-bus';
@ -16,8 +16,8 @@ const service = axios.create({
// request拦截器
service.interceptors.request.use(config => {
if (handleToken()) {
config.headers['X-Token'] = handleToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
if (getToken()) {
config.headers['X-Token'] = getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
}
if (config.time) {
config.timeout = config.time; // 让每个请求携带自定义token 请根据实际情况自行修改
@ -42,12 +42,12 @@ service.interceptors.response.use(
EventBus.$emit('viewLoading', false);
// eslint-disable-next-line no-undef
EventBus.$emit('clearCheckLogin');
MessageBox.confirm('你已被登出,请重新登录', '确定登出', {
confirmButtonText: '重新登录',
MessageBox.confirm(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirmLogin'),
showCancelButton: false,
type: 'warning'
}).then(() => {
store.dispatch('FedLogOut', gainClientId()).then(() => {
store.dispatch('FedLogOut').then(() => {
location.reload();// 为了重新实例化vue-router对象 避免bug
});
});

View File

@ -1,9 +1,8 @@
import { handleToken } from '@/utils/auth';
import { getToken } from '@/utils/auth';
import { checkLoginLine } from '@/api/login';
import { getBaseUrl } from '@/utils/baseUrl';
import { MessageBox } from 'element-ui';
import store from '../store';
import { gainClientId } from '@/utils/auth';
var SockJS = require('sockjs-client');
var Stomp = require('stompjs');
@ -13,7 +12,7 @@ const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`;
// const websocketUrl = `http://192.168.3.6:9000/joylink-websocket?token=`;
var StompClient = function (headers) {
this.url = websocketUrl + handleToken();
this.url = websocketUrl + getToken();
this.headers = headers || {};
this.connect();
};
@ -32,7 +31,7 @@ StompClient.prototype = {
sockStatus: 0,
headers: {
// 'X-Token': handleToken()
// 'X-Token': getToken()
},
count: 0,
@ -54,7 +53,7 @@ StompClient.prototype = {
}
// 建立连接对象(还未发起连接)
this.socket = new SockJS(websocketUrl + handleToken());
this.socket = new SockJS(websocketUrl + getToken());
// 获取 STOMP 子协议的客户端对象
this.clientIns = Stomp.over(this.socket);
@ -62,7 +61,7 @@ StompClient.prototype = {
this.closeStompDebug();
// 向服务器发起websocket连接并发送CONNECT帧
this.clientIns.connect({ 'X-Token': handleToken() }, () => {
this.clientIns.connect({ 'X-Token': getToken() }, () => {
console.info('连接成功.');
this.count = 0;
this.status = true;
@ -121,7 +120,7 @@ StompClient.prototype = {
this.logOut();
}
if (err.code == 50008 || err.code == 50014) {
this.url = websocketUrl + handleToken();
this.url = websocketUrl + getToken();
this.connect();
}
});
@ -139,13 +138,13 @@ StompClient.prototype = {
showCancelButton: false,
type: 'warning'
}).then(() => {
store.dispatch('FedLogOut', gainClientId()).then(() => {
store.dispatch('FedLogOut').then(() => {
location.reload();// 为了重新实例化vue-router对象 避免bug
});
});
}
if (err.code == 50008 || err.code == 50014) {
this.url = websocketUrl + handleToken();
this.url = websocketUrl + getToken();
this.status = false;
this.count++;
this.reconnect(this.count);

View File

@ -10,9 +10,9 @@ export const commonTopic = '/topic/message'; // 公共topic(不区分用户)
// 建立连接并订阅地址
export function creatSubscribe(topic, header) {
if ([displayTopic, planTopic, designDisplayTopic].includes(topic)) {
topic = `${topic}/${header.group}`;
}
// if ([displayTopic, planTopic, designDisplayTopic].includes(topic)) {
// topic = `${topic}/${header.group}`;
// }
try {
if (!Vue.prototype.$stomp) {

View File

@ -1,6 +1,7 @@
<template>
<el-dialog
v-dialogDrag
v-dialogLoading="pageLoading"
:title="title"
:visible.sync="show"
width="600px"
@ -12,25 +13,26 @@
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"
node-key="group"
class="filter-tree"
default-expand-all
:data="trainingList"
:props="defaultProps"
default-expand-all
:filter-node-method="filterNode"
:style="{height: height+'px'}"
@node-click="clickEvent"
>
<span slot-scope="{ node, data }">
<div slot-scope="{ node, data }" class="list-elem">
<span v-if="data.state=='01'">{{ '['+data.mapName+']'+($t('global.trainingNotStart').replace('{name}', data.creator.nickName)) }}</span>
<span v-else>{{ '['+data.mapName+']'+($t('global.trainingHasStart').replace('{name}', data.creator.nickName)) }}</span>
</span>
</div>
</el-tree>
</el-scrollbar>
<span
slot="footer"
class="dialog-footer"
>
<el-button type="primary" @click="handleJoin">{{ $t('global.joinRoom') }}</el-button>
<el-button v-loading="loading" type="primary" :disabled="!group" @click="handleJoin">{{ $t('global.joinRoom') }}</el-button>
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
@ -46,7 +48,6 @@ export default {
data() {
return {
dialogShow: false,
loading: false,
height: 120,
trainingList: [],
defaultProps: {
@ -54,7 +55,9 @@ export default {
},
group: '',
state: '',
mapId: ''
mapId: '',
loading: false,
pageLoading: false
};
},
computed: {
@ -81,25 +84,34 @@ export default {
this.group = obj.group;
this.mapId = obj.mapId;
},
async getList() {
async doShow() {
try {
this.pageLoading = true;
this.dialogShow = true;
this.loading = false;
const res = await getjointTrainList();
this.trainingList = res.data;
} catch (error) {
console.error(error);
this.trainingList = res.data || [];
this.$nextTick(() => {
var training = this.trainingList[0] || {};
if (training) {
this.state = training.state;
this.group = training.group;
this.mapId = training.mapId;
this.$refs.tree.setCurrentKey(this.group);
}
});
} catch (e) {
console.error(e);
} finally {
this.pageLoading = false;
}
},
doShow() {
this.getList();
this.loading = false;
this.dialogShow = true;
},
doClose() {
this.loading = false;
async doClose() {
this.dialogShow = false;
},
async handleJoin() {
if (this.group) {
try {
this.loading = true;
await getjointTraining(this.group);
if (this.state == '02') {
launchFullscreen();
@ -111,8 +123,10 @@ export default {
const query = { group: this.group };
this.$router.push({ path: `/trainroom`, query: query });
}
} else {
this.$message.info(this.$t('global.pleaseChooseRoom'));
} catch (e) {
console.error(e);
} finally {
this.loading = false;
}
}
}
@ -127,6 +141,10 @@ export default {
.el-tree {
overflow: hidden !important;
.list-elem {
height: 30px;
line-height: 30px;
}
}
.el-tree-node.is-current>.el-tree-node__content {

View File

@ -11,7 +11,7 @@
>
<div style="height: 80px; line-height: 80px; font-size: 16px; padding-left: 10px;">{{ roomName }}{{ $t('global.inviteJoinRoom') }}</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleJoin">{{ $t('global.confirm') }}</el-button>
<el-button v-loading="loading" type="primary" @click="handleJoin">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
@ -30,7 +30,8 @@ export default {
group: '',
roomName: '',
state: '',
mapId: ''
mapId: '',
loading: false
};
},
computed: {
@ -50,11 +51,14 @@ export default {
this.state = data.state;
this.mapId = data.mapId;
this.dialogShow = true;
this.loading = false;
},
doClose() {
this.dialogShow = false;
},
async handleJoin() {
try {
this.loading = true;
if (this.state == '02') {
launchFullscreen();
await putJointTrainingSimulationEntrance(this.group);
@ -66,7 +70,12 @@ export default {
this.$router.push({ path: `/trainroom`, query: query });
}
this.dialogShow = false;
getjointTraining(this.group);
await getjointTraining(this.group);
} catch (e) {
console.error(e);
} finally {
this.loading = false;
}
}
}
};

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-dialogDrag v-loading="loadingUpload" :title="$t('map.createNewMap')" :visible.sync="dialogShow" width="30%" :close-on-click-modal="false" :before-close="handleClose">
<el-dialog v-dialogDrag v-dialogLoading="loadingUpload" :title="$t('map.createNewMap')" :visible.sync="dialogShow" width="30%" :close-on-click-modal="false" :before-close="handleClose">
<div>
<el-tabs v-model="activeTab" type="card">
<el-tab-pane :label="$t('map.normalCreate')" name="first">
@ -126,12 +126,14 @@ export default {
},
initLoadData() {
this.lineCodeList = [];
getLineCodeList().then(response => {
this.lineCodeList = response.data;
});
this.$Dictionary.cityType().then(list => {
this.cityList = list;
});
getLineCodeList().then(response => {
this.lineCodeList = response.data;
});
getMapListByProject().then(response => {
this.publishMapList = response.data;
}).catch(() => {

View File

@ -2,7 +2,7 @@
<div>
<div v-show="showChat && !minimize" class="reminder-drag">
<div class="tabs-roles">
<div class="roles roles-first">{{$t('display.chatBox.chatWindow')}}</div>
<div class="roles roles-first">{{ $t('display.chatBox.chatWindow') }}</div>
<div class="minimality" @click="handleMinimality('min')">
<i class="el-icon-remove" />
</div>
@ -52,12 +52,12 @@
</div>
</div>
<div class="switch-box">
<span style="font-size: 12px;">{{$t('display.chatBox.autoplay')}}</span>
<span style="font-size: 12px;">{{ $t('display.chatBox.autoplay') }}</span>
<el-switch v-model="isAutoPlay" active-color="#13ce66" inactive-color="#d6d6d6" />
</div>
</div>
<div v-show="showChat && minimize" class="reminder-drag minimize-box">
<div class="chat-title">{{$t('display.chatBox.chatWindow')}}</div>
<div class="chat-title">{{ $t('display.chatBox.chatWindow') }}</div>
<div class="minimality" @click="handleMinimality('max')">
<i class="el-icon-circle-plus" />
</div>

View File

@ -1,6 +1,7 @@
<template>
<el-dialog
v-dialogDrag
v-dialogLoading="dialogLoading"
:title="title"
:visible.sync="dialogShow"
width="100%"
@ -151,7 +152,8 @@ export default {
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {},
runPlanData: {}
runPlanData: {},
dialogLoading: false
};
},
computed: {
@ -195,14 +197,21 @@ export default {
}
},
methods: {
doShow() {
async doShow() {
try {
this.dialogLoading = true;
this.dialogShow = true;
this.loadInitData(this.series);
} catch (e) {
console.error(e);
} finally {
this.dialogLoading = false;
}
},
doClose() {
async doClose() {
this.dialogShow = false;
},
loadChartPage() {
async loadChartPage() {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
this.series = [];

View File

@ -15,8 +15,8 @@
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="show = false">{{$t('global.cancel')}}</el-button>
<el-button type="primary" :loading="status" @click="handleSure">{{$t('global.confirm')}}</el-button>
<el-button @click="show = false">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" :loading="status" @click="handleSure">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>

View File

@ -43,10 +43,10 @@
</el-tabs>
</div>
<div class="btn-buy">
<el-button type="success" @click="buy">{{ $t('exam.buy') }}</el-button>
<el-button v-if="hasPermssion" type="primary" @click="distribute">{{ $t('exam.distributePermission') }}</el-button>
<el-button v-if="hasPermssion" type="primary" @click="transfer">{{ $t('global.transferQRCode') }}</el-button>
<el-button v-if="isAddRule" type="primary" @click="checkCourse">{{ $t('exam.viewCoursePapers') }}</el-button>
<el-button v-loading="loading" type="success" @click="buy">{{ $t('exam.buy') }}</el-button>
<el-button v-if="hasPermssion" v-loading="loading" type="primary" @click="distribute">{{ $t('exam.distributePermission') }}</el-button>
<el-button v-if="hasPermssion" v-loading="loading" type="primary" @click="transfer">{{ $t('global.transferQRCode') }}</el-button>
<el-button v-if="isAddRule" v-loading="loading" type="primary" @click="checkCourse">{{ $t('exam.viewCoursePapers') }}</el-button>
<el-button type="primary" @click="backLessonList">{{ $t('exam.returnCourseList') }}</el-button>
</div>
</el-card>
@ -156,20 +156,23 @@ export default {
path: `${UrlConfig.trainingPlatform.examRuleManage}`,
query: { lessonId: this.courseModel.id }
});
this.loading = false;
},
transfer() { //
this.loading = false;
this.loading = true;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.transfer(this.courseModel);
}
this.loading = false;
},
distribute() { //
this.loading = false;
this.loading = true;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.distribute(this.courseModel);
}
this.loading = false;
},
clickEvent(obj, node, data) {
if (this.valid || obj.trial) {

View File

@ -16,10 +16,10 @@
<el-radio v-model="selected" :label="item"><span>{{ item.name }}</span></el-radio>
</li>
</ul>
<span v-else class="tipLable"> {{$t('global.temporarilyNoData')}} </span>
<span v-else class="tipLable"> {{ $t('global.temporarilyNoData') }} </span>
<span slot="footer" class="dialog-footer">
<el-button @click="doClose">{{$t('global.cancel')}}</el-button>
<el-button type="primary" :loading="loading" @click="commit">{{$t('global.confirm')}}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="commit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>

View File

@ -56,8 +56,8 @@
</div>
<div class="draft">
<el-button-group>
<el-button v-show="!isEdit" type="primary" @click="create">{{ $t('global.append') }}</el-button>
<el-button v-show="isEdit" type="primary" @click="update">{{ $t('global.update') }}</el-button>
<el-button v-show="!isEdit" v-loading="loading" type="primary" @click="create">{{ $t('global.append') }}</el-button>
<el-button v-show="isEdit" v-loading="loading" type="primary" @click="update">{{ $t('global.update') }}</el-button>
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
@ -99,7 +99,8 @@ export default {
detail: {
mapId: '',
prdId: ''
}
},
loading: false
};
},
computed: {
@ -188,10 +189,13 @@ export default {
create() {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
createLessonChapter(this.chapterModel).then(response => {
this.$emit('refresh');
this.$message.success(this.$t('tip.createSuccess'));
this.loading = false;
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('error.refreshFailed'));
});
}
@ -200,11 +204,14 @@ export default {
update() {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
updateLessonChapter(this.chapterModel).then(response => {
this.$emit('refresh');
this.$message.success(this.$t('tip.updateSuccessfully'));
this.loading = false;
}).catch(() => {
this.$messageBox(this.$t('error.refreshFailed'));
this.loading = false;
});
}
});

View File

@ -2,7 +2,7 @@
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="25%" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
@ -23,7 +23,8 @@ export default {
parameter: this.$route.query.mapId,
type: '01'
},
isShow: false
isShow: false,
loading: false
};
},
computed: {
@ -66,12 +67,6 @@ export default {
doShow() {
this.dialogVisible = true;
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
self.create();
});
},
doClose() {
this.formModel = {
parameter: this.$route.query.mapId,
@ -81,6 +76,14 @@ export default {
this.isShow = false;
this.dialogVisible = false;
},
async doSave() {
const self = this;
this.$refs.dataform.validateForm(async () => {
self.loading = true;
await self.create();
self.loading = false;
});
},
async create() {
const self = this;
try {

View File

@ -87,7 +87,7 @@
</el-form-item>
</el-form>
</div>
<float-part v-if="project.endsWith('xty')"/>
<float-part v-if="project.endsWith('xty')" />
</div>
</template>
@ -100,9 +100,9 @@ import QrcodeVue from 'qrcode.vue';
import { getLoginWmurl, checkLoginStatus } from '@/api/login';
import { LoginParams } from '@/utils/login';
import bgImg from '@/assets/bg1.jpg';
import { setToken, setDesignToken } from '@/utils/auth';
import { loginTitle } from '@/scripts/ConstDic';
import { removeToken, removeDesignToken} from '@/utils/auth';
import { setToken } from '@/utils/auth';
import { loginInfo } from '@/scripts/ConstDic';
import { removeToken } from '@/utils/auth';
import LangStorage from '@/utils/lang';
import { UrlConfig } from '@/router/index';
import logoImgXty from '@/assets/logo_xty.png';
@ -164,11 +164,11 @@ export default {
return this.$route.path.split('/')[1];
},
title() {
return loginTitle[this.$route.path.split('/')[1]];
return loginInfo[this.$route.path.split('/')[1]].title;
}
},
mounted() {
document.title = loginTitle[this.project];
document.title = loginInfo[this.project].title;
this.loginRefresh();
},
created() {
@ -205,7 +205,7 @@ export default {
this.language = 'English';
}
removeToken();
removeDesignToken();
removeToken();
setSessionStorage('project', this.project);
},
clearTimer(timer) {
@ -243,12 +243,7 @@ export default {
this.clearTimer(this.checkLogin);
this.checkLogin = setTimeout(() => {
checkLoginStatus(self.sessionId).then(response => {
if (this.project.startsWith('design')) {
setDesignToken(response.data.token);
} else {
setToken(response.data.token);
}
//
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token }).then(() => {
//

View File

@ -6,7 +6,7 @@
<script>
import MapCommon from './common/index';
import { handleToken } from '@/utils/auth';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic, planTopic, designDisplayTopic} from '@/utils/stomp';
import { sendCommand } from '@/api/jmap/training';
import { getSessionStorage } from '@/utils/auth';
@ -104,7 +104,7 @@ export default {
},
async subscribe() {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': handleToken() };
const header = { group: this.group || '', 'X-Token': getToken() };
if (this.mode === 'plan') {
creatSubscribe(planTopic, header);