diff --git a/src/views/approval/lesson/index.vue b/src/views/approval/lesson/index.vue
index 6e4c7638a..56b5fa25d 100644
--- a/src/views/approval/lesson/index.vue
+++ b/src/views/approval/lesson/index.vue
@@ -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 = '';
diff --git a/src/views/components/pay/commit.vue b/src/views/components/pay/commit.vue
index 33856827f..774fbf078 100644
--- a/src/views/components/pay/commit.vue
+++ b/src/views/components/pay/commit.vue
@@ -44,9 +44,9 @@
- {{ $t('global.submitOrders') }}
+ {{ $t('global.submitOrders') }}
- {{ $t('global.back') }}
+ {{ $t('global.back') }}
@@ -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);
}
}
};
diff --git a/src/views/demonstration/deomonList/index.vue b/src/views/demonstration/deomonList/index.vue
index 11e9f01bf..02af99af0 100644
--- a/src/views/demonstration/deomonList/index.vue
+++ b/src/views/demonstration/deomonList/index.vue
@@ -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 };
diff --git a/src/views/demonstration/detail/index.vue b/src/views/demonstration/detail/index.vue
index 3d9575c0c..a79508275 100644
--- a/src/views/demonstration/detail/index.vue
+++ b/src/views/demonstration/detail/index.vue
@@ -14,12 +14,12 @@
- {{ $t('global.buy') }}
- {{ $t('global.distributePermission') }}
- {{ $t('global.transferQRCode') }}
- {{ $t('demonstration.startSimulation') }}
- {{ $t('demonstration.createRoom') }}
- {{ $t('demonstration.enterRoom') }}
+ {{ $t('global.buy') }}
+ {{ $t('global.distributePermission') }}
+ {{ $t('global.transferQRCode') }}
+ {{ $t('demonstration.startSimulation') }}
+ {{ $t('demonstration.createRoom') }}
+ {{ $t('demonstration.enterRoom') }}
@@ -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;
}
}
};
diff --git a/src/views/exam/detail/courseDetail.vue b/src/views/exam/detail/courseDetail.vue
index 8a2a2c12f..1cc26320a 100644
--- a/src/views/exam/detail/courseDetail.vue
+++ b/src/views/exam/detail/courseDetail.vue
@@ -43,11 +43,11 @@
- {{ $t('exam.buy') }}
- {{ $t('exam.distributePermission') }}
- {{ $t('global.transferQRCode') }}
- {{ $t('exam.viewCoursePapers') }}
- {{ $t('exam.returnCourseList') }}
+ {{ $t('exam.buy') }}
+ {{ $t('exam.distributePermission') }}
+ {{ $t('global.transferQRCode') }}
+ {{ $t('exam.viewCoursePapers') }}
+ {{ $t('exam.returnCourseList') }}
@@ -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}`});
}
}
};
diff --git a/src/views/exam/detail/examDetail.vue b/src/views/exam/detail/examDetail.vue
index 4513afd64..20c2773e6 100644
--- a/src/views/exam/detail/examDetail.vue
+++ b/src/views/exam/detail/examDetail.vue
@@ -41,8 +41,8 @@
- {{ $t('exam.startTheExam') }}
- {{ $t('global.back') }}
+ {{ $t('exam.startTheExam') }}
+ {{ $t('global.back') }}
@@ -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);
}
}
};
diff --git a/src/views/jointTraining/index.vue b/src/views/jointTraining/index.vue
index 4032a7515..60031a426 100644
--- a/src/views/jointTraining/index.vue
+++ b/src/views/jointTraining/index.vue
@@ -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();
diff --git a/src/views/jointTraining/menuDemon.vue b/src/views/jointTraining/menuDemon.vue
index d4d869021..8dc49bf5c 100644
--- a/src/views/jointTraining/menuDemon.vue
+++ b/src/views/jointTraining/menuDemon.vue
@@ -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();
});
});
diff --git a/src/views/teach/detail/index.vue b/src/views/teach/detail/index.vue
index 2cc3e3dc9..7eacbb5bf 100644
--- a/src/views/teach/detail/index.vue
+++ b/src/views/teach/detail/index.vue
@@ -37,10 +37,10 @@
- {{ $t('teach.buy') }}
- {{ $t('teach.permissionDistribute') }}
- {{ $t('teach.authorityTransferred') }}
- {{ $t('teach.returnCourseList') }}
+ {{ $t('teach.buy') }}
+ {{ $t('teach.permissionDistribute') }}
+ {{ $t('teach.authorityTransferred') }}
+ {{ $t('teach.returnCourseList') }}
@@ -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);
}
}
};
diff --git a/src/views/trainRoom/e-roles.vue b/src/views/trainRoom/e-roles.vue
index d61092568..1be30c355 100644
--- a/src/views/trainRoom/e-roles.vue
+++ b/src/views/trainRoom/e-roles.vue
@@ -90,16 +90,16 @@
@@ -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')});
}
}
diff --git a/src/views/trainRoom/index.vue b/src/views/trainRoom/index.vue
index 97184c1a7..eb8f3001a 100644
--- a/src/views/trainRoom/index.vue
+++ b/src/views/trainRoom/index.vue
@@ -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) {