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