修改实训加载顺序错误的问题
This commit is contained in:
parent
2d8f94f47a
commit
ae500285ba
@ -53,9 +53,9 @@ export function getTrainingTree() {
|
||||
}
|
||||
|
||||
/** 获取章节基本信息*/
|
||||
export function getTrainingDetail(args) {
|
||||
export function getTrainingDetail(trainingId) {
|
||||
return request({
|
||||
url: `/api/training/${args.id}`,
|
||||
url: `/api/training/${trainingId}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ export default {
|
||||
createSimulationFailed: 'Failure to create simulation',
|
||||
loadMapDataFailed: 'Failed to load map data',
|
||||
getMapStepsFailed: 'Failed to get map step data',
|
||||
getMapDetailFailed: 'Failed to get map detail',
|
||||
resetFailed: 'Reset failure',
|
||||
startTrainingFailed: 'Failure to start training',
|
||||
saveBackgroundFailed: 'Failed to save background',
|
||||
|
@ -2,7 +2,8 @@ export default {
|
||||
refreshFailed: '刷新失败',
|
||||
createSimulationFailed: '创建仿真失败',
|
||||
loadMapDataFailed: '加载地图数据失败',
|
||||
getMapStepsFailed: '获取地图步骤数据',
|
||||
getMapStepsFailed: '获取地图步骤数据失败',
|
||||
getMapDetailFailed: '获取地图详细信息失败',
|
||||
resetFailed: '重置失败',
|
||||
startTrainingFailed: '开始实训失败',
|
||||
saveBackgroundFailed: '保存背景失败',
|
||||
|
@ -248,7 +248,7 @@ class Jlmap {
|
||||
});
|
||||
|
||||
// 状态后处理
|
||||
this.postHandle(list);
|
||||
this.postHandle(list || []);
|
||||
|
||||
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ import MenuScript from '@/views/display/menuScript';
|
||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||
import AddQuest from './demon/addQuest';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getTrainingStepsDetail } from '@/api/jmap/training';
|
||||
import { getTrainingDetail, getTrainingStepsDetail } from '@/api/jmap/training';
|
||||
import { setGoodsTryUse } from '@/api/management/goods';
|
||||
import { getProductDetail } from '@/api/management/mapprd';
|
||||
import { runDiagramQuit, loadScript, getSimulationInfo } from '@/api/simulation';
|
||||
@ -181,6 +181,14 @@ export default {
|
||||
'$store.state.map.mapViewLoadedCount': function (val) {
|
||||
this.mapBoxP = document.getElementById(this.canvasId).children[0];
|
||||
this.mapBox = document.getElementsByTagName('canvas');
|
||||
|
||||
if (this.trainingId) {
|
||||
getTrainingStepsDetail(this.trainingId, { group: this.group }).then(resp => {
|
||||
this.trainingObj = resp.data;
|
||||
this.$store.dispatch('training/setTrainingData', this.trainingObj);
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
'$store.state.socket.permissionOver': function () {
|
||||
this.$alert('用户权限已被收回', '提示', {
|
||||
@ -349,14 +357,14 @@ export default {
|
||||
if (parseInt(this.trainingId)) {
|
||||
// 设置地图数据
|
||||
// 设置实训数据
|
||||
const resp = await getTrainingStepsDetail(this.trainingId, { group: this.group });
|
||||
const resp = await getTrainingDetail(this.trainingId);
|
||||
if (resp && resp.code == 200) {
|
||||
const stepdData = this.trainingObj = resp.data;
|
||||
const rest = await getProductDetail(stepdData.prdCode);
|
||||
const detail = resp.data;
|
||||
const rest = await getProductDetail(detail.prdCode);
|
||||
if (rest && rest.code == 200) {
|
||||
await this.$store.dispatch('training/setPrdType', rest.data.prdType);
|
||||
await this.loadMapData(resp.data.skinCode);
|
||||
await this.$store.dispatch('training/setTrainingData', stepdData);
|
||||
const data = rest.data;
|
||||
await this.$store.dispatch('training/setPrdType', data.prdType);
|
||||
await this.loadMapData(detail.skinCode);
|
||||
}
|
||||
} else {
|
||||
this.$messageBox(`获取实训步骤数据失败`);
|
||||
|
@ -140,10 +140,8 @@ export default {
|
||||
}
|
||||
});
|
||||
if (obj) {
|
||||
const that = this;
|
||||
const data = { id: obj.trainingId };
|
||||
getTrainingDetail(data).then(res => {
|
||||
that.courseModel = {
|
||||
getTrainingDetail(obj.trainingId ).then(res => {
|
||||
this.courseModel = {
|
||||
id: res.data.id,
|
||||
name: res.data.name,
|
||||
maxDuration: res.data.maxDuration,
|
||||
@ -152,7 +150,7 @@ export default {
|
||||
updateTime: res.data.updateTime
|
||||
};
|
||||
}).catch(error => {
|
||||
that.$message.error('获取试题息失败:' + error.message);
|
||||
this.$message.error('获取试题息失败:' + error.message);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -78,9 +78,9 @@ export default {
|
||||
this.height = this._clientHeight;
|
||||
},
|
||||
initLoadPage() {
|
||||
const data = { id: this.$route.query.trainingId };
|
||||
if (parseInt(data.id)) {
|
||||
getTrainingDetail(data).then(res => {
|
||||
const trainingId = this.$route.query.trainingId;
|
||||
if (parseInt(trainingId)) {
|
||||
getTrainingDetail(trainingId).then(res => {
|
||||
this.courseModel = {
|
||||
id: res.data.id,
|
||||
name: res.data.name,
|
||||
|
@ -210,7 +210,7 @@ export default {
|
||||
|
||||
this.operateModel.id = node.data.id;
|
||||
this.operateModel.name = node.data.name;
|
||||
getTrainingDetail({ id: node.data.id }).then(response => {
|
||||
getTrainingDetail(node.data.id).then(response => {
|
||||
this.operateModel.minDuration = response.data.minDuration;
|
||||
this.operateModel.maxDuration = response.data.maxDuration;
|
||||
this.operateModel.operateType = response.data.operateType;
|
||||
|
@ -47,7 +47,6 @@ export default {
|
||||
},
|
||||
$route() {
|
||||
this.resizeHandler();
|
||||
this.$;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -15,7 +15,7 @@
|
||||
import MapSystemDraft from '@/views/mapsystem/index';
|
||||
import StepManage from './stepmanage/index';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getTrainingStepsDetail } from '@/api/jmap/training';
|
||||
import { getTrainingDetail, getTrainingStepsDetail } from '@/api/jmap/training';
|
||||
import { getProductDetail } from '@/api/management/mapprd';
|
||||
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
|
||||
import { loadMapData } from '@/utils/loaddata';
|
||||
@ -49,6 +49,16 @@ export default {
|
||||
watch: {
|
||||
$route(newVal) {
|
||||
this.initLoadData();
|
||||
},
|
||||
'$store.state.map.mapViewLoadedCount': function() {
|
||||
if (this.trainingId) {
|
||||
getTrainingStepsDetail(this.trainingId, { group: this.group }).then(response => {
|
||||
this.$store.dispatch('training/setTrainingData', response.data);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.getMapStepsFailed'));
|
||||
this.endViewLoading();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -77,19 +87,19 @@ export default {
|
||||
// 获取实训的详细数据
|
||||
// 加载地图数据
|
||||
// 设置实训数据
|
||||
getTrainingStepsDetail(this.trainingId, { group: this.group }).then(response => {
|
||||
const stepdData = response.data;
|
||||
getProductDetail(stepdData.prdCode).then(res => {
|
||||
loadMapData(stepdData.skinCode).then(() => {
|
||||
this.$store.dispatch('training/setPrdType', res.data.prdType);
|
||||
this.$store.dispatch('training/setTrainingData', stepdData);
|
||||
getTrainingDetail(this.trainingId).then(resp => {
|
||||
const detail = resp.data;
|
||||
getProductDetail(detail.prdCode).then(rest => {
|
||||
const data = rest.data;
|
||||
loadMapData(detail.skinCode).then(() => {
|
||||
this.$store.dispatch('training/setPrdType', data.prdType);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.loadMapDataFailed'));
|
||||
this.endViewLoading();
|
||||
});
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.getMapStepsFailed'));
|
||||
this.$messageBox(this.$t('error.getMapDetailFailed'));
|
||||
this.endViewLoading();
|
||||
});
|
||||
} else {
|
||||
|
@ -67,9 +67,9 @@ export default {
|
||||
this.height = this._clientHeight - 50;
|
||||
},
|
||||
initLoadPage() {
|
||||
const data = { id: this.$route.params.trainingId };
|
||||
if (parseInt(data.id)) {
|
||||
getTrainingDetail(data)
|
||||
const trainingId = this.$route.params.trainingId;
|
||||
if (parseInt(trainingId)) {
|
||||
getTrainingDetail(trainingId)
|
||||
.then(res => {
|
||||
this.courseModel = {
|
||||
id: res.data.id,
|
||||
|
Loading…
Reference in New Issue
Block a user