vue项目中如何使用百度地图

 

api 参考  http://lbsyun.baidu.com/cms/jsapi/class/jsapi_reference.html#a3b26

两种使用方式:vue特定的VueBaiduMap /原生js

第一种使用 Vue Baidu Map

网址:https://dafrok.github.io/vue-baidu-map/#/zh/index

实例如下

<comment>

</comment>
<template>
  <div id="Map">
    <baidu-map
      class="bMap"
      :center="mainData.city"
      :zoom="mainData.zoom"
      @ready="initMap"
      :mapStyle="mapStyle"
      :scroll-wheel-zoom="true"
      ak=""
    >
      <bm-map-type
        :map-types="['BMAP_NORMAL_MAP', 'BMAP_SATELLITE_MAP']"
        anchor="BMAP_ANCHOR_TOP_RIGHT"
      ></bm-map-type>
     <!--  :icon="{url: item.projectAlertState === 0 ? require('../../assets/image/emergency/markImgOutline.png') :  item.projectAlertState === 1 ? require('../../assets/image/emergency/markImgOnline.png') : require('../../assets/image/emergency/markImgAlart.png') , size: {width: 58, height: 62}}" -->
      <bm-marker
        v-for="(item,index) in pointsListTest"
        :title="item.name"
        :key="'point'+index"
        :position="{lng: item.lng, lat: item.lat}"
        @click="markClick($event,item)"
      ></bm-marker>
      <!-- <bm-polyline
        v-for="(item,index) in polylinePath"
        :key="index"
        :path="item"
        :strokeColor="index%2==0?'#e6a23c':'#f56c6c'"
        :strokeOpacity="1"
        :strokeWeight="1.5"
      ></bm-polyline> -->
      <!-- <bm-info-window
        v-for="(item,index) in pointsList"
        :key="'modal'+index"
        :position="{lng: item.lng, lat: item.lat}"
        :offset="{height:-20,width:-3}"
        :show="currentPointId==item.id"
        @close="currentPointId=''"
      >
        <div style="padding:10px 0">
          <p style="margin:5px 0;margin-bottom:15px;">项目名称:{{item.name}}</p>
          <p style="text-align:right">

          <span class="btn" @click="showDetail(item.id)">查看详情</span>
          </p>
        </div>
      </bm-info-window>-->
      <!-- <bm-boundary
        name="广州南沙区"
        :strokeWeight="3"
        strokeColor="#FFFFFF"
        :fillOpacity="0.2"
        fillColor="#FFFFFF"
      ></bm-boundary>-->
    </baidu-map>
    <div class="modalContainer" v-if="visible" @click="visible=!visible">
      <div class="modal">
        <div class="modal-title">
          <span>详情</span>
          <span class="icon" @click.stop="visible=false">
            <i class="el-icon-error"></i>
          </span>
        </div>
        <div class="modal-body">
          <table>
            <tr>
              <td style="width:75px;">项目名称:</td>
              <td>{{modalData.name}}</td>
            </tr>
          </table>
        </div>
        <div class="modal-footer">
          <span class="btn" @click.stop="showDetail(modalData.id)">查看详情</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import BaiduMap from "vue-baidu-map/components/map/Map.vue"; //百度地图接入
// import { BmlMarkerClusterer } from "vue-baidu-map";
import { BmMarker } from "vue-baidu-map"; //百度地图 撒点
import { BmBoundary } from "vue-baidu-map"; //屏蔽层
import { BmMapType } from "vue-baidu-map"; //地图类型控件  普通图、卫星图、卫星加路网混合图和三维图
import { BmInfoWindow } from "vue-baidu-map"; //地图类型控件  普通图、卫星图、卫星加路网混合图和三维图
import { BmPolyline } from "vue-baidu-map"; //线段

export default {
  name: "Map",
  components: {
    BaiduMap,
    // BmlMarkerClusterer,
    BmMarker, //标记点
    BmBoundary, //屏蔽层
    BmMapType, //地图类型控件
    BmInfoWindow, //信息窗体-弹出框
    BmPolyline //线段
  },
  data() {
    return {
      //地图主题样式
      mapStyle: {
        // styleJson: [
        //   {
        //     featureType: "all",
        //     elementType: "geometry",
        //     stylers: {
        //       hue: "#091143",
        //       saturation: 100
        //     }
        //   },
        //   {
        //     featureType: "water",
        //     elementType: "all",
        //     stylers: {
        //       color: "#ffffff"
        //     }
        //   }
        // ],
        style: "midnight"
      },
      visible: false,
      modalData: {
        name: "",
        id: ""
      },
      BMap: null,
      map: null,
      blist: [],
      districtLoading: 0,
      // 项目标点
      itemPoints: [],
      mainData :{
        city: { lng: 113.531, lat: 22.7046 },
        zoom: 11
      },
      currentPointId: "",
      pointsList: [],
      pointsListTest: [
        {
          name: "中铁十六局",
          id: "936",
          lng: "113.3484484793",
          lat: "22.845750655",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "中铁二局",
          id: "936",
          lng: "113.5602469939",
          lat: "22.8256307025",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "中水利十四局",
          id: "936",
          lng: "113.403522605",
          lat: "22.8079118286",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "中铁隧道局",
          id: "936",
          lng: "113.4938821223",
          lat: "22.7813844663",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "广东水电三局",
          id: "936",
          lng: "113.6039728703",
          lat: "22.659178119",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "广东水电二局",
          id: "936",
          lng: "113.5582922075",
          lat: "22.7981686582",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        }
      ],
      polylinePath: [
        [
          { lng: "113.5582922075", lat: "22.7981686582" },
          { lng: "113.6039728703", lat: "22.659178119" }
        ],
        [
          { lng: "113.4938821223", lat: "22.7813844663" },
          { lng: "113.403522605", lat: "22.8079118286" }
        ]
      ]
    };
  },
  computed: {},
  created() {
  },
  mounted() {
    //this.getOrgInfo();
  },
  watch: {
    // 标记撒点监听
  },
  methods: {
    // 地图init
    initMap({ BMap, map }) {
      // console.log(BMap, map);
      this.BMap = BMap;
      this.map = map;
      this.blist = [];
      //画线
      //this.drawLine();
      //行政区域增加屏蔽层
      this.addDistrict("广州南沙区");
      
    },
    //请求后台数据
    getOrgInfo() {
      //let url = window.location.search;
      // if(url){
      //     sessionStorage.setItem('token',url.substr(1));
      // }else{
      //     let token = sessionStorage.getItem('token');
      //     if(!token){
      //         this.$message.error('系统异常,详情请联系管理员');
      //         return ;
      //     }
      // }
      sessionStorage.setItem("token", "f181c937130fdee4ed38a20819e27190");
      let aa = new FormData();
      aa.set("token", this.$Api.gettoken("token"));
      aa.set("level", "5");
      this.$Api.post("App/ProjectExtra/get_area_info", aa).then(success => {
        if (success.data.code == "0") {
          this.pointsList = success.data.data;
          //地图相关
        } else {
          //this.$Api.message('商品获取失败', 'error');
        }
      });
    },
    //地图标记点的点击事件
    markClick(e, item) {
      this.visible = true;
      this.modalData = item;
      //this.currentPointId = id;
    },
    // 点击“查看详情”按钮
    showDetail(id) {
      let _href = window.location.host;
      if (_href.indexOf("autobuild") != -1) {
        window.open(
          "http://autobuild.1357.cn/Admin/SmartScreen/index?access_org_id=" +
            id,
          "_blank"
        );
      } else if (_href.indexOf("spm") != -1) {
        window.open(
          "http://spm.1357.cn/Admin/SmartScreen/index?access_org_id=" + id,
          "_blank"
        );
      }
    },
    drawLine() {
      var sy = new this.BMap.Symbol(BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW, {
        scale: 0.4, //图标缩放大小
        strokeColor: "#fff", //设置矢量图标的线填充颜色
        strokeWeight: "1.5" //设置线宽
      });
      var icons = new this.BMap.IconSequence(sy, "10", "30");
      // 创建polyline对象
      var pois = [
        new this.BMap.Point(113.5582922075, 22.7981686582),
        new this.BMap.Point(113.6039728703, 22.659178119)
      ];
      var polyline = new this.BMap.Polyline(pois, {
        enableEditing: false, //是否启用线编辑,默认为false
        enableClicking: true, //是否响应点击事件,默认为true
        icons: [icons],
        strokeWeight: "2", //折线的宽度,以像素为单位
        strokeOpacity: 1, //折线的透明度,取值范围0 - 1
        strokeColor: "#67c23a" //折线颜色
      });
      this.map.addOverlay(polyline);
    },
    /**
     * 以下方法全都是为了给“广州南沙区增加屏蔽层”
     */
    addDistrict(districtName) {
      //使用计数器来控制加载过程
      this.districtLoading++;
      var bdary = new this.BMap.Boundary();
      bdary.get(districtName, rs => {
        //获取行政区域
        var count = rs.boundaries.length; //行政区域的点有多少个
        if (count === 0) {
          alert("未能获取当前输入行政区域");
          return;
        }
        for (let i = 0; i < count; i++) {
          this.blist.push({ points: rs.boundaries[i], name: districtName });
        }
        //加载完成区域点后计数器-1
        this.districtLoading--;
        if (this.districtLoading == 0) {
          //全加载完成后画端点
          this.drawBoundary();
        }
      });
    },
    //反选行政区
    drawBoundary() {
      //包含所有区域的点数组
      var pointArray = [];

      /*画遮蔽层的相关方法
       *思路: 首先在中国地图最外画一圈,圈住理论上所有的中国领土,然后再将每个闭合区域合并进来,并全部连到西北角。
       *      这样就做出了一个经过多次西北角的闭合多边形*/
      //定义中国东南西北端点,作为第一层
      var pNW = { lat: 59.0, lng: 73.0 };
      var pNE = { lat: 59.0, lng: 136.0 };
      var pSE = { lat: 3.0, lng: 136.0 };
      var pSW = { lat: 3.0, lng: 73.0 };
      //向数组中添加一次闭合多边形,并将西北角再加一次作为之后画闭合区域的起点
      var pArray = [];
      pArray.push(pNW);
      pArray.push(pSW);
      pArray.push(pSE);
      pArray.push(pNE);
      pArray.push(pNW);
      //循环添加各闭合区域
      for (var i = 0; i < this.blist.length; i++) {
        //添加显示用标签层
        var label = new this.BMap.Label(this.blist[i].name, {
          offset: new this.BMap.Size(20, -10)
        });
        label.hide();
        this.map.addOverlay(label);

        //添加多边形层并显示
        var ply = new this.BMap.Polygon(this.blist[i].points, {
          strokeWeight: 4,
          strokeColor: "#ffffff",
          fillOpacity: 0.01,
          fillColor: " #FFFFFF"
        }); //建立多边形覆盖物
        // ply.name = this.blist[i].name;
        // ply.label = label;
        this.map.addOverlay(ply);

        //添加名称标签层
        // var centerlabel = new this.Label(this.blist[i].name, { offset: new this.BMap.Size(0, 0) });
        // centerlabel.setPosition(ply.getBounds().getCenter());
        // this.map.addOverlay(centerlabel);

        //将点增加到视野范围内
        var path = ply.getPath();
        pointArray = pointArray.concat(path);
        //将闭合区域加到遮蔽层上,每次添加完后要再加一次西北角作为下次添加的起点和最后一次的终点
        pArray = pArray.concat(path);
        pArray.push(pArray[0]);
      }

      //限定显示区域,需要引用api库
      // var boundply = new this.BMap.Polygon(pointArray);
      // BMapLib.AreaRestriction.setBounds(map, boundply.getBounds());
      // this.map.setViewport(pointArray);    //调整视野

      //添加遮蔽层
      var plyall = new this.BMap.Polygon(pArray, {
        strokeOpacity: 0.0000001,
        strokeColor: "#000000",
        strokeWeight: 0.00001,
        fillColor: "rgba(26, 35, 42, 1)",
        fillOpacity: 0.5
      }); //建立多边形覆盖物
      this.map.addOverlay(plyall);
    }
  },
  destroyed() {}
};
</script>

<style lang="scss">
#Map {
  height: 100%;
  position: relative;
  .anchorBL {
    display: none;
  }
  .modalContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.12);
    .modal {
      position: absolute;
      width: 300px;
      height: 150px;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background-image: url("../../assets/imgs/modal_bg.png");
      background-color: rgba(0, 0, 0, 0.12);
      background-repeat: no-repeat;
      background-size: 100% 100%;
      background-position: center center;
      color: rgba(255, 255, 255, 0.8);
      table {
        tr {
          td {
            vertical-align: top;
          }
        }
      }
      z-index: 10;
      .modal-title {
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
        padding: 0px 10px;
        .icon {
          padding: 0px 0 10px 6px;
          font-size: 16px;
          color: rgba(255, 255, 255, 0.8);
          cursor: pointer;
        }
      }
      .modal-body {
        padding: 5px 15px;
        height: 54px;
      }
      .modal-footer {
        padding: 5px 15px;
        text-align: right;
      }
    }
  }

  .bMap {
    width: 100%;
    height: 100%;
  }
  .BMap_pop {
    div {
    }
  }
  .BMap_pop div,
  .BMap_pop .BMap_center,
  .BMap_pop .BMap_top,
  .BMap_pop .BMap_bottom {
    border: none !important;
  }
  .btn {
    cursor: pointer;
    padding: 6px 10px;
    background: transparent;
    text-align: center;
    color: #fff;
    background: rgba(28, 217, 255, 1);
    border-radius: 5px;
    // box-shadow: 0px 0px 30px rgba(28, 217, 255, 0.8) inset;
  }
}
</style>

第二种:原生js

网址:http://lbsyun.baidu.com/jsdemo.htm#c1_25

实例如下

<template>
  <!--需求描述-->
  <!--公司级:南沙水务局-->

  <!--需求:参考成都倍特项目,公司级大屏地图模式下,选用广州市南沙区地图,且该地图可链接到任意一款地图中的卫星地图中,地图可进行放大缩小,地图上标定点位可以跳转到相应项目的大屏。-->

  <!--完成时间:9月29日-->
  <div id="btMap">
    <div id="map_main" style="height:100%;width:100%;transform: scale(1);margin-left:0px;"></div>
  </div>
</template>

<script>
var BMapLib = (window.BMapLib = BMapLib || {});
var blist = [];
var districtLoading = 0;
window.loadJScript = function() {
  var script = document.createElement("script");
  script.type = "text/javascript";
  script.src =
    "http://api.map.baidu.com/api?v=2.0&ak=xfpEeKgg9wUnwyVAAzBEL1GRZROmAB32&callback=init";
  script.id = "mapsrc";
  document.body.appendChild(script);
};
window.showInfo = function(id) {
  window.open(
    window.location.host + "/Admin/SmartScreen/index?access_org_id=" + id,
    "_blank"
  );
};
export default {
  name: "map",
  data() {
    return {
      soft: [
        {
          name: "中铁十六局",
          id: "936",
          lng: "113.3484484793",
          lat: "22.845750655",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "中铁二局",
          id: "936",
          lng: "113.5602469939",
          lat: "22.8256307025",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "中水利十四局",
          id: "936",
          lng: "113.403522605",
          lat: "22.8079118286",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "中铁隧道局",
          id: "936",
          lng: "113.4938821223",
          lat: "22.7813844663",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "广东水电三局",
          id: "936",
          lng: "113.6039728703",
          lat: "22.659178119",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        },
        {
          name: "广东水电二局",
          id: "936",
          lng: "113.5582922075",
          lat: "22.7981686582",
          status: "2",
          progress: "1",
          type: 5,
          zoom: 0,
          danger_list: [
            { color: "#ff0000", count: "1" },
            { color: "#0080ff", count: "4" }
          ],
          danger_count: 5
        }
      ]
    };
  },
  methods: {
    gdApi(allpoData) {
      let that = this;
      this.innerVisible = true;

      var map = "";
      window.init = function() {
        map = new BMap.Map("map_main", { enableMapClick: false });
        // 创建Map实例
        var pointer = new BMap.Point(113.531, 22.7046); //103.829313,36.073536
        // var pointer = new BMap.Point(113.311118,22.481607)
        that.lat = 113.311118;
        that.lng = 22.481607;
        map.centerAndZoom(pointer, 11);
        map.enableScrollWheelZoom();
        map.addControl(
          new BMap.MapTypeControl({
            mapTypes: [BMAP_NORMAL_MAP, BMAP_SATELLITE_MAP]
          })
        );

        var plength = allpoData.length;
        var allpoint = [];
        var pstatus = ["未开工", "在建", "停工", "完工"];
        var pjindu = ["无", "工期正常", "工期超前", "工期滞后"];
        for (let i = plength; i--; ) {
          let pointer1 = new BMap.Point(
            parseFloat(allpoData[i].lng).toFixed(6),
            parseFloat(allpoData[i].lat).toFixed(6)
          );
          let marker = new BMap.Marker(pointer1);
          map.addOverlay(marker);
          allpoint.push(pointer1);
          addInfo(
            `
                        <div class='dotext' style='margin-top:20px;'>项目名称:${allpoData[i].name}</div><div style='text-align: right;margin-right: 14px'>
                        <button style="background: #2E5893;color: #fff;border-radius: 4px;font-size: 13px;padding:2px 4px"
                        οnclick="showInfo(${allpoData[i].id})">查看详情
                        </button></div>
                        `,
            marker
          );
        }
        if (plength <= 0) {
          var marker = new BMap.Marker(pointer);
          map.addOverlay(marker);
          allpoint.push(pointer);
        }
        // map.disableDragging();
        map.disableDoubleClickZoom();
        //赋值经纬度
        // that.lat = 113.3110;
        // that.lng = 22.4816;
        var size = new BMap.Size(10, 20);
        var mapStyle = { style: "midnight" };
        map.setMapStyle(mapStyle);
        setTimeout(function() {
          getBoundary();
        }, 0);
      };
      function getBoundary() {
        blist = [];
        addDistrict("广州南沙区");
      }
      function addDistrict(districtName) {
        //使用计数器来控制加载过程
        districtLoading++;
        var bdary = new BMap.Boundary();
        bdary.get(districtName, function(rs) {
          //获取行政区域
          var count = rs.boundaries.length; //行政区域的点有多少个
          if (count === 0) {
            alert("未能获取当前输入行政区域");
            return;
          }
          for (var i = 0; i < count; i++) {
            blist.push({ points: rs.boundaries[i], name: districtName });
          }
          //加载完成区域点后计数器-1
          districtLoading--;
          if (districtLoading == 0) {
            //全加载完成后画端点
            drawBoundary();
          }
        });
      }
      function drawBoundary() {
        //包含所有区域的点数组
        var pointArray = [];

        /*画遮蔽层的相关方法
         *思路: 首先在中国地图最外画一圈,圈住理论上所有的中国领土,然后再将每个闭合区域合并进来,并全部连到西北角。
         *      这样就做出了一个经过多次西北角的闭合多边形*/
        //定义中国东南西北端点,作为第一层
        var pNW = { lat: 59.0, lng: 73.0 };
        var pNE = { lat: 59.0, lng: 136.0 };
        var pSE = { lat: 3.0, lng: 136.0 };
        var pSW = { lat: 3.0, lng: 73.0 };
        //向数组中添加一次闭合多边形,并将西北角再加一次作为之后画闭合区域的起点
        var pArray = [];
        pArray.push(pNW);
        pArray.push(pSW);
        pArray.push(pSE);
        pArray.push(pNE);
        pArray.push(pNW);
        //循环添加各闭合区域
        for (var i = 0; i < blist.length; i++) {
          //添加显示用标签层
          var label = new BMap.Label(blist[i].name, {
            offset: new BMap.Size(20, -10)
          });
          label.hide();
          map.addOverlay(label);

          //添加多边形层并显示
          var ply = new BMap.Polygon(blist[i].points, {
            strokeWeight: 4,
            strokeColor: "#ffffff",
            fillOpacity: 0.01,
            fillColor: " #FFFFFF"
          }); //建立多边形覆盖物
          // ply.name = blist[i].name;
          // ply.label = label;
          map.addOverlay(ply);

          //添加名称标签层
          // var centerlabel = new BMap.Label(blist[i].name, { offset: new BMap.Size(0, 0) });
          // centerlabel.setPosition(ply.getBounds().getCenter());
          // map.addOverlay(centerlabel);

          //将点增加到视野范围内
          var path = ply.getPath();
          pointArray = pointArray.concat(path);
          //将闭合区域加到遮蔽层上,每次添加完后要再加一次西北角作为下次添加的起点和最后一次的终点
          pArray = pArray.concat(path);
          pArray.push(pArray[0]);
        }

        //限定显示区域,需要引用api库
        // var boundply = new BMap.Polygon(pointArray);
        // BMapLib.AreaRestriction.setBounds(map, boundply.getBounds());
        // map.setViewport(pointArray);    //调整视野

        //添加遮蔽层
        var plyall = new BMap.Polygon(pArray, {
          strokeOpacity: 0.0000001,
          strokeColor: "#000000",
          strokeWeight: 0.00001,
          fillColor: "rgba(26, 35, 42, 1)",
          fillOpacity: 0.5
        }); //建立多边形覆盖物
        map.addOverlay(plyall);
      }
      function addInfo(txt, marker) {
        var infoWindow = new BMap.InfoWindow(txt);
        infoWindow.id = "newwindow";
        marker.addEventListener("click", function() {
          this.openInfoWindow(infoWindow);
          setTimeout(function() {
            let ele = document.querySelector(
              '.BMap_pop img[src="http://api0.map.bdimg.com/images/iw_close1d3.gif"]'
            );

            // console.log(ele.offsetLeft -15);
            ele.style.left = ele.offsetLeft - 10 + "px";
          }, 0);
        });
      }

      loadJScript();
    },
    getOrgInfo() {
      let url = window.location.search;
      if (url) {
        sessionStorage.setItem("token", url.substr(1));
      } else {
        let token = sessionStorage.getItem("token");
        if (!token) {
          this.$message.error("系统异常,详情请联系管理员");
          return;
        }
      }
      let that = this;
      let aa = new FormData();
      aa.set("token", this.$Api.gettoken("token"));
      aa.set("level", "5");
      this.$Api.post("App/ProjectExtra/get_area_info", aa).then(success => {
        if (success.data.code == "0") {
          that.bigmapData = success.data.data;
          //地图相关
          that.gdApi(that.bigmapData);
        } else {
          //that.$Api.message('商品获取失败', 'error');
        }
      });
    }
  },
  mounted() {
    // this.gdApi(this.soft);
    this.getOrgInfo();
  },
  created() {}
};
</script>

<style scoped>
#btMap {
  /*width: 740px;*/
  /*height: 630px;*/
  /*overflow: hidden;*/
  width: 100%;
  height: 100%;
  background: rgba(26, 35, 42, 1);
}
button {
  border-radius: 2px;
  background: #2e5893;
  color: #fff;
  font-size: 14px;
}
</style>
<style>
.anchorBL {
  display: none !important;
}
/*地图标题*/
.BMap_bubble_title {
  color: white;
  font-size: 13px;
  font-weight: bold;
  text-align: left;
  padding-left: 5px;
  padding-top: 5px;
  border-bottom: 1px solid gray;
  background-color: #2756ca;
}
/* 消息内容 */
.BMap_bubble_content {
  background-color: #fff;
  padding-left: 5px;
  padding-top: 5px;
  padding-bottom: 10px;
}
/* 内容 */
.BMap_pop div:nth-child(9) {
  top: 35px !important;
  border-radius: 7px;
}
/* 左上角删除按键 */
.BMap_pop img {
  top: 43px !important;
  -left: 215px !important;
}
.BMap_top {
  display: none;
}
.BMap_bottom {
  display: none;
}
.BMap_center {
  display: none;
}
/* 隐藏边角 */
.BMap_pop div:nth-child(1) div {
  display: none;
}
.BMap_pop div:nth-child(3) {
  display: none;
}
.BMap_pop div:nth-child(5) {
  display: none;
}
.BMap_pop div:nth-child(7) {
  display: none;
}
.dotext {
  width: 108%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.8em;
  padding: 0 5px;
  display: block !important;
  box-sizing: border-box;
}
</style>
发布了180 篇原创文章 · 获赞 23 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/qq_37899792/article/details/102506010
今日推荐