kongdeqiang
13 小时以前 5788c53ae08862613544ec224212024e18ccf7cd
src/components/page/leaderShow/leaderIndex.vue
@@ -210,6 +210,7 @@
    import shangjiZhipaiForm from "./Dialog/shangjiZhipaiForm";
    import xunjieOrderForm from "./Dialog/xunjieOrderForm";
    import weizhangForm from "./Dialog/weizhangForm";
    import BaiduMap from "../../common/baiduMap";
    export default {
        name: "leaderIndex",
        components: {
@@ -230,8 +231,8 @@
                pageConfig: {
                    getDataUrl: this.$systemconfig.basePath + '/statistic/getData1',
                    getLogoUrl: this.$systemconfig.basePath + '/statistic/getLogo',
                    findAllUrl: this.$systemconfig.basePath + '/user/findAll',
                    illegalCarUrl: this.$systemconfig.basePath + '/notice/illegalCar2',
                    findAllUrl: this.$systemconfig.basePath + '/ffzf/user/findAll',
                    illegalCarUrl: this.$systemconfig.basePath + '/ffzf/notice/illegalCar2',
                },
                weizhangTimer:null,  //违章list定时器
                getDataTimer:null, //统计数据定时器
@@ -292,8 +293,14 @@
            }
        },
        mounted() {
            BaiduMap.init()
                .then((BMap) => {
                  console.log('地图初始化')
                //   this.inits()
                    this.createMap(BMap)
                })
            this.newTimes()
            this.userName = this.getStore('name')
            this.userName = this.getStore('userinfo')
            this.getData()
            this.$nextTick(() => {
                this.createMap()
@@ -436,30 +443,36 @@
                   this.$refs.zhipaiForm.initData()
               })
            },
            createMap(){  // // 方法 - 创建地图
            createMap(BMap){  // // 方法 - 创建地图
                // 在百度地图容器中创建地图实例
                let map = new BMap.Map("container");
                // 将map变量存储在全局
                this.map = map;
                // let goodsData = require('../../../assets/custom_map_config.json')
                // 设定地图的中心点和坐标
                let point = new BMap.Point(this.centerLng, this.centerLat);
                // let marker = new BMap.Marker(point) // 创建标注
                // 设置中心点坐标和地图级别
                this.map.centerAndZoom(point, 1);
                // 添加自定义覆盖物
                // this.map.addOverlay(marker) // 将标注添加到地图中
                // 允许滚轮缩放
                this.map.enableScrollWheelZoom(point, 15);
                // 设置地图默认缩放比例
                this.map.setZoom(15);
                this.map.setMapStyle({
                       style:'midnight'
                            // styleJson:goodsData
                 });
                this.addHeatMap(this.map)
                this.addMarker(this.map,point)
                let map = new BMap.Map('container');
                this.$nextTick(() => {
                    // 将map变量存储在全局
                    this.map = map;
                    //  let goodsData = require('../../../assets/custom_map_config.json')
                    // 设定地图的中心点和坐标
                    let point = new BMap.Point(this.centerLng, this.centerLat);
                    let marker = new BMap.Marker(point) // 创建标注
                    // 设置中心点坐标和地图级别
                    this.map.centerAndZoom(point, 1);
                    // 添加自定义覆盖物
                    this.map.addOverlay(marker) // 将标注添加到地图中
                    // 允许滚轮缩放
                    this.map.enableScrollWheelZoom(point, 15);
                    // 设置地图默认缩放比例
                    this.map.setZoom(15);
                    this.map.setMapStyle({
                        // style:'midnight',
                        styleJson:goodsData
                    });
                    this.map.addEventListener("tilesloaded", () => {
                        this.addHeatMap(this.map); // 确保在 tilesloaded 事件后调用
                    });
                    // this.addHeatMap(this.map)
                    this.addMarker(this.map,point)
                })
            },
            addHeatMap(map) {  //热力图
                this.$byutil.postData(this,this.pageConfig.getLogoUrl,null,res => {