update
1.修改部分问题(路线等问题) 2.添加定时器
This commit is contained in:
@@ -20,8 +20,11 @@
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
<div v-show="showHospitalList || showRestB" class="reset-map" :class="[themeType]" @click="resetMap">
|
||||
<RedoOutlined title="重置地图" />
|
||||
</div>
|
||||
<div v-show="showRoutePanel" v-click-outside="outClick" class="line-container">
|
||||
<div v-show="routeList.length" class="has-data">
|
||||
<div v-show="routeList.length > 0" class="has-data">
|
||||
<div class="line-title"> {{ panelTitle }}</div>
|
||||
<div class="line-content">
|
||||
<div class="start">起点</div>
|
||||
@@ -34,7 +37,7 @@
|
||||
<div class="end">终点</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-show="!routeList.length" class="empty-data"> 暂无数据</div>
|
||||
<div v-show="routeList.length === 0" class="empty-data"> 暂无数据</div>
|
||||
</div>
|
||||
<div class="map">
|
||||
<div style="flex: 1; overflow: hidden">
|
||||
@@ -61,7 +64,7 @@
|
||||
</div>
|
||||
|
||||
<div class="hospital-list" :class="[themeType]" v-if="showHospitalList">
|
||||
<div class="hospital-item" v-for="(item, index) in hospitalList" :key="index" @click="showDrivingLine(item)">
|
||||
<div class="hospital-item" v-for="(item, index) in hospitalList" :key="index" @click.stop="showDrivingLine(item)">
|
||||
<div>{{ item.name }}</div>
|
||||
<div>相距{{ item.distance }}</div>
|
||||
<div>驾车大约{{ item.driveTime }}</div>
|
||||
@@ -70,7 +73,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, ref } from 'vue';
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { infoContent, legendList, tabList } from '/@/views/indexSun/indexSun.ts';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { innerLineLight, outerLineOption } from '/@/assets/mapUtils/mapConstant.ts';
|
||||
@@ -80,6 +83,8 @@
|
||||
import $bus from '/@/utils/bus.ts';
|
||||
import { earlyWarning } from '/@/utils/busConstant.ts';
|
||||
import { useTheme } from '/@/hooks/theme/useTheme.ts';
|
||||
import { RedoOutlined } from '@ant-design/icons-vue';
|
||||
|
||||
const { themeType } = useTheme();
|
||||
const list = ref(tabList);
|
||||
const currentIndex = ref(0);
|
||||
@@ -99,9 +104,11 @@
|
||||
//是否展示最近的三个医院
|
||||
showHospitalList: {
|
||||
type: Boolean,
|
||||
default: () => {
|
||||
return false;
|
||||
},
|
||||
default: () => false,
|
||||
},
|
||||
showRestB: {
|
||||
type: Boolean,
|
||||
default: () => false,
|
||||
},
|
||||
hospitalList: {
|
||||
type: Array,
|
||||
@@ -114,10 +121,18 @@
|
||||
const showRoutePanel = ref(false);
|
||||
const panelTitle = ref();
|
||||
const level = ref(0);
|
||||
const drivingTitle = ref('');
|
||||
const routeList = ref([]);
|
||||
const emits = defineEmits(['clearHospitalList']);
|
||||
const showDrivingPanel = ref(false);
|
||||
const emits = defineEmits(['clearHospitalList', 'showRestB']);
|
||||
|
||||
watch(
|
||||
() => props.showHospitalList,
|
||||
(v) => {
|
||||
if (v) {
|
||||
watchInfoChangeTab(list.value[0], 0);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
const op = {
|
||||
el: 'xianmapContainer',
|
||||
@@ -130,7 +145,6 @@
|
||||
Map.map && Map.map.on('zoomend', setLevel);
|
||||
});
|
||||
$bus.on(earlyWarning, (params) => {
|
||||
console.log(params, 12323);
|
||||
drawMarker(params);
|
||||
});
|
||||
document.addEventListener('click', (e) => {
|
||||
@@ -148,7 +162,6 @@
|
||||
nextTick(() => {
|
||||
panelTitle.value = '全程' + item.driveTime + item.distance;
|
||||
routeList.value = item.routeList?.map((item) => item?.instruction);
|
||||
showDrivingPanel.value = true;
|
||||
if (item.lon) {
|
||||
Map.clearNaviLine();
|
||||
Map.createNaviLine(item.userLocation, [item.lon, item.lat]);
|
||||
@@ -168,10 +181,14 @@
|
||||
searchFlag.value = false;
|
||||
}
|
||||
|
||||
function changeTab(item, i: number) {
|
||||
currentIndex.value = i;
|
||||
Map.clearActiveHospital();
|
||||
function changeTab(item: any, i: number) {
|
||||
closeDrivingElement();
|
||||
currentIndex.value = i;
|
||||
tab(item);
|
||||
}
|
||||
|
||||
function tab(item: any) {
|
||||
Map.clearActiveHospital();
|
||||
Map.map.off('moveend', logMapinfo);
|
||||
if (TabType.diFangYiYuan == item.type) {
|
||||
let { lng, lat } = Map.getMapCenter();
|
||||
@@ -190,6 +207,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
function watchInfoChangeTab(item: any) {
|
||||
currentIndex.value = 0;
|
||||
tab(item);
|
||||
}
|
||||
|
||||
function searchRoute(callback: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null) {
|
||||
showRoutePanel.value = false;
|
||||
panelTitle.value = '';
|
||||
@@ -280,7 +302,7 @@
|
||||
Map.clearNavigationElements();
|
||||
formState.value.start = '';
|
||||
formState.value.end = '';
|
||||
showDrivingPanel.value = false;
|
||||
showRoutePanel.value = false;
|
||||
emits('clearHospitalList');
|
||||
}
|
||||
|
||||
@@ -320,6 +342,12 @@
|
||||
}
|
||||
Map.createMarker({ ...data, realName: data.userName });
|
||||
}
|
||||
|
||||
function resetMap() {
|
||||
closeDrivingElement();
|
||||
changeTab(list.value[currentIndex.value], currentIndex.value);
|
||||
emits('showRestB');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@@ -559,6 +587,7 @@
|
||||
}
|
||||
|
||||
.line-container {
|
||||
z-index: 99;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 54px;
|
||||
@@ -641,4 +670,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.reset-map {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50px;
|
||||
z-index: 99;
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
padding: 0px 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user