修改代码
This commit is contained in:
parent
93546fe1fc
commit
c5c813753c
@ -1,9 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
'@vue/app'
|
'@vue/app'
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
'@babel/plugin-transform-runtime',
|
|
||||||
'@babel/plugin-syntax-dynamic-import'
|
|
||||||
]
|
]
|
||||||
|
// plugins: [
|
||||||
|
// '@babel/plugin-transform-runtime',
|
||||||
|
// '@babel/plugin-syntax-dynamic-import'
|
||||||
|
// ]
|
||||||
};
|
};
|
||||||
|
38
src/App.vue
38
src/App.vue
@ -6,13 +6,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { handleToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
|
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 DeomonTopic from '@/views/demonstration/deomonTopic';
|
||||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||||
import Cookies from 'js-cookie';
|
|
||||||
import { ProjectIcon } from '@/scripts/ConstDic';
|
|
||||||
import { logout } from '@/api/login';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
@ -27,6 +26,16 @@ export default {
|
|||||||
if (val.creatorId) {
|
if (val.creatorId) {
|
||||||
this.subscribeMessage(val);
|
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() {
|
mounted() {
|
||||||
@ -40,28 +49,19 @@ export default {
|
|||||||
window.addEventListener('unload', async e => {
|
window.addEventListener('unload', async e => {
|
||||||
gap_time = new Date().getTime() - beforeUnload_time;
|
gap_time = new Date().getTime() - beforeUnload_time;
|
||||||
if (gap_time <= 5) {
|
if (gap_time <= 5) {
|
||||||
await this.pageDestory();
|
await this.$store.dispatch('LogOut');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.addEventListener('beforeunload', async e => {
|
window.addEventListener('beforeunload', async e => {
|
||||||
beforeUnload_time = new Date().getTime();
|
beforeUnload_time = new Date().getTime();
|
||||||
if (isFireFox) {
|
if (isFireFox) {
|
||||||
await this.pageDestory();
|
await this.$store.dispatch('LogOut');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.subscribe();
|
this.subscribe();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async pageDestory() {
|
|
||||||
this.clearSubscribe();
|
|
||||||
const token = handleToken();
|
|
||||||
Cookies.remove('UserDesignName');
|
|
||||||
Cookies.remove('UserDesignToken');
|
|
||||||
Cookies.remove('UserName');
|
|
||||||
Cookies.remove('UserToken');
|
|
||||||
await logout(token);
|
|
||||||
},
|
|
||||||
resizeHandler() {
|
resizeHandler() {
|
||||||
this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight});
|
this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight});
|
||||||
},
|
},
|
||||||
@ -78,17 +78,13 @@ export default {
|
|||||||
},
|
},
|
||||||
subscribe() {
|
subscribe() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const token = handleToken();
|
const token = getToken();
|
||||||
if (token && this.$route.path != '/404') {
|
if (token && this.$route.path != '/404') {
|
||||||
const header = { group: '', 'X-Token': token };
|
const header = { group: '', 'X-Token': token };
|
||||||
creatSubscribe(perpetualTopic, header);
|
creatSubscribe(perpetualTopic, header);
|
||||||
creatSubscribe(commonTopic, header);
|
creatSubscribe(commonTopic, header);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
clearSubscribe() {
|
|
||||||
clearSubscribe(perpetualTopic);
|
|
||||||
clearSubscribe(commonTopic);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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
|
* 实训系统CBTC
|
||||||
* @param {*} data
|
* @param {*} data
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
</el-table>
|
</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
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
:type="'primary'"
|
:type="'primary'"
|
||||||
|
41
src/directive/dialogLoading/dialogLoading.js
Normal file
41
src/directive/dialogLoading/dialogLoading.js
Normal 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();
|
||||||
|
}
|
||||||
|
};
|
86
src/directive/dialogLoading/dialogLoading.vue
Normal file
86
src/directive/dialogLoading/dialogLoading.vue
Normal 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>
|
8
src/directive/dialogLoading/index.js
Normal file
8
src/directive/dialogLoading/index.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
import install from './dialogLoading';
|
||||||
|
|
||||||
|
const dialogLoading = function(Vue) {
|
||||||
|
Vue.directive('dialogLoading', install);
|
||||||
|
};
|
||||||
|
|
||||||
|
Vue.use(dialogLoading);
|
@ -1,6 +1,8 @@
|
|||||||
export default {
|
export default {
|
||||||
confirm: 'confirm',
|
confirm: 'confirm',
|
||||||
cancel: 'cancel',
|
cancel: 'cancel',
|
||||||
|
confirmLogin: 'Relanding',
|
||||||
|
logoutTips: 'You have been signed out. Please sign in again!',
|
||||||
creatingSuccessful: 'Created successfully!',
|
creatingSuccessful: 'Created successfully!',
|
||||||
creatingFailed: 'Create a failure',
|
creatingFailed: 'Create a failure',
|
||||||
confirmDeletion: 'Confirm deletion?',
|
confirmDeletion: 'Confirm deletion?',
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
export default {
|
export default {
|
||||||
confirm: '确 定',
|
confirm: '确 定',
|
||||||
cancel: '取 消',
|
cancel: '取 消',
|
||||||
|
confirmLogin: '重新登陆',
|
||||||
|
logoutTips: '你已被登出,请重新登录',
|
||||||
creatingSuccessful: '创建成功!',
|
creatingSuccessful: '创建成功!',
|
||||||
creatingFailed: '创建失败',
|
creatingFailed: '创建失败',
|
||||||
confirmDeletion: '是否确认删除?',
|
confirmDeletion: '是否确认删除?',
|
||||||
|
@ -3,7 +3,7 @@ import StompClient from '@/utils/sock';
|
|||||||
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||||
|
|
||||||
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
|
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
|
||||||
import { handleToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
|
|
||||||
// 定于仿真socket接口
|
// 定于仿真socket接口
|
||||||
@ -41,7 +41,7 @@ export function Jl3dDriving(updatemmi, sound) {
|
|||||||
var datatype = '00';
|
var datatype = '00';
|
||||||
this.teststomp = new StompClient();
|
this.teststomp = new StompClient();
|
||||||
this.topic = '/user/queue/simulation/jl3d';
|
this.topic = '/user/queue/simulation/jl3d';
|
||||||
const header = {'X-Token': handleToken() };
|
const header = {'X-Token': getToken() };
|
||||||
|
|
||||||
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
|
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
|
||||||
// console.log(mapdata);
|
// console.log(mapdata);
|
||||||
|
@ -3,7 +3,7 @@ import StompClient from '@/utils/sock';
|
|||||||
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||||
|
|
||||||
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
|
import { creatSubscribe, clearSubscribe, displayTopic } from '@/utils/stomp';
|
||||||
import { handleToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
|
|
||||||
// 定于仿真socket接口
|
// 定于仿真socket接口
|
||||||
@ -41,7 +41,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
|||||||
var datatype = '00';
|
var datatype = '00';
|
||||||
this.teststomp = new StompClient();
|
this.teststomp = new StompClient();
|
||||||
this.topic = '/user/queue/simulation/jl3d';
|
this.topic = '/user/queue/simulation/jl3d';
|
||||||
const header = {'X-Token': handleToken() };
|
const header = {'X-Token': getToken() };
|
||||||
|
|
||||||
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
|
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
|
||||||
// console.log(mapdata);
|
// console.log(mapdata);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import StompClient from '@/utils/sock';
|
import StompClient from '@/utils/sock';
|
||||||
import { displayTopic } from '@/utils/stomp';
|
import { displayTopic } from '@/utils/stomp';
|
||||||
import { handleToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
|
|
||||||
// 定于仿真socket接口
|
// 定于仿真socket接口
|
||||||
@ -23,7 +23,7 @@ export function Jlmap3dSubscribe(worker) {
|
|||||||
|
|
||||||
this.teststomp = new StompClient();
|
this.teststomp = new StompClient();
|
||||||
this.topic = displayTopic;
|
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) {
|
this.updatamap = function (mapdata, materiallist, nowaction, scene) {
|
||||||
// console.log(mapdata);
|
// console.log(mapdata);
|
||||||
|
@ -84,12 +84,8 @@ export default {
|
|||||||
} else if (this.operation == OperationEvent.Switch.turnoutForce.menu.operation) {
|
} else if (this.operation == OperationEvent.Switch.turnoutForce.menu.operation) {
|
||||||
return this.$t('menu.menuSwitch.switchForcedPull');
|
return this.$t('menu.menuSwitch.switchForcedPull');
|
||||||
} else if (this.operation == OperationEvent.Switch.split.menu.operation) {
|
} else if (this.operation == OperationEvent.Switch.split.menu.operation) {
|
||||||
this.activeShow = true;
|
|
||||||
this.radio = '2';
|
|
||||||
return this.$t('menu.menuSwitch.sectionResection');
|
return this.$t('menu.menuSwitch.sectionResection');
|
||||||
} else if (this.operation == OperationEvent.Switch.active.menu.operation) {
|
} else if (this.operation == OperationEvent.Switch.active.menu.operation) {
|
||||||
this.activeShow = true;
|
|
||||||
this.radio = '1';
|
|
||||||
return this.$t('menu.menuSwitch.sectionActive');
|
return this.$t('menu.menuSwitch.sectionActive');
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@ -112,7 +108,15 @@ export default {
|
|||||||
this.stationName = station.name;
|
this.stationName = station.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.operation = operate.operation;
|
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.dialogShow = true;
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<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')" />
|
<el-input v-model="input" :placeholder="$t('global.inputRoomNumber')" />
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="centerDialogVisible = false">{{ $t('global.cancel') }}</el-button>
|
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
|
||||||
<el-button type="primary" @click="comit">{{ $t('global.confirm') }}</el-button>
|
<el-button v-loading="loading" :disabled="!input.length" type="primary" @click="comit">{{ $t('global.confirm') }}</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
@ -15,8 +15,9 @@ export default {
|
|||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
centerDialogVisible: false,
|
input: '',
|
||||||
input: ''
|
dialogShow: false,
|
||||||
|
loading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -26,21 +27,20 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doShow() {
|
doShow() {
|
||||||
this.centerDialogVisible = true;
|
this.dialogShow = true;
|
||||||
},
|
},
|
||||||
doClose() {
|
doClose() {
|
||||||
this.centerDialogVisible = false;
|
this.dialogShow = false;
|
||||||
},
|
},
|
||||||
async comit() {
|
async comit() {
|
||||||
if (this.input) {
|
|
||||||
try {
|
try {
|
||||||
|
this.loading = true;
|
||||||
await getPermissionJoint(`${this.input}`);
|
await getPermissionJoint(`${this.input}`);
|
||||||
this.centerDialogVisible = false;
|
this.dialogShow = false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$messageBox(`${this.$t('error.scanningError')}:${error.message}`);
|
this.$messageBox(`${this.$t('error.scanningError')}:${error.message}`);
|
||||||
}
|
} finally {
|
||||||
} else {
|
this.loading = false;
|
||||||
this.$messageBox(this.$t('global.inputRoomNumber'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
import logoImg from '@/assets/logo_changan.png';
|
import logoImg from '@/assets/logo_changan.png';
|
||||||
import logoImgXty from '@/assets/logo_xty.png';
|
import logoImgXty from '@/assets/logo_xty.png';
|
||||||
import { getSessionStorage } from '@/utils/auth';
|
import { getSessionStorage } from '@/utils/auth';
|
||||||
import { loginTitle } from '@/scripts/ConstDic';
|
import { loginInfo } from '@/scripts/ConstDic';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -20,7 +20,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
const project = getSessionStorage('project');
|
const project = getSessionStorage('project');
|
||||||
this.systemTitle = loginTitle[project];
|
this.systemTitle = loginInfo[project].title;
|
||||||
if (project.endsWith('xty')) {
|
if (project.endsWith('xty')) {
|
||||||
this.logoImg = logoImgXty;
|
this.logoImg = logoImgXty;
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,6 +20,7 @@ import '@/permission'; // permission control
|
|||||||
import '@/scripts/GlobalPlugin';
|
import '@/scripts/GlobalPlugin';
|
||||||
import '@/directive/dialogDrag/index.js';
|
import '@/directive/dialogDrag/index.js';
|
||||||
import '@/directive/dialogDragWidth/index.js';
|
import '@/directive/dialogDragWidth/index.js';
|
||||||
|
import '@/directive/dialogLoading/index.js';
|
||||||
import '@/directive/drag/index.js';
|
import '@/directive/drag/index.js';
|
||||||
import '@/directive/focus/index.js';
|
import '@/directive/focus/index.js';
|
||||||
import '@/directive/quickMenuDrag/index.js';
|
import '@/directive/quickMenuDrag/index.js';
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
import router from './router';
|
import router from './router';
|
||||||
import NProgress from 'nprogress'; // Progress 进度条
|
import NProgress from 'nprogress';
|
||||||
// import 'nprogress/nprogress.css';// Progress 进度条样式
|
|
||||||
import { admin, userDesign} from './router';
|
import { admin, userDesign} from './router';
|
||||||
import { getToken, getDesignToken} from '@/utils/auth'; // 验权
|
import { getToken} from '@/utils/auth';
|
||||||
import { LoginParams } from '@/utils/login';
|
import { LoginParams } from '@/utils/login';
|
||||||
import { getSessionStorage } from '@/utils/auth';
|
import { getSessionStorage } from '@/utils/auth';
|
||||||
import localStore from 'storejs';
|
import localStore from 'storejs';
|
||||||
@ -28,44 +27,37 @@ const loginDesignXtyPage = whiteList[3];
|
|||||||
// 获取路径数据
|
// 获取路径数据
|
||||||
function getRouteInfo(to) {
|
function getRouteInfo(to) {
|
||||||
let loginPath = '/';
|
let loginPath = '/';
|
||||||
let getTokenInfo = () => { };
|
|
||||||
let clientId = '';
|
let clientId = '';
|
||||||
const toRoutePath = to.redirectedFrom || to.path;
|
const toRoutePath = to.redirectedFrom || to.path;
|
||||||
if (/^\/designxty/.test(toRoutePath)) {
|
if (/^\/designxty/.test(toRoutePath)) {
|
||||||
loginPath = loginDesignXtyPage;
|
loginPath = loginDesignXtyPage;
|
||||||
getTokenInfo = getDesignToken;
|
|
||||||
clientId = LoginParams.Design.clientId;
|
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)) {
|
} 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;
|
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
|
||||||
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)) {
|
||||||
if (getSessionStorage('project').startsWith('design')) {
|
if (getSessionStorage('project').startsWith('design')) {
|
||||||
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
|
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
|
||||||
getTokenInfo = getDesignToken;
|
|
||||||
clientId = LoginParams.Design.clientId;
|
clientId = LoginParams.Design.clientId;
|
||||||
} else {
|
} else {
|
||||||
loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
|
loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
|
||||||
getTokenInfo = getToken;
|
|
||||||
clientId = null;
|
clientId = null;
|
||||||
}
|
}
|
||||||
} else if ( /^\/xty/.test(toRoutePath)) {
|
} else if ( /^\/xty/.test(toRoutePath)) {
|
||||||
loginPath = loginXtyPage;
|
loginPath = loginXtyPage;
|
||||||
getTokenInfo = getToken;
|
|
||||||
clientId = null;
|
clientId = null;
|
||||||
} else {
|
} else {
|
||||||
loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
|
loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
|
||||||
getTokenInfo = getToken;
|
|
||||||
clientId = null;
|
clientId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { clientId, loginPath, getTokenInfo };
|
return { clientId, loginPath };
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRoute(to, from, next, routeInfo) {
|
function handleRoute(to, from, next, routeInfo) {
|
||||||
if (store.getters.roles.length === 0) {
|
if (store.getters.roles.length === 0) {
|
||||||
// 拉取用户信息
|
// 拉取用户信息
|
||||||
store.dispatch('GetInfo', routeInfo.getTokenInfo).then(res => {
|
store.dispatch('GetInfo', getToken()).then(res => {
|
||||||
// 根据roles权限生成可访问的路由表
|
// 根据roles权限生成可访问的路由表
|
||||||
const roles = res.roles;
|
const roles = res.roles;
|
||||||
if (getSessionStorage('project').startsWith('design')) {
|
if (getSessionStorage('project').startsWith('design')) {
|
||||||
@ -83,7 +75,7 @@ function handleRoute(to, from, next, routeInfo) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
store.dispatch('FedLogOut', routeInfo.clientId).then(() => {
|
store.dispatch('FedLogOut').then(() => {
|
||||||
Vue.prototype.$messageBox('验证失败,请重新登录!');
|
Vue.prototype.$messageBox('验证失败,请重新登录!');
|
||||||
next({ path: routeInfo.loginPath });
|
next({ path: routeInfo.loginPath });
|
||||||
});
|
});
|
||||||
@ -104,9 +96,8 @@ function handleRoute(to, from, next, routeInfo) {
|
|||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
|
|
||||||
const routeInfo = getRouteInfo(to);
|
const routeInfo = getRouteInfo(to);
|
||||||
if (routeInfo.getTokenInfo()) {
|
if (getToken()) {
|
||||||
// 已登录
|
// 已登录
|
||||||
if (to.path === routeInfo.loginPath) {
|
if (to.path === routeInfo.loginPath) {
|
||||||
// 登录页面不拦截
|
// 登录页面不拦截
|
||||||
|
@ -101,7 +101,7 @@ const ScriptApproval = () => import('@/views/approval/script/index');
|
|||||||
const RunPlanApproval = () => import('@/views/approval/runPlan/index');
|
const RunPlanApproval = () => import('@/views/approval/runPlan/index');
|
||||||
const News = () => import('@/views/news/index');
|
const News = () => import('@/views/news/index');
|
||||||
|
|
||||||
import { loginTitle } from '@/scripts/ConstDic';
|
import { loginInfo } from '@/scripts/ConstDic';
|
||||||
import { getSessionStorage } from '@/utils/auth';
|
import { getSessionStorage } from '@/utils/auth';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -863,7 +863,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 || 'login'];
|
document.title = loginInfo[project || 'login'].title;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2200,12 +2200,26 @@ export const IbpOperation = {
|
|||||||
import LangStorage from '@/utils/lang';
|
import LangStorage from '@/utils/lang';
|
||||||
import Favicon from '@/assets/icon/favicon.png';
|
import Favicon from '@/assets/icon/favicon.png';
|
||||||
import FaviconXty from '@/assets/icon/favicon_xty.png';
|
import FaviconXty from '@/assets/icon/favicon_xty.png';
|
||||||
export const loginTitle = {
|
|
||||||
xty: '西安铁路职业技术学院城市轨道交通实训平台',
|
export const loginInfo = {
|
||||||
login: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Practical Training Platform' : '城市轨道交通实训平台',
|
xty: {
|
||||||
design: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Design Platform' : '城市轨道交通设计平台',
|
title: '西安铁路职业技术学院城市轨道交通实训平台',
|
||||||
designxty: '西安铁路职业技术学院城市轨道交通设计平台'
|
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 = {
|
export const ProjectIcon = {
|
||||||
xty: FaviconXty,
|
xty: FaviconXty,
|
||||||
login: Favicon,
|
login: Favicon,
|
||||||
|
@ -27,27 +27,6 @@ function setHonePagePath(route, roles) {
|
|||||||
function hasPermission(roles, route, parentsRoles) {
|
function hasPermission(roles, route, parentsRoles) {
|
||||||
setHonePagePath(route, roles);
|
setHonePagePath(route, roles);
|
||||||
if (route.meta && route.meta.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')) {
|
if (getSessionStorage('project').startsWith('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;
|
||||||
@ -95,7 +74,7 @@ function convertRouterRoles({ roles, permissionType }) {
|
|||||||
*/
|
*/
|
||||||
function filterAsyncRouter(asyncRouter, roles, parentsRoles) {
|
function filterAsyncRouter(asyncRouter, roles, parentsRoles) {
|
||||||
return asyncRouter.filter(route => {
|
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;
|
route.hidden = true;
|
||||||
}
|
}
|
||||||
if (hasPermission(roles, route, parentsRoles)) {
|
if (hasPermission(roles, route, parentsRoles)) {
|
||||||
@ -124,16 +103,11 @@ const permission = {
|
|||||||
GenerateRoutes({ commit }, data) {
|
GenerateRoutes({ commit }, data) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const { roles } = convertRouterRoles(data);
|
const { roles } = convertRouterRoles(data);
|
||||||
let accessedRouters;
|
|
||||||
if (roles.indexOf(superAdmin) >= 0 && roles.indexOf(admin) < 0) {
|
if (roles.indexOf(superAdmin) >= 0 && roles.indexOf(admin) < 0) {
|
||||||
roles.push(admin);
|
roles.push(admin);
|
||||||
}
|
}
|
||||||
// if (roles.indexOf(superAdmin) >= 0) {
|
|
||||||
// accessedRouters = asyncRouter;
|
const accessedRouters = filterAsyncRouter(asyncRouter, roles);
|
||||||
// } else {
|
|
||||||
// eslint-disable-next-line prefer-const
|
|
||||||
accessedRouters = filterAsyncRouter(asyncRouter, roles);
|
|
||||||
// }
|
|
||||||
commit('SET_ROUTERS', accessedRouters);
|
commit('SET_ROUTERS', accessedRouters);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
@ -9,6 +9,9 @@ function handle(state, data) {
|
|||||||
case 'Order_Pay_Result': // 订单支付结果消息
|
case 'Order_Pay_Result': // 订单支付结果消息
|
||||||
state.payOrder = msg;
|
state.payOrder = msg;
|
||||||
break;
|
break;
|
||||||
|
case 'Be_Logged_Out': // 重复登录被登出
|
||||||
|
state.beLogout = msg;
|
||||||
|
break;
|
||||||
case 'JointTraining_Room': // 综合演练室-房间消息
|
case 'JointTraining_Room': // 综合演练室-房间消息
|
||||||
if (!path.includes('/plan') || !path.includes('/dp/')) {
|
if (!path.includes('/plan') || !path.includes('/dp/')) {
|
||||||
state.jointRoomInfo = msg; // 房间信息
|
state.jointRoomInfo = msg; // 房间信息
|
||||||
@ -193,6 +196,7 @@ const socket = {
|
|||||||
|
|
||||||
state: {
|
state: {
|
||||||
payOrder: {}, // 支付消息
|
payOrder: {}, // 支付消息
|
||||||
|
beLogout: {}, // 被登出
|
||||||
jointRoomInfo: {}, // 受邀请房间信息
|
jointRoomInfo: {}, // 受邀请房间信息
|
||||||
chatContent: {}, // 聊天室聊天内容
|
chatContent: {}, // 聊天室聊天内容
|
||||||
roleList: [], // 设置角色信息
|
roleList: [], // 设置角色信息
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
import { setSessionStorage } 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 } from '@/utils/auth';
|
||||||
import { getUserConfigInfo } from '@/api/management/user';
|
import { getUserConfigInfo } from '@/api/management/user';
|
||||||
import { LoginParams } from '@/utils/login';
|
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';
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
state: {
|
state: {
|
||||||
token: getToken(),
|
token: getToken(),
|
||||||
tokenDesign: getDesignToken(),
|
|
||||||
name: '',
|
name: '',
|
||||||
nickname: '',
|
nickname: '',
|
||||||
nationcode: '',
|
nationcode: '',
|
||||||
@ -25,15 +24,6 @@ const user = {
|
|||||||
SET_TOKEN: (state, token) => {
|
SET_TOKEN: (state, token) => {
|
||||||
state.token = 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) => {
|
SET_NAME: (state, name) => {
|
||||||
state.name = name;
|
state.name = name;
|
||||||
},
|
},
|
||||||
@ -57,6 +47,12 @@ const user = {
|
|||||||
},
|
},
|
||||||
SET_ACCOUNT: (state, account) => {
|
SET_ACCOUNT: (state, account) => {
|
||||||
state.account = 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();
|
const password = userInfo.password.trim();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let params = null;
|
let params = null;
|
||||||
let execFc = null;
|
let execFunc = null;
|
||||||
if (userInfo.type == 'design') {
|
if (userInfo.type == 'design') {
|
||||||
params = Object.assign({ account: username, password }, LoginParams.Design);
|
params = Object.assign({ account: username, password }, LoginParams.Design);
|
||||||
execFc = (token) => {
|
execFunc = (header) => {
|
||||||
setDesignToken(token);
|
|
||||||
commit('SET_TOKENDESIGN', token);
|
|
||||||
const header = { group: '', 'X-Token': getDesignToken() };
|
|
||||||
creatSubscribe(commonTopic, header);
|
creatSubscribe(commonTopic, header);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
params = Object.assign({ account: username, password }, LoginParams.LianKeTang);
|
params = Object.assign({ account: username, password }, LoginParams.LianKeTang);
|
||||||
execFc = (token) => {
|
execFunc = (header) => {
|
||||||
setToken(token);
|
|
||||||
commit('SET_TOKEN', token);
|
|
||||||
const header = { group: '', 'X-Token': getToken() };
|
|
||||||
creatSubscribe(perpetualTopic, header);
|
creatSubscribe(perpetualTopic, header);
|
||||||
creatSubscribe(commonTopic, header);
|
creatSubscribe(commonTopic, header);
|
||||||
};
|
};
|
||||||
@ -89,7 +79,10 @@ const user = {
|
|||||||
|
|
||||||
// 登录系统
|
// 登录系统
|
||||||
login(params).then(resp => {
|
login(params).then(resp => {
|
||||||
execFc(resp.data);
|
const token = resp.data;
|
||||||
|
commit('SET_TOKEN', token);
|
||||||
|
setToken(token);
|
||||||
|
execFunc({ group: '', 'X-Token': token });
|
||||||
resolve();
|
resolve();
|
||||||
}).catch(error => { reject(error); });
|
}).catch(error => { reject(error); });
|
||||||
});
|
});
|
||||||
@ -113,9 +106,9 @@ const user = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
GetInfo({ commit }, getTokenInfo) {
|
GetInfo({ commit }, token) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getInfo(getTokenInfo()).then(response => {
|
getInfo(token).then(response => {
|
||||||
const user = response.data;
|
const user = response.data;
|
||||||
if (user.roles && user.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
if (user.roles && user.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
||||||
commit('SET_ROLES', user.roles);
|
commit('SET_ROLES', user.roles);
|
||||||
@ -145,39 +138,29 @@ const user = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 前端登出
|
// 前端登出
|
||||||
FedLogOut({ commit }, clientId) {
|
FedLogOut({ commit }) {
|
||||||
return new Promise(resolve => {
|
clearSubscribe(perpetualTopic);
|
||||||
if (clientId == LoginParams.Design.clientId) {
|
clearSubscribe(commonTopic);
|
||||||
commit('SET_TOKENDESIGN', '');
|
|
||||||
removeDesignToken();
|
|
||||||
} else {
|
|
||||||
commit('SET_TOKEN', '');
|
commit('SET_TOKEN', '');
|
||||||
|
commit('SET_ID', '');
|
||||||
removeToken();
|
removeToken();
|
||||||
}
|
|
||||||
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 登出系统
|
// 登出系统
|
||||||
LogOut({ commit }) {
|
LogOut({ commit, dispatch }) {
|
||||||
|
// 清楚自动登陆参数
|
||||||
|
commit('CLEAR_AUTO_PARAMS');
|
||||||
|
const token = getToken();
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
logout(handleToken()).then(() => {
|
dispatch('FedLogOut').then(resp => {
|
||||||
commit('SET_TOKEN', '');
|
logout(token).then(() => {
|
||||||
commit('SET_ROLES', []);
|
|
||||||
commit('SET_ID', '');
|
|
||||||
Cookies.remove('UserDesignName');
|
|
||||||
Cookies.remove('UserDesignToken');
|
|
||||||
Cookies.remove('UserName');
|
|
||||||
Cookies.remove('UserToken');
|
|
||||||
handleRemoveToken();
|
|
||||||
resolve();
|
resolve();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
SetAccount({ commit }, account) {
|
SetAccount({ commit }, account) {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import SessionStorage from 'sessionstorage';
|
import SessionStorage from 'sessionstorage';
|
||||||
import { LoginParams } from '@/utils/login';
|
|
||||||
|
|
||||||
const TokenKey = 'Admin-Token';
|
const TokenKey = 'Admin-Token';
|
||||||
const TokenDesignKey = 'Design-Token';
|
|
||||||
|
|
||||||
// 设置教学,实训,仿真系统token
|
// 设置教学,实训,仿真系统token, 设置城市轨道交通设计平台token
|
||||||
export function getToken() {
|
export function getToken() {
|
||||||
return SessionStorage.getItem(TokenKey);
|
return SessionStorage.getItem(TokenKey);
|
||||||
}
|
}
|
||||||
@ -15,17 +13,6 @@ export function removeToken() {
|
|||||||
return SessionStorage.removeItem(TokenKey);
|
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
|
// 操作sessionStorage
|
||||||
export function getSessionStorage(key) {
|
export function getSessionStorage(key) {
|
||||||
return SessionStorage.getItem(key);
|
return SessionStorage.getItem(key);
|
||||||
@ -36,42 +23,3 @@ export function setSessionStorage(key, value) {
|
|||||||
export function removeSessionStorage(key) {
|
export function removeSessionStorage(key) {
|
||||||
return SessionStorage.removeItem(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;
|
|
||||||
}
|
|
||||||
|
@ -3,8 +3,8 @@ export function getBaseUrl() {
|
|||||||
let BASE_API;
|
let BASE_API;
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// BASE_API = 'https://joylink.club/jlcloud';
|
// 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.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.41:9000'; // 杜闪
|
||||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 登陆配置参数
|
// 登陆配置参数
|
||||||
export const LoginParams = {
|
export const LoginParams = {
|
||||||
LianKeTang: { clientId: '1', secret: 'joylink' }, // "城市轨道交通实训平台"
|
LianKeTang: { clientId: '1', secret: 'joylink' }, // "城市轨道交通实训平台"
|
||||||
// DaPing: { clientId: '2', secret: 'bigscreen' }, // "大屏系统"
|
|
||||||
// LianJiHua: { clientId: '3', secret: 'linkplan' }, // "琏计划"
|
|
||||||
Assistant: { clientId: '4', secret: 'linkassistant' }, // "琏课堂助手"
|
Assistant: { clientId: '4', secret: 'linkassistant' }, // "琏课堂助手"
|
||||||
Design: { clientId: '2', secret: 'design' } // "城市轨道交通设计平台"
|
Design: { clientId: '2', secret: 'design' } // "城市轨道交通设计平台"
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import store from '../store';
|
import store from '../store';
|
||||||
import { MessageBox } from 'element-ui';
|
import { MessageBox } from 'element-ui';
|
||||||
import { handleToken, gainClientId } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import { getBaseUrl } from '@/utils/baseUrl';
|
import { getBaseUrl } from '@/utils/baseUrl';
|
||||||
import { EventBus } from '@/scripts/event-bus';
|
import { EventBus } from '@/scripts/event-bus';
|
||||||
|
|
||||||
@ -16,8 +16,8 @@ const service = axios.create({
|
|||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
if (handleToken()) {
|
if (getToken()) {
|
||||||
config.headers['X-Token'] = handleToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
|
config.headers['X-Token'] = getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
}
|
}
|
||||||
if (config.time) {
|
if (config.time) {
|
||||||
config.timeout = config.time; // 让每个请求携带自定义token 请根据实际情况自行修改
|
config.timeout = config.time; // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
@ -42,12 +42,12 @@ service.interceptors.response.use(
|
|||||||
EventBus.$emit('viewLoading', false);
|
EventBus.$emit('viewLoading', false);
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
EventBus.$emit('clearCheckLogin');
|
EventBus.$emit('clearCheckLogin');
|
||||||
MessageBox.confirm('你已被登出,请重新登录', '确定登出', {
|
MessageBox.confirm(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
|
||||||
confirmButtonText: '重新登录',
|
confirmButtonText: this.$t('tip.confirmLogin'),
|
||||||
showCancelButton: false,
|
showCancelButton: false,
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
store.dispatch('FedLogOut', gainClientId()).then(() => {
|
store.dispatch('FedLogOut').then(() => {
|
||||||
location.reload();// 为了重新实例化vue-router对象 避免bug
|
location.reload();// 为了重新实例化vue-router对象 避免bug
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { handleToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import { checkLoginLine } from '@/api/login';
|
import { checkLoginLine } from '@/api/login';
|
||||||
import { getBaseUrl } from '@/utils/baseUrl';
|
import { getBaseUrl } from '@/utils/baseUrl';
|
||||||
import { MessageBox } from 'element-ui';
|
import { MessageBox } from 'element-ui';
|
||||||
import store from '../store';
|
import store from '../store';
|
||||||
import { gainClientId } from '@/utils/auth';
|
|
||||||
|
|
||||||
var SockJS = require('sockjs-client');
|
var SockJS = require('sockjs-client');
|
||||||
var Stomp = require('stompjs');
|
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=`;
|
// const websocketUrl = `http://192.168.3.6:9000/joylink-websocket?token=`;
|
||||||
|
|
||||||
var StompClient = function (headers) {
|
var StompClient = function (headers) {
|
||||||
this.url = websocketUrl + handleToken();
|
this.url = websocketUrl + getToken();
|
||||||
this.headers = headers || {};
|
this.headers = headers || {};
|
||||||
this.connect();
|
this.connect();
|
||||||
};
|
};
|
||||||
@ -32,7 +31,7 @@ StompClient.prototype = {
|
|||||||
sockStatus: 0,
|
sockStatus: 0,
|
||||||
|
|
||||||
headers: {
|
headers: {
|
||||||
// 'X-Token': handleToken()
|
// 'X-Token': getToken()
|
||||||
},
|
},
|
||||||
|
|
||||||
count: 0,
|
count: 0,
|
||||||
@ -54,7 +53,7 @@ StompClient.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 建立连接对象(还未发起连接)
|
// 建立连接对象(还未发起连接)
|
||||||
this.socket = new SockJS(websocketUrl + handleToken());
|
this.socket = new SockJS(websocketUrl + getToken());
|
||||||
|
|
||||||
// 获取 STOMP 子协议的客户端对象
|
// 获取 STOMP 子协议的客户端对象
|
||||||
this.clientIns = Stomp.over(this.socket);
|
this.clientIns = Stomp.over(this.socket);
|
||||||
@ -62,7 +61,7 @@ StompClient.prototype = {
|
|||||||
this.closeStompDebug();
|
this.closeStompDebug();
|
||||||
|
|
||||||
// 向服务器发起websocket连接并发送CONNECT帧
|
// 向服务器发起websocket连接并发送CONNECT帧
|
||||||
this.clientIns.connect({ 'X-Token': handleToken() }, () => {
|
this.clientIns.connect({ 'X-Token': getToken() }, () => {
|
||||||
console.info('连接成功.');
|
console.info('连接成功.');
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
this.status = true;
|
this.status = true;
|
||||||
@ -121,7 +120,7 @@ StompClient.prototype = {
|
|||||||
this.logOut();
|
this.logOut();
|
||||||
}
|
}
|
||||||
if (err.code == 50008 || err.code == 50014) {
|
if (err.code == 50008 || err.code == 50014) {
|
||||||
this.url = websocketUrl + handleToken();
|
this.url = websocketUrl + getToken();
|
||||||
this.connect();
|
this.connect();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -139,13 +138,13 @@ StompClient.prototype = {
|
|||||||
showCancelButton: false,
|
showCancelButton: false,
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
store.dispatch('FedLogOut', gainClientId()).then(() => {
|
store.dispatch('FedLogOut').then(() => {
|
||||||
location.reload();// 为了重新实例化vue-router对象 避免bug
|
location.reload();// 为了重新实例化vue-router对象 避免bug
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (err.code == 50008 || err.code == 50014) {
|
if (err.code == 50008 || err.code == 50014) {
|
||||||
this.url = websocketUrl + handleToken();
|
this.url = websocketUrl + getToken();
|
||||||
this.status = false;
|
this.status = false;
|
||||||
this.count++;
|
this.count++;
|
||||||
this.reconnect(this.count);
|
this.reconnect(this.count);
|
||||||
|
@ -10,9 +10,9 @@ export const commonTopic = '/topic/message'; // 公共topic(不区分用户)
|
|||||||
|
|
||||||
// 建立连接并订阅地址
|
// 建立连接并订阅地址
|
||||||
export function creatSubscribe(topic, header) {
|
export function creatSubscribe(topic, header) {
|
||||||
if ([displayTopic, planTopic, designDisplayTopic].includes(topic)) {
|
// if ([displayTopic, planTopic, designDisplayTopic].includes(topic)) {
|
||||||
topic = `${topic}/${header.group}`;
|
// topic = `${topic}/${header.group}`;
|
||||||
}
|
// }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!Vue.prototype.$stomp) {
|
if (!Vue.prototype.$stomp) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-dialogDrag
|
v-dialogDrag
|
||||||
|
v-dialogLoading="pageLoading"
|
||||||
:title="title"
|
:title="title"
|
||||||
:visible.sync="show"
|
:visible.sync="show"
|
||||||
width="600px"
|
width="600px"
|
||||||
@ -12,25 +13,26 @@
|
|||||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
|
||||||
<el-tree
|
<el-tree
|
||||||
ref="tree"
|
ref="tree"
|
||||||
|
node-key="group"
|
||||||
class="filter-tree"
|
class="filter-tree"
|
||||||
|
default-expand-all
|
||||||
:data="trainingList"
|
:data="trainingList"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
default-expand-all
|
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
:style="{height: height+'px'}"
|
:style="{height: height+'px'}"
|
||||||
@node-click="clickEvent"
|
@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-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 v-else>{{ '['+data.mapName+']'+($t('global.trainingHasStart').replace('{name}', data.creator.nickName)) }}</span>
|
||||||
</span>
|
</div>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<span
|
<span
|
||||||
slot="footer"
|
slot="footer"
|
||||||
class="dialog-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>
|
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -46,7 +48,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogShow: false,
|
dialogShow: false,
|
||||||
loading: false,
|
|
||||||
height: 120,
|
height: 120,
|
||||||
trainingList: [],
|
trainingList: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
@ -54,7 +55,9 @@ export default {
|
|||||||
},
|
},
|
||||||
group: '',
|
group: '',
|
||||||
state: '',
|
state: '',
|
||||||
mapId: ''
|
mapId: '',
|
||||||
|
loading: false,
|
||||||
|
pageLoading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -81,25 +84,34 @@ export default {
|
|||||||
this.group = obj.group;
|
this.group = obj.group;
|
||||||
this.mapId = obj.mapId;
|
this.mapId = obj.mapId;
|
||||||
},
|
},
|
||||||
async getList() {
|
async doShow() {
|
||||||
try {
|
try {
|
||||||
|
this.pageLoading = true;
|
||||||
|
this.dialogShow = true;
|
||||||
|
this.loading = false;
|
||||||
const res = await getjointTrainList();
|
const res = await getjointTrainList();
|
||||||
this.trainingList = res.data;
|
this.trainingList = res.data || [];
|
||||||
} catch (error) {
|
this.$nextTick(() => {
|
||||||
console.error(error);
|
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() {
|
async doClose() {
|
||||||
this.getList();
|
|
||||||
this.loading = false;
|
|
||||||
this.dialogShow = true;
|
|
||||||
},
|
|
||||||
doClose() {
|
|
||||||
this.loading = false;
|
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
},
|
},
|
||||||
async handleJoin() {
|
async handleJoin() {
|
||||||
if (this.group) {
|
try {
|
||||||
|
this.loading = true;
|
||||||
await getjointTraining(this.group);
|
await getjointTraining(this.group);
|
||||||
if (this.state == '02') {
|
if (this.state == '02') {
|
||||||
launchFullscreen();
|
launchFullscreen();
|
||||||
@ -111,8 +123,10 @@ export default {
|
|||||||
const query = { group: this.group };
|
const query = { group: this.group };
|
||||||
this.$router.push({ path: `/trainroom`, query: query });
|
this.$router.push({ path: `/trainroom`, query: query });
|
||||||
}
|
}
|
||||||
} else {
|
} catch (e) {
|
||||||
this.$message.info(this.$t('global.pleaseChooseRoom'));
|
console.error(e);
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,6 +141,10 @@ export default {
|
|||||||
|
|
||||||
.el-tree {
|
.el-tree {
|
||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
|
.list-elem {
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tree-node.is-current>.el-tree-node__content {
|
.el-tree-node.is-current>.el-tree-node__content {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
>
|
>
|
||||||
<div style="height: 80px; line-height: 80px; font-size: 16px; padding-left: 10px;">{{ roomName }}{{ $t('global.inviteJoinRoom') }}</div>
|
<div style="height: 80px; line-height: 80px; font-size: 16px; padding-left: 10px;">{{ roomName }}{{ $t('global.inviteJoinRoom') }}</div>
|
||||||
<span slot="footer" class="dialog-footer">
|
<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>
|
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -30,7 +30,8 @@ export default {
|
|||||||
group: '',
|
group: '',
|
||||||
roomName: '',
|
roomName: '',
|
||||||
state: '',
|
state: '',
|
||||||
mapId: ''
|
mapId: '',
|
||||||
|
loading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -50,11 +51,14 @@ export default {
|
|||||||
this.state = data.state;
|
this.state = data.state;
|
||||||
this.mapId = data.mapId;
|
this.mapId = data.mapId;
|
||||||
this.dialogShow = true;
|
this.dialogShow = true;
|
||||||
|
this.loading = false;
|
||||||
},
|
},
|
||||||
doClose() {
|
doClose() {
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
},
|
},
|
||||||
async handleJoin() {
|
async handleJoin() {
|
||||||
|
try {
|
||||||
|
this.loading = true;
|
||||||
if (this.state == '02') {
|
if (this.state == '02') {
|
||||||
launchFullscreen();
|
launchFullscreen();
|
||||||
await putJointTrainingSimulationEntrance(this.group);
|
await putJointTrainingSimulationEntrance(this.group);
|
||||||
@ -66,7 +70,12 @@ export default {
|
|||||||
this.$router.push({ path: `/trainroom`, query: query });
|
this.$router.push({ path: `/trainroom`, query: query });
|
||||||
}
|
}
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
getjointTraining(this.group);
|
await getjointTraining(this.group);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<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>
|
<div>
|
||||||
<el-tabs v-model="activeTab" type="card">
|
<el-tabs v-model="activeTab" type="card">
|
||||||
<el-tab-pane :label="$t('map.normalCreate')" name="first">
|
<el-tab-pane :label="$t('map.normalCreate')" name="first">
|
||||||
@ -126,12 +126,14 @@ export default {
|
|||||||
},
|
},
|
||||||
initLoadData() {
|
initLoadData() {
|
||||||
this.lineCodeList = [];
|
this.lineCodeList = [];
|
||||||
getLineCodeList().then(response => {
|
|
||||||
this.lineCodeList = response.data;
|
|
||||||
});
|
|
||||||
this.$Dictionary.cityType().then(list => {
|
this.$Dictionary.cityType().then(list => {
|
||||||
this.cityList = list;
|
this.cityList = list;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
getLineCodeList().then(response => {
|
||||||
|
this.lineCodeList = response.data;
|
||||||
|
});
|
||||||
|
|
||||||
getMapListByProject().then(response => {
|
getMapListByProject().then(response => {
|
||||||
this.publishMapList = response.data;
|
this.publishMapList = response.data;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-dialogDrag
|
v-dialogDrag
|
||||||
|
v-dialogLoading="dialogLoading"
|
||||||
:title="title"
|
:title="title"
|
||||||
:visible.sync="dialogShow"
|
:visible.sync="dialogShow"
|
||||||
width="100%"
|
width="100%"
|
||||||
@ -151,7 +152,8 @@ export default {
|
|||||||
},
|
},
|
||||||
absoluteTime: 2 * 3600,
|
absoluteTime: 2 * 3600,
|
||||||
indexKmRangeMap: {},
|
indexKmRangeMap: {},
|
||||||
runPlanData: {}
|
runPlanData: {},
|
||||||
|
dialogLoading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -195,14 +197,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doShow() {
|
async doShow() {
|
||||||
|
try {
|
||||||
|
this.dialogLoading = true;
|
||||||
this.dialogShow = true;
|
this.dialogShow = true;
|
||||||
this.loadInitData(this.series);
|
this.loadInitData(this.series);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
} finally {
|
||||||
|
this.dialogLoading = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
doClose() {
|
async doClose() {
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
},
|
},
|
||||||
loadChartPage() {
|
async loadChartPage() {
|
||||||
const stations = this.$store.state.runPlan.stations;
|
const stations = this.$store.state.runPlan.stations;
|
||||||
const planData = this.$store.state.runPlan.planData;
|
const planData = this.$store.state.runPlan.planData;
|
||||||
this.series = [];
|
this.series = [];
|
||||||
|
@ -43,10 +43,10 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-buy">
|
<div class="btn-buy">
|
||||||
<el-button type="success" @click="buy">{{ $t('exam.buy') }}</el-button>
|
<el-button v-loading="loading" 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" v-loading="loading" 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="hasPermssion" v-loading="loading" 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-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>
|
<el-button type="primary" @click="backLessonList">{{ $t('exam.returnCourseList') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -156,20 +156,23 @@ export default {
|
|||||||
path: `${UrlConfig.trainingPlatform.examRuleManage}`,
|
path: `${UrlConfig.trainingPlatform.examRuleManage}`,
|
||||||
query: { lessonId: this.courseModel.id }
|
query: { lessonId: this.courseModel.id }
|
||||||
});
|
});
|
||||||
|
this.loading = false;
|
||||||
},
|
},
|
||||||
transfer() { // 转增
|
transfer() { // 转增
|
||||||
this.loading = false;
|
this.loading = true;
|
||||||
if (this.$refs) {
|
if (this.$refs) {
|
||||||
this.activeName = 'second';
|
this.activeName = 'second';
|
||||||
this.$refs.limitList.transfer(this.courseModel);
|
this.$refs.limitList.transfer(this.courseModel);
|
||||||
}
|
}
|
||||||
|
this.loading = false;
|
||||||
},
|
},
|
||||||
distribute() { // 分发
|
distribute() { // 分发
|
||||||
this.loading = false;
|
this.loading = true;
|
||||||
if (this.$refs) {
|
if (this.$refs) {
|
||||||
this.activeName = 'second';
|
this.activeName = 'second';
|
||||||
this.$refs.limitList.distribute(this.courseModel);
|
this.$refs.limitList.distribute(this.courseModel);
|
||||||
}
|
}
|
||||||
|
this.loading = false;
|
||||||
},
|
},
|
||||||
clickEvent(obj, node, data) {
|
clickEvent(obj, node, data) {
|
||||||
if (this.valid || obj.trial) {
|
if (this.valid || obj.trial) {
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="draft">
|
<div class="draft">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button v-show="!isEdit" type="primary" @click="create">{{ $t('global.append') }}</el-button>
|
<el-button v-show="!isEdit" v-loading="loading" 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="update">{{ $t('global.update') }}</el-button>
|
||||||
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
|
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
@ -99,7 +99,8 @@ export default {
|
|||||||
detail: {
|
detail: {
|
||||||
mapId: '',
|
mapId: '',
|
||||||
prdId: ''
|
prdId: ''
|
||||||
}
|
},
|
||||||
|
loading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -188,10 +189,13 @@ export default {
|
|||||||
create() {
|
create() {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.loading = true;
|
||||||
createLessonChapter(this.chapterModel).then(response => {
|
createLessonChapter(this.chapterModel).then(response => {
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.$message.success(this.$t('tip.createSuccess'));
|
this.$message.success(this.$t('tip.createSuccess'));
|
||||||
|
this.loading = false;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
this.loading = false;
|
||||||
this.$messageBox(this.$t('error.refreshFailed'));
|
this.$messageBox(this.$t('error.refreshFailed'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -200,11 +204,14 @@ export default {
|
|||||||
update() {
|
update() {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.loading = true;
|
||||||
updateLessonChapter(this.chapterModel).then(response => {
|
updateLessonChapter(this.chapterModel).then(response => {
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.$message.success(this.$t('tip.updateSuccessfully'));
|
this.$message.success(this.$t('tip.updateSuccessfully'));
|
||||||
|
this.loading = false;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$messageBox(this.$t('error.refreshFailed'));
|
this.$messageBox(this.$t('error.refreshFailed'));
|
||||||
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="25%" :before-close="doClose" center>
|
<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" />
|
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||||
<span slot="footer" class="dialog-footer">
|
<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>
|
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -23,7 +23,8 @@ export default {
|
|||||||
parameter: this.$route.query.mapId,
|
parameter: this.$route.query.mapId,
|
||||||
type: '01'
|
type: '01'
|
||||||
},
|
},
|
||||||
isShow: false
|
isShow: false,
|
||||||
|
loading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -66,12 +67,6 @@ export default {
|
|||||||
doShow() {
|
doShow() {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
doSave() {
|
|
||||||
const self = this;
|
|
||||||
this.$refs.dataform.validateForm(() => {
|
|
||||||
self.create();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
doClose() {
|
doClose() {
|
||||||
this.formModel = {
|
this.formModel = {
|
||||||
parameter: this.$route.query.mapId,
|
parameter: this.$route.query.mapId,
|
||||||
@ -81,6 +76,14 @@ export default {
|
|||||||
this.isShow = false;
|
this.isShow = false;
|
||||||
this.dialogVisible = 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() {
|
async create() {
|
||||||
const self = this;
|
const self = this;
|
||||||
try {
|
try {
|
||||||
|
@ -100,9 +100,9 @@ import QrcodeVue from 'qrcode.vue';
|
|||||||
import { getLoginWmurl, checkLoginStatus } from '@/api/login';
|
import { getLoginWmurl, checkLoginStatus } from '@/api/login';
|
||||||
import { LoginParams } from '@/utils/login';
|
import { LoginParams } from '@/utils/login';
|
||||||
import bgImg from '@/assets/bg1.jpg';
|
import bgImg from '@/assets/bg1.jpg';
|
||||||
import { setToken, setDesignToken } from '@/utils/auth';
|
import { setToken } from '@/utils/auth';
|
||||||
import { loginTitle } from '@/scripts/ConstDic';
|
import { loginInfo } from '@/scripts/ConstDic';
|
||||||
import { removeToken, removeDesignToken} from '@/utils/auth';
|
import { removeToken } from '@/utils/auth';
|
||||||
import LangStorage from '@/utils/lang';
|
import LangStorage from '@/utils/lang';
|
||||||
import { UrlConfig } from '@/router/index';
|
import { UrlConfig } from '@/router/index';
|
||||||
import logoImgXty from '@/assets/logo_xty.png';
|
import logoImgXty from '@/assets/logo_xty.png';
|
||||||
@ -164,11 +164,11 @@ export default {
|
|||||||
return this.$route.path.split('/')[1];
|
return this.$route.path.split('/')[1];
|
||||||
},
|
},
|
||||||
title() {
|
title() {
|
||||||
return loginTitle[this.$route.path.split('/')[1]];
|
return loginInfo[this.$route.path.split('/')[1]].title;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = loginTitle[this.project];
|
document.title = loginInfo[this.project].title;
|
||||||
this.loginRefresh();
|
this.loginRefresh();
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -205,7 +205,7 @@ export default {
|
|||||||
this.language = 'English';
|
this.language = 'English';
|
||||||
}
|
}
|
||||||
removeToken();
|
removeToken();
|
||||||
removeDesignToken();
|
removeToken();
|
||||||
setSessionStorage('project', this.project);
|
setSessionStorage('project', this.project);
|
||||||
},
|
},
|
||||||
clearTimer(timer) {
|
clearTimer(timer) {
|
||||||
@ -243,12 +243,7 @@ export default {
|
|||||||
this.clearTimer(this.checkLogin);
|
this.clearTimer(this.checkLogin);
|
||||||
this.checkLogin = setTimeout(() => {
|
this.checkLogin = setTimeout(() => {
|
||||||
checkLoginStatus(self.sessionId).then(response => {
|
checkLoginStatus(self.sessionId).then(response => {
|
||||||
if (this.project.startsWith('design')) {
|
|
||||||
setDesignToken(response.data.token);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
setToken(response.data.token);
|
setToken(response.data.token);
|
||||||
}
|
|
||||||
// 设置扫码登录
|
// 设置扫码登录
|
||||||
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token }).then(() => {
|
self.$store.dispatch('QrLoginSetting', { key: 'SET_TOKEN', value: response.data.token }).then(() => {
|
||||||
// 清除定时器,设置路由
|
// 清除定时器,设置路由
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MapCommon from './common/index';
|
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 { creatSubscribe, clearSubscribe, displayTopic, planTopic, designDisplayTopic} from '@/utils/stomp';
|
||||||
import { sendCommand } from '@/api/jmap/training';
|
import { sendCommand } from '@/api/jmap/training';
|
||||||
import { getSessionStorage } from '@/utils/auth';
|
import { getSessionStorage } from '@/utils/auth';
|
||||||
@ -104,7 +104,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async subscribe() {
|
async subscribe() {
|
||||||
this.clearSubscribe();
|
this.clearSubscribe();
|
||||||
const header = { group: this.group || '', 'X-Token': handleToken() };
|
const header = { group: this.group || '', 'X-Token': getToken() };
|
||||||
|
|
||||||
if (this.mode === 'plan') {
|
if (this.mode === 'plan') {
|
||||||
creatSubscribe(planTopic, header);
|
creatSubscribe(planTopic, header);
|
||||||
|
Loading…
Reference in New Issue
Block a user