修改跳转bug

This commit is contained in:
lVAL 2019-11-25 18:21:56 +08:00
parent a5bb60cf68
commit 899f4a4216
11 changed files with 187 additions and 159 deletions

View File

@ -146,11 +146,9 @@ export default {
prdId: row.prdId
};
adminPublishLesson(params, row.id).then(response => {
this.loading = false;
this.$message.success(this.$t('tip.coursePublishSuccessful'));
this.doClose();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('tip.coursePublishFailed'));
});
});
@ -166,13 +164,11 @@ export default {
this.$refs.dataform.validateForm(() => {
if (this.rejectId) {
rejectedLessonRelease(this.formModel, this.rejectId).then(resp =>{
this.loading = false;
this.$message.success(this.$t('tip.rejectedCourseReleaseApplicationSuccessful'));
this.dialogFormVisible = false;
this.rejectId = '';
this.doClose();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('tip.rejectedCourseReleaseApplicationSuccessful'));
this.dialogFormVisible = false;
this.rejectId = '';

View File

@ -44,9 +44,9 @@
</el-form>
</el-scrollbar>
</div>
<el-button style="float: right; margin-bottom: 20px; margin-right: 20px;" type="primary " @click="commit">{{ $t('global.submitOrders') }}
<el-button style="float: right; margin-bottom: 20px; margin-right: 20px;" type="primary" :disabled="commitDisabled" @click="commit">{{ $t('global.submitOrders') }}
</el-button>
<el-button style="float: right; margin-bottom: 20px; margin-right: 10px;" @click="back">{{ $t('global.back') }}</el-button>
<el-button style="float: right; margin-bottom: 20px; margin-right: 10px;" :disabled="commitDisabled" @click="back">{{ $t('global.back') }}</el-button>
</el-card>
</template>
@ -69,6 +69,7 @@ export default {
data() {
return {
disabled: true,
commitDisabled: false,
choose: this.$t('global.january'),
chooseList: [
{ label: this.$t('global.january'), value: 1 },
@ -150,14 +151,6 @@ export default {
this.saleModel.price = val.price;
this.saleModel.goodsId = val.id;
this.saleModel.name = val.name;
// if (this.$route.query.permissionType == PermissionType.LESSON ||
// this.$route.query.permissionType == PermissionType.EXAM) {
// this.saleModel.name = val.name;
// } else if (this.$route.query.permissionType == PermissionType.SCREEN) {
// this.saleModel.name = val.name;
// } else {
// this.saleModel.name = val.prdName;
// }
}
}
},
@ -175,6 +168,7 @@ export default {
commit() {
this.$refs.make.validate((valid) => {
if (valid) {
this.commitDisabled = true;
const model = {
goodsId: this.saleModel.goodsId,
price: this.saleModel.price,
@ -184,14 +178,19 @@ export default {
};
commitOrder(model).then(response => {
this.$emit('commit', response.data);
this.commitDisabled = false;
}).catch(() => {
this.$messageBox(this.$t('tip.failedSubmitOrder'));
this.commitDisabled = false;
});
}
});
},
back() {
history.go(-1);
this.commitDisabled = true;
setTimeout(() => {
history.go(-1);
}, 100);
}
}
};

View File

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

View File

@ -14,12 +14,12 @@
<limit-list :ref="`limit`" :course-model="courseModel" />
</div>
<div class="btn-buy">
<el-button type="success" @click="buy">{{ $t('global.buy') }}</el-button>
<el-button v-if="hasPermssion" type="primary" @click="distribute">{{ $t('global.distributePermission') }}</el-button>
<el-button v-if="hasPermssion" type="primary" @click="transfer">{{ $t('global.transferQRCode') }}</el-button>
<el-button v-show="isStartDemon" :loading="buttonLoading" type="primary" @click="start">{{ $t('demonstration.startSimulation') }}</el-button>
<el-button v-show="isCreateRoom" :loading="buttonLoading" type="primary" @click="start">{{ $t('demonstration.createRoom') }}</el-button>
<el-button v-show="isInRoom" :loading="buttonLoading" type="primary" @click="joinRoom">{{ $t('demonstration.enterRoom') }}</el-button>
<el-button type="success" :disabled="disabled" @click="buy">{{ $t('global.buy') }}</el-button>
<el-button v-if="hasPermssion" type="primary" :disabled="disabled" @click="distribute">{{ $t('global.distributePermission') }}</el-button>
<el-button v-if="hasPermssion" type="primary" :disabled="disabled" @click="transfer">{{ $t('global.transferQRCode') }}</el-button>
<el-button v-show="isStartDemon" :disabled="disabled" type="primary" @click="start">{{ $t('demonstration.startSimulation') }}</el-button>
<el-button v-show="isCreateRoom" :disabled="disabled" type="primary" @click="start">{{ $t('demonstration.createRoom') }}</el-button>
<el-button v-show="isInRoom" :disabled="disabled" type="primary" @click="joinRoom">{{ $t('demonstration.enterRoom') }}</el-button>
</div>
</div>
</template>
@ -46,7 +46,7 @@ export default {
goodsId: '',
tryUser: 0,
loading: true,
buttonLoading: false,
disabled: false,
currentLessonId: '',
currentPrdId: '',
productList: [],
@ -85,10 +85,6 @@ export default {
mapId() {
return this.$route.query.mapId;
}
// lineCode() {
// // return this.$route.query.lineCode;
// }
},
watch: {
'$route': function (val) {
@ -163,13 +159,14 @@ export default {
}
},
async joinRoom() {
this.disabled = true;
await getjointTraining(this.jointGroup);
const query = { lineCode: this.courseModel.lineCode, group: this.jointGroup};
this.$router.push({ path: `/trainroom`, query: query });
},
async createRoom() {
try {
this.buttonLoading = true;
this.disabled = true;
const param = {
mapId: Number(this.mapId),
prdId: this.courseModel.prdId
@ -180,7 +177,7 @@ export default {
this.$router.push({ path: `/trainroom`, query: query });
}
} catch (error) {
this.buttonLoading = false;
this.disabled = false;
if (error.code == 20001) {
this.$confirm(this.$t('tip.createRoomFailedHint'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
@ -209,7 +206,7 @@ export default {
type: 'warning'
}).then(() => {
this.buy();
}).catch(() => { this.buttonLoading = false; });
}).catch(() => { });
} else {
this.jump();
}
@ -217,48 +214,55 @@ export default {
}
},
jumpScheduling() {
this.buttonLoading = true;
const data = { mapId: this.courseModel.mapId, prdId: this.currentPrdId };
schedulingNotify(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.buttonLoading = false;
});
this.disabled = true;
setTimeout(() => {
const data = { mapId: this.courseModel.mapId, prdId: this.currentPrdId };
schedulingNotify(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.disabled = false;
});
}, 100);
},
jump() {
const data = { mapId: this.courseModel.mapId, mapPrdId: this.currentPrdId };
this.buttonLoading = true;
simulationNotify(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.buttonLoading = false;
});
this.disabled = true;
setTimeout(() => {
const data = { mapId: this.courseModel.mapId, mapPrdId: this.currentPrdId };
simulationNotify(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.disabled = false;
});
}, 100);
},
buy() {
this.buttonLoading = true;
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.SIMULATION, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
this.disabled = true;
setTimeout(() => {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.SIMULATION, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
}, 100);
},
transfer() {
this.buttonLoading = false;
this.disabled = true;
if (this.$refs) {
this.$refs[`limit`].transfer(this.courseModel);
}
this.disabled = false;
},
distribute() {
this.buttonLoading = false;
this.disabled = true;
if (this.$refs) {
this.$refs[`limit`].distribute(this.courseModel);
}
this.disabled = false;
}
}
};

View File

@ -43,11 +43,11 @@
</el-tabs>
</div>
<div class="btn-buy">
<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="hasPermssion" 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 :disabled="disabled" type="success" @click="buy">{{ $t('exam.buy') }}</el-button>
<el-button v-if="hasPermssion" :disabled="disabled" type="primary" @click="distribute">{{ $t('exam.distributePermission') }}</el-button>
<el-button v-if="hasPermssion" :disabled="disabled" type="primary" @click="transfer">{{ $t('global.transferQRCode') }}</el-button>
<el-button v-if="hasPermssion" :disabled="disabled" type="primary" @click="checkCourse">{{ $t('exam.viewCoursePapers') }}</el-button>
<el-button type="primary" :disabled="disabled" @click="backLessonList">{{ $t('exam.returnCourseList') }}</el-button>
</div>
</el-card>
</template>
@ -66,7 +66,7 @@ export default {
},
data() {
return {
loading: false,
disabled: false,
courseModel: {
id: '',
name: this.$t('rules.lessonInput'),
@ -137,35 +137,45 @@ export default {
});
},
buy() {
this.loading = true;
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
this.disabled = true;
setTimeout(() => {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
}, 100);
},
checkCourse() {
this.loading = true;
this.$router.push({
path: `${UrlConfig.trainingPlatform.examRuleManage}`,
query: { lessonId: this.courseModel.id }
});
this.loading = false;
this.disabled = true;
setTimeout(() => {
this.$router.push({
path: `${UrlConfig.trainingPlatform.examRuleManage}`,
query: { lessonId: this.courseModel.id }
});
}, 100);
},
transfer() { //
this.loading = true;
this.disabled = true;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.transfer(this.courseModel);
}
this.loading = false;
this.disabled = false;
},
distribute() { //
this.loading = true;
this.disabled = true;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.distribute(this.courseModel);
}
this.loading = false;
this.disabled = false;
},
backLessonList() {
this.disabled = true;
setTimeout(() => {
localStore.remove('examDetail' + this.$route.params.subSystem);
this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${this.$route.params.subSystem}`});
}, 100);
},
clickEvent(obj, node, data) {
if (this.valid || obj.trial) {
@ -200,10 +210,6 @@ export default {
if (expand instanceof Array) {
this.expandList = expand;
}
},
backLessonList() {
localStore.remove('examDetail' + this.$route.params.subSystem);
this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${this.$route.params.subSystem}`});
}
}
};

View File

@ -41,8 +41,8 @@
</span>
</p>
<div class="btn-start">
<el-button :loading="loading" type="primary" @click="exmaStart">{{ $t('exam.startTheExam') }}</el-button>
<el-button @click="back">{{ $t('global.back') }}</el-button>
<el-button :disabled="disabled" type="primary" @click="exmaStart">{{ $t('exam.startTheExam') }}</el-button>
<el-button :disabled="disabled" @click="back">{{ $t('global.back') }}</el-button>
</div>
</el-scrollbar>
</div>
@ -64,7 +64,7 @@ export default {
name: 'ExamDetailView',
data() {
return {
loading: false,
disabled: false,
examDetails: {
lessonId: '',
name: '',
@ -179,7 +179,6 @@ export default {
}
},
buy() {
this.loading = true;
getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.examDetails.lessonId}`,
@ -187,7 +186,6 @@ export default {
});
}).catch(() => {
this.$messageBox(this.$t('error.obtainCourseDetailsFailed'));
this.loading = false;
});
},
@ -220,7 +218,7 @@ export default {
}
},
async exmaStart() {
this.loading = true;
this.disabled = true;
await this.examDetail();
if (this.examList.length) {
examNotify({ examId: this.$route.params.examId }).then(resp => {
@ -236,15 +234,18 @@ export default {
this.$router.push({ path: `${UrlConfig.display}/exam`, query: query });
launchFullscreen();
}).catch(error => {
this.loading = false;
this.disabled = false;
this.$messageBox( this.$t('error.createSimulationFailed') + `: ${error.message}`);
});
} else {
this.loading = false;
this.disabled = false;
}
},
back() {
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`, query: {lessonId: this.examDetails.lessonId}});
this.disabled = true;
setTimeout(() => {
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`, query: {lessonId: this.examDetails.lessonId}});
}, 100);
}
}
};

View File

@ -124,7 +124,7 @@ export default {
await this.$store.dispatch('training/over');
await runDiagramOver(this.group);
await deljointTrainRoom(this.group);
await this.$router.push({ path: `/trainingPlatform/detail/${this.subSystem}`, query: {mapId: this.mapId} });
this.$router.go(-1);
}
});
},
@ -136,7 +136,7 @@ export default {
'$store.state.socket.roleList': function (val) { //
val.forEach(elem => {
if (elem.id == this.userId && !elem.userRole) {
this.$router.push({ path: `/` });
this.$router.go(-1);
this.messageInfo(this.$t('tip.beKickedOut'), 'warning');
}
});
@ -154,7 +154,6 @@ export default {
this.group = this.$route.query.group;
this.mapId = this.$route.query.mapId;
this.lineCode = this.$route.query.lineCode;
this.subSystem = this.$route.query.subSystem;
Message.closeAll();
},
async mounted() {
@ -175,12 +174,10 @@ export default {
},
handleRoomInfo(data) {
if (data.state == '03') { // 退
this.$router.push({ path: `/` });
// this.clearSubscribe();
this.$router.go(-1);
} else if (data.state == '01') { //
const query = { group: this.group };
this.$router.push({ path: `/trainroom`, query: query });
// this.clearSubscribe();
this.$router.replace({ path: `/trainroom`, query: query });
}
this.$store.dispatch('socket/setJointRoomInfo'); //
},
@ -370,7 +367,7 @@ export default {
this.panelShow = false;
this.drivingShow = true;
this.ibpShow = false;
this.$refs.Jl3dDrive.show(this.mapId,this.group);
this.$refs.Jl3dDrive.show(this.mapId, this.group);
},
hideIbp() {
Message.closeAll();

View File

@ -69,6 +69,9 @@ export default {
};
},
computed: {
lineCode() {
return this.$route.query.lineCode;
},
isSpeaking() {
return this.userRole != 'Driver' && this.userRole != '';
},
@ -298,7 +301,7 @@ export default {
back() {
this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => {
this.$router.replace({ path: `/trainroom`, query: { lineCode: this.$route.query.lineCode, group: this.group, subSystem: this.$route.query.subSystem } });
this.$router.replace({ path: `/trainroom`, query: { lineCode: this.lineCode, group: this.group } });
exitFullscreen();
});
});

View File

@ -37,10 +37,10 @@
</el-tabs>
</div>
<div class="btn-buy">
<el-button type="success" @click="buy">{{ $t('teach.buy') }}</el-button>
<el-button v-if="hasPermssion" type="primary" @click="distribute">{{ $t('teach.permissionDistribute') }}</el-button>
<el-button v-if="hasPermssion" type="primary" @click="transfer">{{ $t('teach.authorityTransferred') }}</el-button>
<el-button type="primary" @click="backLessonList">{{ $t('teach.returnCourseList') }}</el-button>
<el-button type="success" :disabled="disabled" @click="buy">{{ $t('teach.buy') }}</el-button>
<el-button v-if="hasPermssion" type="primary" :disabled="disabled" @click="distribute">{{ $t('teach.permissionDistribute') }}</el-button>
<el-button v-if="hasPermssion" type="primary" :disabled="disabled" @click="transfer">{{ $t('teach.authorityTransferred') }}</el-button>
<el-button type="primary" :disabled="disabled" @click="backLessonList">{{ $t('teach.returnCourseList') }}</el-button>
</div>
</div>
</template>
@ -63,7 +63,7 @@ export default {
data() {
return {
num: 5,
loading: false,
disabled: false,
WhetherTypeList: [],
EffectiveTypeList: [],
courseModel: {
@ -115,23 +115,25 @@ export default {
});
},
transfer() {
this.loading = false;
this.disabled = true;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.transfer(this.courseModel);
}
this.disabled = false;
},
distribute() {
this.loading = false;
this.disabled = true;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.distribute(this.courseModel);
}
this.disabled = false;
},
clickEvent(obj, node, ele) {
if (obj && obj.type === 'Training') {
if (obj.valid) {
this.loading = true;
this.disabled = true;
trainingNotify({ trainingId: obj.id }).then(resp => {
const query = {
group: resp.data, trainingId: obj.id, lessonId: this.$route.query.lessonId, mapId: this.courseModel.mapId
@ -139,8 +141,8 @@ export default {
this.$router.push({ path: `${UrlConfig.display}/teach`, query: query });
launchFullscreen();
}).catch(error => {
this.loading = false;
this.$messageBox(`${this.$t('tip.createSimulationFaild')} : ${error.message}`);
this.disabled = false;
});
} else {
this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), {
@ -157,10 +159,13 @@ export default {
return data.name.indexOf(value) !== -1;
},
buy() {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`, query:
this.disabled = true;
setTimeout(() => {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`, query:
{ permissionType: PermissionType.LESSON, lessonId: this.courseModel.id, prdId: this.$route.query.prdId, mapId: this.$route.query.mapId, subSystem: this.$route.params.subSystem }
});
});
}, 100);
},
nodeExpand(obj, node, ele) {
const key = obj.id;
@ -187,6 +192,7 @@ export default {
startTraining(data) {
if (data && data.type === 'Training') {
if (data.valid) {
this.disabled = true;
this.$router.push({ path: `${UrlConfig.trainingPlatform.practical}/${data.id}/${this.courseModel.id}`});
} else {
this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), {
@ -199,8 +205,11 @@ export default {
}
},
backLessonList() {
localStore.remove('teachDetail' + this.$route.params.subSystem);
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachHome}/${this.$route.params.subSystem}`});
this.disabled = true;
setTimeout(() => {
localStore.remove('teachDetail' + this.$route.params.subSystem);
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachHome}/${this.$route.params.subSystem}`});
}, 100);
}
}
};

View File

@ -90,16 +90,16 @@
</el-scrollbar>
</div>
<div class="roles__footer">
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="danger" :loading="loading" @click="handleExit">{{ $t('trainRoom.destroyRoom') }}</el-button>
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="success" :loading="loading" @click="handlePostQrcode">{{ $t('trainRoom.generatingQRCode') }}</el-button>
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="danger" :disabled="disabled" @click="handleExit">{{ $t('trainRoom.destroyRoom') }}</el-button>
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="success" :disabled="disabled" @click="handlePostQrcode">{{ $t('trainRoom.generatingQRCode') }}</el-button>
<template v-if="!starting">
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="primary" :loading="loading" @click="handleStart"> {{ $t('trainRoom.startSimulation') }}</el-button>
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="primary" :disabled="disabled" @click="handleStart"> {{ $t('trainRoom.startSimulation') }}</el-button>
</template>
<template v-else>
<el-button type="primary" style="margin-left: 10px" :loading="loading" @click="handleJoinTraining"> {{ $t('trainRoom.enterSimulation') }}</el-button>
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="warning" :loading="loading" @click="handleStop"> {{ $t('trainRoom.endSimulation') }}</el-button>
<el-button type="primary" style="margin-left: 10px" :disabled="disabled" @click="handleJoin"> {{ $t('trainRoom.enterSimulation') }}</el-button>
<el-button v-if="userId == room.creatorId" style="margin-left: 10px" type="warning" :disabled="disabled" @click="handleStop"> {{ $t('trainRoom.endSimulation') }}</el-button>
</template>
<el-button type="" @click="handleBack">{{ $t('global.back') }}</el-button>
<el-button type="" :disabled="disabled" @click="handleBack">{{ $t('global.back') }}</el-button>
</div>
<add-person ref="addPerson" :audience-list="audienceList" @dispatch="handleDispatchUser" />
<qr-code ref="qrCode" />
@ -155,7 +155,7 @@ export default {
},
data() {
return {
loading: false,
disabled: false,
hasPlc: false
};
},
@ -224,23 +224,6 @@ export default {
this.$messageBox(this.$t('error.inquiryPLCDeviceFailed'));
}
},
async handlePostQrcode() {
this.loading = true;
const res = await getJoinTrainCode({}, this.group);
if (res.code == '200') {
const param = {
url: res.data,
title: this.$t('trainRoom.distributeTheRoomQRCode')
};
if (this.$refs) {
this.$refs.qrCode.doShow(param);
}
}
this.loading = false;
},
async handleJoinTraining() {
this.$emit('joinTraining');
},
async handleAddDevice({deviceType}) {
const roomDeviceVo = {id: '', deviceType: 'ScreenDoor', deviceCode: ''};
if (this.standList.findIndex(elem => { return elem.deviceType == roomDeviceVo.deviceType; }) > -1) {
@ -325,29 +308,55 @@ export default {
}
}
},
async handlePostQrcode() {
this.disabled = true;
const res = await getJoinTrainCode({}, this.group);
if (res.code == '200') {
const param = {
url: res.data,
title: this.$t('trainRoom.distributeTheRoomQRCode')
};
if (this.$refs) {
this.$refs.qrCode.doShow(param);
}
}
this.disabled = false;
},
async handleJoin() {
try {
this.disabled = true;
this.$emit('joinTraining');
} catch (e) {
console.error(e);
}
},
async handleStart() {
this.loading = true;
this.disabled = true;
if (this.attendantList.findIndex(item => { return !item.deviceCode; }) < 0) {
try {
await startJointTraining(this.group);
this.loading = false;
} catch (error) {
this.$emit('message', {type:'error', message: this.$t('error.startedComprehensiveDrillFailure')});
this.loading = false;
this.disabled = false;
}
} else {
this.$emit('message', {type:'error', message: this.$t('error.stationAttendantStationCannotBeEmpty')});
this.loading = false;
this.disabled = false;
}
},
async handleStop() {
this.loading = true;
const res = await putJointTrainingSimulation(this.group);
this.mapId = res.data.mapId;
this.loading = false;
try {
this.disabled = true;
const res = await putJointTrainingSimulation(this.group);
this.mapId = res.data.mapId;
} catch (e) {
console.error(e);
} finally {
this.disabled = false;
}
},
async handleExit() {
this.loading = false;
this.disabled = true;
this.$confirm( this.$t('tip.destroyRoomHint'), this.$t('tip.hint'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
@ -357,16 +366,20 @@ export default {
await deljointTrainRoom(this.group);
} catch (error) {
this.$emit('message', {type:'error', message: this.$t('error.destroyedRoomFailed')});
} finally {
this.disabled = false;
}
}).catch(() => {
this.disabled = false;
});
},
async handleBack() {
try {
this.loading = true;
this.disabled = true;
await putJointTrainingExit(this.group);
this.loading = false;
history.go(-1);
this.$router.go(-1);
} catch (error) {
this.disabled = false;
this.$emit('message', {type:'error', message: this.$t('error.operationFailure')});
}
}

View File

@ -179,10 +179,10 @@ export default {
Object.assign(this.room, room);
switch (room.state) {
case '03': //
this.$router.push({ path: `/trainingPlatform/detail/${this.$route.query.subSystem}`, query: {mapId: this.room.mapId}});
this.$router.go(-1);
break;
case '02': // 仿
this.jumpInSimulation();
await this.jumpInSimulation();
break;
}
@ -208,13 +208,13 @@ export default {
if (!user.userRole) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}被提出房间`});
if (this.userId == user.id) {
this.jumpOutRoom();
await this.jumpOutRoom();
}
} else if (old.userRole) {
if (old.inRoom && !user.inRoom) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}离线`});
if (this.userId == user.id) {
this.jumpOutRoom();
await this.jumpOutRoom();
}
}
@ -225,7 +225,7 @@ export default {
if (user.inSimulation) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入仿真`});
if (this.userId == user.id) {
this.jumpInSimulation();
await this.jumpInSimulation();
}
}
}
@ -237,14 +237,14 @@ export default {
const room = this.room;
await putJointTrainingSimulationEntrance(room.group);
const rest = await getPublishMapInfo(room.mapId);
const query = { lineCode: rest.data.lineCode, mapId: room.mapId, group: room.group, subSystem: this.$route.query.subSystem };
const query = { lineCode: rest.data.lineCode, mapId: room.mapId, group: room.group };
this.$router.replace({ path: `/jointTraining`, query: query });
launchFullscreen();
//
this.$store.dispatch('socket/setJointRoomInfo');
launchFullscreen();
},
async jumpOutRoom() {
this.$router.push({ path: `/` });
this.$router.go(-1);
this.messageInfo({error: 'warning', message: this.$t('tip.beKickedOut')});
},
transformUser(user) {