实训平台代码调整

This commit is contained in:
joylink_cuiweidong 2020-11-25 15:08:18 +08:00
parent 8c054f492f
commit 1949d81cac
3 changed files with 23 additions and 91 deletions

View File

@ -1,14 +1,5 @@
import request from '@/utils/request';
// 检查房间存在
export function checkRoomExistNew(params) {
return request({
url: `/api/simulationRoom`,
method: 'get',
params
});
}
// 设置人员角色
export function putUserRolesNew(data, group) {
return request({

View File

@ -20,8 +20,6 @@
<script>
import { launchFullscreen } from '@/utils/screen';
import { getPublishMapInfo } from '@/api/jmap/map';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, roomTopic} from '@/utils/stomp';
// 仿
export default {
name: 'DeomonList',
@ -30,7 +28,6 @@ export default {
dialogShow: false,
group: '',
roomName: '',
state: '',
mapId: '',
lineCode: '',
loading: false
@ -42,25 +39,12 @@ export default {
this.group = data.group;
this.mapId = data.mapId || data.map.id;
this.lineCode = (data.map || {}).lineCode;
this.state = data.state;
this.dialogShow = true;
this.loading = false;
},
doClose() {
this.dialogShow = false;
},
async subscribe() {
if (!this.$store.state.socket.roomIsSubscribe) {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${roomTopic}\/${this.group}`, header);
await this.$store.dispatch('socket/setRoomSubscribe', true);
}
},
async clearSubscribe() {
clearSubscribe(`${roomTopic}\/${this.group}`);
await this.$store.dispatch('socket/setRoomSubscribe', false);
},
async handleJoin() {
try {
this.loading = true;

View File

@ -11,7 +11,7 @@
<p class="list-item">
<span class="list-label">{{ $t('global.permissionList') }}</span>
</p>
<limit-list :ref="`limit`" :course-model="courseModel" @initLoadPage="refresh" />
<limit-list ref="limit" :course-model="courseModel" @initLoadPage="refresh" />
</div>
<div class="btn-buy">
<el-button v-if="!isLocal" type="success" :disabled="disabled" @click="buy">{{ $t('global.buy') }}</el-button>
@ -31,7 +31,6 @@ import LimitList from '@/views/components/limits/index';
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { getSessionStorage } from '@/utils/auth';
import localStore from 'storejs';
import { checkRoomExistNew } from '@/api/jointTraining';
export default {
name: 'ExamDetailList',
@ -45,9 +44,7 @@ export default {
tryUser: 0,
loading: true,
disabled: false,
currentLessonId: '',
currentPrdType: '',
productList: [],
courseModel: {
id: '',
name: '',
@ -57,8 +54,6 @@ export default {
prdType: '',
pmsList: []
},
jointShow: false,
jointGroup: '',
lineCode:'',
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts']
};
@ -109,7 +104,7 @@ export default {
try {
res = await getPublishMapInfo(this.mapId);
} catch (error) {
if (error.code == 30001) {
if (error.code == 30001 || error.code == 10007) {
const url = localStore.get('orignalTrainingPlatformRoute' + this.$store.state.user.id + this.project);
localStore.remove();
if (url) {
@ -168,20 +163,6 @@ export default {
refresh() {
this.loadInitData();
},
async getJointTrainingList() {
try {
if (this.mapId) {
const res = await checkRoomExistNew({mapId: this.mapId});
this.jointGroup = res.data;
this.jointShow = false;
if (res.data) {
this.jointShow = true;
}
}
} catch (error) {
console.error(error, '获取是否拥有综合演练房间');
}
},
async enterIntegratedSimulation() {
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
createSimulationNew(data).then(resp => {
@ -207,7 +188,7 @@ export default {
this.$router.push({ path: `/displayIscs/system`, query: query });
}
} catch (error) {
this.disabled = false;
this.disabled = false;
}
},
async enterScreen() {
@ -224,54 +205,30 @@ export default {
});
},
async start() {
if (this.courseModel.prdType == '05') {
this.jumpScheduling();
} else if (this.courseModel.prdType == '03') {
this.enterIntegratedSimulation();
} else if (this.courseModel.prdType == '06') {
this.enterISCS();
} else if (this.courseModel.prdType == '07') {
this.enterScreen();
} else {
this.jump();
}
const jumpFunc = ['jump', 'jump', 'enterIntegratedSimulation', 'jump', 'jumpScheduling', 'enterISCS', 'enterScreen'];
this[jumpFunc[parseInt(this.courseModel.prdType) - 1]]();
},
jumpSimulation() {
this.disabled = true;
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser, project: this.project };
this.$store.dispatch('training/setPrdType', this.currentPrdType); // prdType
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
}).catch(error=>{
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.disabled = false;
});
},
jumpScheduling() {
this.disabled = true;
setTimeout(() => {
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
try {
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser };
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
});
} catch (e) {
this.$messageBox(this.$t('error.createSimulationFailed') + e.message);
this.disabled = false;
}
}, 100);
this.jumpSimulation();
},
jump() {
this.disabled = true;
setTimeout(() => {
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser, project: this.project };
this.$store.dispatch('training/setPrdType', this.currentPrdType); // prdType
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.disabled = false;
});
}, 100);
this.jumpSimulation();
},
buy() {
// this.disabled = true;