update
1.修改逻辑,每次刷新后都会重新调用应急中心信息接口,重新处理
This commit is contained in:
@@ -115,24 +115,18 @@
|
|||||||
|
|
||||||
const setting = getSettings(DataType.yinChuan);
|
const setting = getSettings(DataType.yinChuan);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
screenPath.value = getCenterInfo?.screenPath;
|
|
||||||
options.value = {
|
|
||||||
center: [getCenterInfo?.longitude || 106.32, getCenterInfo?.latitude || 38.45], //地图中心点
|
|
||||||
zoom: 6, //地图显示的缩放级别
|
|
||||||
mapStyle: 'darkblue', //地图样式
|
|
||||||
};
|
|
||||||
try {
|
try {
|
||||||
const { result } = await getEmergencyCenterApi();
|
const { result } = await getEmergencyCenterApi();
|
||||||
if (result?.screenPath !== getCenterInfo?.screenPath) {
|
screenPath.value = result?.screenPath;
|
||||||
screenPath.value = result?.screenPath;
|
options.value = {
|
||||||
options.value = {
|
center: [result?.longitude || 106.32, result?.latitude || 38.45], //地图中心点
|
||||||
center: [result?.longitude || 106.32, result?.latitude || 38.45], //地图中心点
|
zoom: 8, //地图显示的缩放级别
|
||||||
zoom: 6, //地图显示的缩放级别
|
mapStyle: 'darkblue', //地图样式
|
||||||
mapStyle: 'darkblue', //地图样式
|
};
|
||||||
};
|
userStore.setCenterInfo(result);
|
||||||
userStore.setCenterInfo(result);
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
console.log([getCenterInfo?.longitude || 106.32, getCenterInfo?.latitude || 38.45]);
|
||||||
init();
|
init();
|
||||||
document.title = title.value;
|
document.title = title.value;
|
||||||
document.addEventListener('visibilitychange', checkTabState);
|
document.addEventListener('visibilitychange', checkTabState);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { nextTick, onMounted, ref } from 'vue';
|
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { RedoOutlined } from '@ant-design/icons-vue';
|
import { RedoOutlined } from '@ant-design/icons-vue';
|
||||||
import { Map } from '/@/assets/mapUtils/map';
|
import { Map } from '/@/assets/mapUtils/map';
|
||||||
@@ -198,13 +198,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
function initMap() {
|
||||||
Map.initMap({ el: 'centerMap', option: props.mapOptions }).then(() => {
|
Map.initMap({ el: 'centerMap', option: props.mapOptions }).then(() => {
|
||||||
getMapData(tabList[0].type, { centerId: userStore.getCenterInfo?.id });
|
getMapData(tabList[0].type, { centerId: userStore.getCenterInfo?.id });
|
||||||
Map.map && Map.map.on('zoomend', setLevel);
|
Map.map && Map.map.on('zoomend', setLevel);
|
||||||
Map.map && Map.map.on('zoomend', setLevel);
|
Map.map && Map.map.on('zoomend', setLevel);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.mapOptions,
|
||||||
|
() => {
|
||||||
|
initMap();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// onMounted(() => {
|
||||||
|
// });
|
||||||
const routeList = ref([]);
|
const routeList = ref([]);
|
||||||
const showRoutePanel = ref(false);
|
const showRoutePanel = ref(false);
|
||||||
const panelTitle = ref();
|
const panelTitle = ref();
|
||||||
|
|||||||
Reference in New Issue
Block a user