马宇豪
2025-05-08 1289c40801a6f0da5ba786fb4a9e8203e3e2620a
src/views/bigScreen/components/map.vue
@@ -1,5 +1,5 @@
<template>
  <baidu-map class="bigMap" ref="map" ak="Z4tYehNEVsdeMw3Mjspdn77pV50ffc8t" @zoomend="zoomMap" v="3.0" type="API" :scroll-wheel-zoom="true" :center="{lng: 87.681678, lat: 43.943557}" :zoom="18" map-type="BMAP_SATELLITE_MAP" @ready="initMap">
  <baidu-map class="bigMap" ref="map" ak="Z4tYehNEVsdeMw3Mjspdn77pV50ffc8t" v="3.0" @zoomend="zoomMap" type="API" :scroll-wheel-zoom="true" :center="{lng: 87.681678, lat: 43.943557}" :zoom="18" map-type="BMAP_SATELLITE_MAP" @ready="initMap">
        <bm-overlay pane="mapPane" class="polys" @draw="initMap">
          <bm-polygon :path="polygonPath1" stroke-color="yellow" fillColor="yellow" :fillOpacity="0.7" :stroke-weight="2" :zIndex="2"/>
          <bm-label content="1" :position="{lng: 87.679807, lat: 43.94402 }" :labelStyle="tittleStyle" title="1" :zIndex="3"/>
@@ -78,7 +78,6 @@
  polylinePath21: Array<location>
  polylinePath22: Array<location>
  textStyle: {}
  textStyle2: {}
  tittleStyle: {}
  numberStyle: {}
}
@@ -111,12 +110,6 @@
        fontSize : '16px',
        backgroundColor: 'rgba(0,0,0,0)',
        borderColor: '#fff'
      },
      textStyle2: {
        color: 'red',
        fontSize : '16px',
        backgroundColor: 'rgba(0,0,0,0)',
        borderColor: 'red'
      },
      tittleStyle: {
        color: '#000000',
@@ -164,21 +157,20 @@
      state.polylinePath2 = [{ lng: 87.681000, lat: 43.942226}, {lng: 87.680323, lat: 43.943302}]
      state.polylinePath21 = [{lng: 87.680323, lat: 43.943302},{ lng: 87.680303, lat: 43.943202}]
      state.polylinePath22 = [{lng: 87.680323, lat: 43.943302},{ lng: 87.680453, lat: 43.943242}]
    }
    const zoomMap = (type, target)=>{
      if(type.target.Za>=18){
    const zoomMap = (e)=>{
      const zoom = e.target.getZoom()
      if(zoom>=18){
        state.textStyle.fontSize = '16px'
        state.textStyle2.fontSize = '16px'
        state.tittleStyle.fontSize = '20px'
        state.numberStyle.fontSize = '16px'
      }else if(type.target.Za>=15 && type.target.Za<=17){
      }else if(zoom>=15 && zoom<=17){
        state.textStyle.fontSize = '12px'
        state.textStyle2.fontSize = '12px'
        state.tittleStyle.fontSize = '14px'
        state.numberStyle.fontSize = '12px'
      }else{
        state.textStyle.fontSize = '10px'
        state.textStyle2.fontSize = '10px'
        state.tittleStyle.fontSize = '10px'
        state.numberStyle.fontSize = '10px'
      }