Commit 346baf26317dc563fa4a2ea349cd6464e20b10b7

Authored by liuqimichale
1 parent 705d9b15

map 地图

src/components/chinaMap/index.vue
... ... @@ -52,6 +52,7 @@
52 52 endVal: 1000
53 53 },
54 54 mapChart: {},
  55 + mapData:[],
55 56 }
56 57 },
57 58 computed: {
... ... @@ -71,24 +72,26 @@
71 72 }).then((response)=>{
72 73 let data = response.data.data
73 74 console.log(data)
  75 + //let mapData = [];
  76 + for (let i=0;i<data.length;i++){
  77 + // this.mapData.push({
  78 + // name:'赤峰',
  79 + // value:mapData[i].allBerthNum
  80 + // })
  81 + }
  82 + this.mapData.push({
  83 + name:'赤峰',
  84 + value:1000
  85 + })
  86 + this.mapChart= this.createPie();
  87 + window.addEventListener('resize', function() {
  88 + this.mapChart.resize()
  89 + }.bind(this));
74 90 }).catch((response)=>{
75 91 console.log(response);
76 92 })
77 93  
78   - this.mapChart= this.createPie();
79   - const _self=this;
80   - //var tmpCount=0;
81   -// setInterval(function(){
82   -// let tmpCount =Math.floor(Math.random()*3+1);;//1-3随机数
83   -// // _self.parkParams.startVal= _self.parkParams.endVal;
84   -// // _self.parkParams.endVal +=tmpCount;
85   -// //console.log(tmpCount);
86   -// _self.dayParams.startVal=_self.dayParams.endVal;
87   -// _self.dayParams.endVal +=tmpCount;
88   -// },10000);
89   - window.addEventListener('resize', function() {
90   - this.mapChart.resize()
91   - }.bind(this));
  94 +
92 95 },
93 96 methods: {
94 97 /*
... ... @@ -157,18 +160,20 @@
157 160 _getSeries(){
158 161 const geoCoordMap = {
159 162 '无锡': [120.318915, 31.494359],
160   - '北京': [116.372555, 39.918295],//北京西城
  163 + // '北京': [116.372555, 39.918295],//北京西城
161 164 '赤峰': [118.892761, 42.263681],
162   - '丹阳': [119.612594, 32.016089],
163   - '双流': [103.912493, 30.586969] //成都双流区
  165 + // '丹阳': [119.612594, 32.016089],
  166 + // '双流': [103.912493, 30.586969] //成都双流区
164 167 };
165 168 const dataFrom = '无锡';
166   - const data = [
167   - {name: '赤峰',value: 95},
168   - {name: '双流',value: 70},
169   - {name: '北京',value: 70},
170   - {name: '丹阳', value: 30}
171   - ];
  169 + // const data = [
  170 + // {name: '赤峰',value: 95},
  171 + // {name: '双流',value: 70},
  172 + // {name: '北京',value: 70},
  173 + // {name: '丹阳', value: 30}
  174 + // ];
  175 + const data = this.mapData;
  176 + console.log(data)
172 177 let tmpSeries=[{
173 178 //name: '无锡',
174 179 type: 'lines',
... ...