派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-17 a70b76f5f880dc6dfc9da8754e1d117c7ca5c7e7
src/components/LayerController/logic/WasteSolid.js
@@ -5,7 +5,8 @@
// 区分不同类型 使用不同img
const defaultImg = '/assets/images/map/solidwaste/voc.png'
const setting = '/assets/images/map/solidwaste/gf_green2.png'
// 公共方法 panTo() 引用
const { setPanTo } = require('../../../utils/utils')
// 请求接口数据
const mapApi = require('../../../api/mapApi').default
// 使用封装方法
@@ -46,33 +47,17 @@
  }
  this.bindTooltip = (layer) => {
    // '<div class="company-bindTooltip-hover"><h3>天津石化</h3></div>' +
    return layer.options.totransferData.Name
  }
  this.clickListener = (e) => {
    // 点击marker的pulse()光波
    this.animalService.pulseEffect(e.latlng)
    /* 点击数据的接口请求 */
    this.requestSolidWasteData(e).then(e)
  }
  // 不同类型图片封装
  this.differentTypes = (judgeValue) => {
    var effectOfChange
    if (judgeValue === 1) {
      effectOfChange = defaultImg
    } else {
      effectOfChange = setting
    }
    return effectOfChange
  }
  // 根据点击不同数据 进行接口的数据请求
  this.requestSolidWasteData = async (e) => {
    /* flyTo()弹出框平移事件 */
    setPanTo(e.latlng, 200)
    // 弹框标题
    const title = e.layer.options.totransferData.Name
    /* flyTo()弹出框平移事件 */
    this.setPanTo(e.latlng, 300)
    window.$layer.open({
      content: {
        content: WasteSolidIndex, // 组件
@@ -85,12 +70,14 @@
    })
  }
  // flayTo() 弹框的可滑动事件
  this.setPanTo = (pos, value) => {
    var position = pos
    position = window.map.latLngToLayerPoint(position)
    position.y += value
    position = window.map.layerPointToLatLng(position)
    window.map.flyTo(position)
  // 不同类型图片封装
  this.differentTypes = (judgeValue) => {
    var effectOfChange
    if (judgeValue === 1) {
      effectOfChange = defaultImg
    } else {
      effectOfChange = setting
    }
    return effectOfChange
  }
}