地图默认中心点埋点
This commit is contained in:
		@@ -26,8 +26,7 @@
 | 
				
			|||||||
      <img src="./img/build-icon.png" alt=""> 楼栋<br/>列表
 | 
					      <img src="./img/build-icon.png" alt=""> 楼栋<br/>列表
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div class="map-content">
 | 
					    <div class="map-content">
 | 
				
			||||||
      <AiTMap v-if="user.areaId" :areaId="user.areaId" :map.sync="map" :lib.sync="lib" :ops="ops"
 | 
					      <AiTMap :map.sync="map" :lib.sync="lib" :ops="ops" :libraries="['service', 'tools']"/>
 | 
				
			||||||
              :libraries="['service', 'tools']"/>
 | 
					 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <u-popup v-model="showPop" mode="bottom" border-radius="14">
 | 
					    <u-popup v-model="showPop" mode="bottom" border-radius="14">
 | 
				
			||||||
      <div class="popup">
 | 
					      <div class="popup">
 | 
				
			||||||
@@ -111,7 +110,6 @@ import {mapState} from 'vuex'
 | 
				
			|||||||
export default {
 | 
					export default {
 | 
				
			||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      latLngCenter: {},
 | 
					 | 
				
			||||||
      ops: {},
 | 
					      ops: {},
 | 
				
			||||||
      lib: null,
 | 
					      lib: null,
 | 
				
			||||||
      map: null,
 | 
					      map: null,
 | 
				
			||||||
@@ -133,9 +131,9 @@ export default {
 | 
				
			|||||||
      buildPopup: false
 | 
					      buildPopup: false
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  computed: {...mapState(['user'])},
 | 
					  computed: {...mapState(['user', 'config'])},
 | 
				
			||||||
  mounted() {
 | 
					  mounted() {
 | 
				
			||||||
    this.getCenterLatLng().then(points => {
 | 
					    this.getCommunityList().then(points => {
 | 
				
			||||||
      this.getMarkerCluster(points)
 | 
					      this.getMarkerCluster(points)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -146,14 +144,6 @@ export default {
 | 
				
			|||||||
    this.$dict.load("communityBuildingType")
 | 
					    this.$dict.load("communityBuildingType")
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
    getCenterLatLng() {
 | 
					 | 
				
			||||||
      return this.$http.post(`/app/appdvcpconfig/getCorpLocation`).then(res => {
 | 
					 | 
				
			||||||
        if (res?.data) {
 | 
					 | 
				
			||||||
          this.latLngCenter = res.data
 | 
					 | 
				
			||||||
          return this.getCommunityList()
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    getCommunityList() {
 | 
					    getCommunityList() {
 | 
				
			||||||
      return this.$http.post('/app/appcommunitybuildinginfo/listByBuilding', null, {
 | 
					      return this.$http.post('/app/appcommunitybuildinginfo/listByBuilding', null, {
 | 
				
			||||||
        params: {
 | 
					        params: {
 | 
				
			||||||
@@ -178,7 +168,7 @@ export default {
 | 
				
			|||||||
    getMarkerCluster(points, count = 0) {
 | 
					    getMarkerCluster(points, count = 0) {
 | 
				
			||||||
      let {lib: TMap, map} = this
 | 
					      let {lib: TMap, map} = this
 | 
				
			||||||
      if (map) {
 | 
					      if (map) {
 | 
				
			||||||
        map.setCenter(this.latLngCenter)
 | 
					        map.setCenter(this.config.latlng)
 | 
				
			||||||
        let MarkerCluster = new TMap.MarkerCluster({
 | 
					        let MarkerCluster = new TMap.MarkerCluster({
 | 
				
			||||||
          map, gridSize: 60,
 | 
					          map, gridSize: 60,
 | 
				
			||||||
          enableDefaultStyle: false, // 关闭默认样式
 | 
					          enableDefaultStyle: false, // 关闭默认样式
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,6 @@
 | 
				
			|||||||
            </span>
 | 
					            </span>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </u-popup>
 | 
					    </u-popup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,7 +61,7 @@ export default {
 | 
				
			|||||||
      polygons: []
 | 
					      polygons: []
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  computed: {...mapState(['user'])},
 | 
					  computed: {...mapState(['user', 'config'])},
 | 
				
			||||||
  created() {
 | 
					  created() {
 | 
				
			||||||
    this.$dict.load('girdType', 'girdLevel')
 | 
					    this.$dict.load('girdType', 'girdLevel')
 | 
				
			||||||
    this.areaId = this.user.areaId
 | 
					    this.areaId = this.user.areaId
 | 
				
			||||||
@@ -82,7 +81,7 @@ export default {
 | 
				
			|||||||
              arr.push(e.points.map(p => [p.lng, p.lat]))
 | 
					              arr.push(e.points.map(p => [p.lng, p.lat]))
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
          arr.length>0&&this.renderGridMap(arr)
 | 
					          arr.length > 0 && this.renderGridMap(arr)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -94,33 +93,38 @@ export default {
 | 
				
			|||||||
          this.polygons.forEach(e => e.destroy())
 | 
					          this.polygons.forEach(e => e.destroy())
 | 
				
			||||||
          this.polygons = []
 | 
					          this.polygons = []
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        let bounds = []
 | 
					        if (paths?.length > 0) {
 | 
				
			||||||
        paths.forEach((path, i) => {
 | 
					          let bounds = []
 | 
				
			||||||
          let color = colors[i % colors.length]
 | 
					          paths.forEach((path, i) => {
 | 
				
			||||||
          let polygon = new TMap.MultiPolygon({
 | 
					            let color = colors[i % colors.length]
 | 
				
			||||||
            map, styles: {
 | 
					            let polygon = new TMap.MultiPolygon({
 | 
				
			||||||
              default: new TMap.PolygonStyle({
 | 
					              map, styles: {
 | 
				
			||||||
                showBorder: true,
 | 
					                default: new TMap.PolygonStyle({
 | 
				
			||||||
                borderColor: color,
 | 
					                  showBorder: true,
 | 
				
			||||||
                borderWidth: 2,
 | 
					                  borderColor: color,
 | 
				
			||||||
                color: this.$colorUtils.Hex2RGBA(color, 0.1),
 | 
					                  borderWidth: 2,
 | 
				
			||||||
                borderDashArray: [10, 10]
 | 
					                  color: this.$colorUtils.Hex2RGBA(color, 0.1),
 | 
				
			||||||
              })
 | 
					                  borderDashArray: [10, 10]
 | 
				
			||||||
            },
 | 
					                })
 | 
				
			||||||
            geometries: [{paths: path.map(e => new TMap.LatLng(e[1], e[0]))}]
 | 
					              },
 | 
				
			||||||
 | 
					              geometries: [{paths: path.map(e => new TMap.LatLng(e[1], e[0]))}]
 | 
				
			||||||
 | 
					            })
 | 
				
			||||||
 | 
					            this.polygons.push(polygon)
 | 
				
			||||||
 | 
					            bounds.push(fitBounds(path.map(e => new TMap.LatLng(e[1], e[0]))))
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
          this.polygons.push(polygon)
 | 
					          bounds = bounds.reduce((a, b) => {
 | 
				
			||||||
          bounds.push(fitBounds(path.map(e => new TMap.LatLng(e[1], e[0]))))
 | 
					            return fitBounds([
 | 
				
			||||||
        })
 | 
					              a.getNorthEast(),
 | 
				
			||||||
        bounds = bounds.reduce((a, b) => {
 | 
					              a.getSouthWest(),
 | 
				
			||||||
          return fitBounds([
 | 
					              b.getNorthEast(),
 | 
				
			||||||
            a.getNorthEast(),
 | 
					              b.getSouthWest(),
 | 
				
			||||||
            a.getSouthWest(),
 | 
					            ]);
 | 
				
			||||||
            b.getNorthEast(),
 | 
					          });
 | 
				
			||||||
            b.getSouthWest(),
 | 
					          map.fitBounds(bounds, {padding: 100})
 | 
				
			||||||
          ]);
 | 
					        } else {
 | 
				
			||||||
        });
 | 
					          map.setCenter(this.config.latlng)
 | 
				
			||||||
        map.fitBounds(bounds, {padding: 100})
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        if (count < 5) {
 | 
					        if (count < 5) {
 | 
				
			||||||
          setTimeout(() => {
 | 
					          setTimeout(() => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,5 +32,8 @@ const app = new Vue({
 | 
				
			|||||||
  store,
 | 
					  store,
 | 
				
			||||||
  ...App
 | 
					  ...App
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					store.dispatch("agentSign").then(config => {
 | 
				
			||||||
 | 
					  store.commit("getConfig", {...config, latlng: [config.lat, config.lng]})
 | 
				
			||||||
 | 
					  app.$mount();
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.$mount();
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user