教学系统 代码调整

This commit is contained in:
joylink_cuiweidong 2020-11-24 19:17:10 +08:00
parent 8388bf42b3
commit c7a98096a2
2 changed files with 33 additions and 17 deletions

View File

@ -118,7 +118,9 @@ export default {
}
},
$route() {
this.initLoadData();
if (!this.isLesson) {
this.initLoadData();
}
}
},
beforeDestroy() {

View File

@ -34,6 +34,7 @@ import { trainingNotifyNew } from '@/api/simulation';
import { TrainingMode, UrlConfig } from '@/scripts/ConstDic';
import { timeFormat } from '@/utils/date';
import { getTrainingStepsDetailNew } from '@/api/jmap/training';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'MenuLesson',
@ -110,23 +111,15 @@ export default {
this.isDisable = false;
},
'$store.state.map.mapViewLoadedCount': function (val) {
if (this.$route.query.trainingId) {
//
getTrainingStepsDetailNew(this.$route.query.trainingId, { group: this.group }).then(resp => {
this.trainingObj = resp.data;
this.$store.dispatch('training/setTrainingData', this.trainingObj); //
}).catch(error => {
this.$messageBox(`初始化失败实训内容失败: ${error.message}`);
});
}
this.$store.dispatch('training/end', null);
this.$store.dispatch('training/reset');
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('menuOperation/setButtonOperation', null);
this.isDisable = false;
this.getTrainingData();
},
'$store.state.training.operateErrMsg': function (val) {
this.tipInfo({ color: val.color, message: val.errMsg });
},
async $route() {
await this.initData();
await this.getTrainingData();
this.endViewLoading(true);
}
},
mounted() {
@ -143,6 +136,24 @@ export default {
});
}
},
getTrainingData() {
if (this.$route.query.trainingId) {
//
getTrainingStepsDetailNew(this.$route.query.trainingId, { group: this.group }).then(resp => {
this.trainingObj = resp.data;
this.$store.dispatch('training/setTrainingData', this.trainingObj); //
const detail = resp.data;
this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
}).catch(error => {
this.$messageBox(`初始化失败实训内容失败: ${error.message}`);
});
}
this.$store.dispatch('training/end', null);
this.$store.dispatch('training/reset');
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('menuOperation/setButtonOperation', null);
this.isDisable = false;
},
overallTranslation(flag) {
const panel = document.getElementById('leftSlider');
if (flag) {
@ -262,8 +273,8 @@ export default {
const resp = await getTrainingDetailNew(this.$route.query.trainingId);
this.$store.dispatch('exam/setCenter', resp.data.locateDeviceCode);
if (resp && resp.code == 200) {
const detail = resp.data;
await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
// const detail = resp.data;
// await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
} else {
this.$messageBox(`获取实训步骤数据失败`);
this.endViewLoading();
@ -277,6 +288,9 @@ export default {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
}
}
};