修改加载代码

This commit is contained in:
ival 2019-07-31 09:13:37 +08:00
parent 851c0a4a6a
commit 0157f32fc0
3 changed files with 11 additions and 3 deletions

View File

@ -185,7 +185,7 @@ const map = {
namespaced: true,
state: {
map: {}, // 地图数据
map: null, // 地图数据
mapList: {}, // 地图数据列表
mapViewLoadedCount: 0, // 地图视图加载完成标识
mapDataLoadedCount: 0, // 地图数据加载完成标识
@ -445,7 +445,7 @@ const map = {
}
},
mapClear: (state) => {
state.map = {};
state.map = null;
Vue.prototype.$jlmap && Vue.prototype.$jlmap.clear();
}
},

View File

@ -71,7 +71,11 @@ export default {
watch: {
'$store.state.map.map': function (val, old) {
try {
this.setMap(val);
if (val) {
this.setMap(val);
} else {
this.mapViewLoaded(false);
}
} catch (error) {
console.log('[ERROR] ', error);
this.mapViewLoaded(false);

View File

@ -148,6 +148,10 @@ export default {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
eventBus.$emit('viewLoading', false);
})
},
loadInitPage() {
this.$store.dispatch('training/changeMode', { mode: TrainingMode.MAP_EDIT });