Commit ac48d4e3 authored by zhengke's avatar zhengke

修改地图

parent a21ed534
...@@ -120,11 +120,9 @@ export default { ...@@ -120,11 +120,9 @@ export default {
}, },
addPoint(param){ addPoint(param){
console.log(param)
let ad=param.address?param.address:param.city let ad=param.address?param.address:param.city
var myGeo = new BMap.Geocoder(); var myGeo = new BMap.Geocoder();
var that=this var that=this
console.log(ad)
myGeo.getPoint(ad, function(point){ myGeo.getPoint(ad, function(point){
if (point) { if (point) {
var geo = that.myChart.getModel().getComponent('geo').coordinateSystem; var geo = that.myChart.getModel().getComponent('geo').coordinateSystem;
......
<template> <template>
<div class="echarts" :style="{height:'110%',width:'110%'}"> <div class="echarts" :style="{height:'110%',width:'110%'}">
<div :style="{height:'110%',width:'110%'}" ref="myEchart"></div> <div :style="{height:'110%',width:'110%'}" ref="myEchart"></div>
<div v-if="isShow" v-for="(item, index) in points" :key="index" class="viittoHot" :style="{left:(item[0]-5)+'px',top:(item[1]-5)+'px'}"></div>
<div v-if="isShow2" v-for="(item, subIndex) in ActivateList" :key="subIndex+50000" class="viittoActive" :style="{left:(item[0]-5)+'px',top:(item[1]-5)+'px'}"></div>
</div> </div>
</template> </template>
<script> <script>
...@@ -17,21 +15,10 @@ export default { ...@@ -17,21 +15,10 @@ export default {
return { return {
chart: null, chart: null,
position: [-999999, -999999], position: [-999999, -999999],
points:[],
//活动人数
ActivateList:[],
myChart:{}, myChart:{},
isShow:false,
isShow2:false,
}; };
}, },
mounted() { mounted() {
this.bus.$on('addpoint',addTradeInfo=>{
this.addPoint(addTradeInfo)
})
this.bus.$on('addActivePoint',addTradeInfo=>{
this.ActivePoint(addTradeInfo)
})
this.chinaConfigure(); this.chinaConfigure();
}, },
beforeDestroy() { beforeDestroy() {
...@@ -130,63 +117,6 @@ export default { ...@@ -130,63 +117,6 @@ export default {
] ]
}); });
}, },
addPoint(param){
let ad=param.address?param.address:param.city
var myGeo = new BMap.Geocoder();
var that=this
myGeo.getPoint(ad, function(point){
if (point) {
var geo = that.myChart.getModel().getComponent('geo').coordinateSystem;
let coord = that.myChart.convertToPixel("geo", [point.lng, point.lat]);
that.points.push(coord);
if(that.points.length>100){
that.points.splice(0,1)
}
}
})
setTimeout(()=>{
that.isShow=true;
}, 6000);
},
//获取活跃人数
ActivePoint(param){
let ad=param.address?param.address:param.city
var myGeo = new BMap.Geocoder();
var that=this
myGeo.getPoint(ad, function(point){
if (point) {
var geo = that.myChart.getModel().getComponent('geo').coordinateSystem;
let coord = that.myChart.convertToPixel("geo", [point.lng, point.lat]);
that.ActivateList.push(coord);
if(that.ActivateList.length>100){
that.ActivateList.splice(0,1)
}
}
})
setTimeout(()=>{
that.isShow2=true;
}, 6000);
}
} }
}; };
</script> </script>
<style> \ No newline at end of file
.viittoHot {
position: absolute;
z-index: 5;
color: #fff;
width: 5px;
height: 5px;
background: #2a73fe;
border-radius: 100%;
}
.viittoActive{
position: absolute;
z-index: 5;
color: #fff;
width: 5px;
height: 5px;
background: #FF75A1;
border-radius: 100%;
}
</style>
...@@ -492,7 +492,7 @@ export default { ...@@ -492,7 +492,7 @@ export default {
//切换统计看板 //切换统计看板
exChangeBoard(){ exChangeBoard(){
window.location="http://data.oytour.com/#/viittoData2" window.location="http://data.oytour.com/#/viittoData2"
//window.location="http://192.168.0.112:8080/#/viittoData2"; //window.location="http://192.168.0.111:8080/#/viittoData2";
window.location.reload(); window.location.reload();
} }
} }
......
...@@ -339,7 +339,7 @@ ...@@ -339,7 +339,7 @@
</div> </div>
</template> </template>
<script> <script>
import centerMp from "../sellDashboard/map/viittoMap"; import centerMp from "../sellDashboard/map/viittoMap2";
export default { export default {
components: { components: {
centerMp centerMp
...@@ -351,7 +351,12 @@ export default { ...@@ -351,7 +351,12 @@ export default {
//活跃用户的名称 //活跃用户的名称
ActiveDataName:[], ActiveDataName:[],
//活跃用户的数据 //活跃用户的数据
ActiveData:[] ActiveData:[],
//传递子组件活跃用户
ActiveArr:[],
//传递不活跃用户
InActiveArr:[]
}; };
}, },
mounted() { mounted() {
...@@ -511,7 +516,7 @@ export default { ...@@ -511,7 +516,7 @@ export default {
//切换统计看板 //切换统计看板
exChangeBoard(){ exChangeBoard(){
window.location="http://data.oytour.com/#/viittoData" window.location="http://data.oytour.com/#/viittoData"
//window.location="http://192.168.0.112:8080/#/viittoData" //window.location="http://192.168.0.111:8080/#/viittoData"
window.location.reload(); window.location.reload();
}, },
//获取地址、 //获取地址、
...@@ -520,42 +525,32 @@ export default { ...@@ -520,42 +525,32 @@ export default {
//不经常活动的地址 //不经常活动的地址
let InActiveList = res.data.data.InActiveList; let InActiveList = res.data.data.InActiveList;
let ActivateList = res.data.data.ActivateList; let ActivateList = res.data.data.ActivateList;
var result = []; this.InActiveArr = [];
var obj = {}; var obj = {};
for(var i =0; i<InActiveList.length; i++){ for(var i =0; i<InActiveList.length; i++){
if(!obj[InActiveList[i].District]){ if(!obj[InActiveList[i].Address]&&InActiveList[i].District!=InActiveList[i].City){
result.push(InActiveList[i]); this.InActiveArr.push(InActiveList[i]);
obj[InActiveList[i].District] = true; obj[InActiveList[i].Address] = true;
} }
} }
//活动的 //活动的
var resultActive = []; this.ActiveArr = [];
var obj2 = {}; var obj2 = {};
for(var i =0; i<ActivateList.length; i++){ for(var i =0; i<ActivateList.length; i++){
if(!obj2[ActivateList[i].District]){ if(!obj2[ActivateList[i].Address]&&ActivateList[i].District!=ActivateList[i].City){
resultActive.push(ActivateList[i]); this.ActiveArr.push(ActivateList[i]);
obj2[ActivateList[i].District] = true; obj2[ActivateList[i].Address] = true;
} }
} }
if(res.data.resultCode==1){ if(res.data.resultCode==1){
result.forEach(x=>{ var newArr = [this.InActiveArr,this.ActiveArr];
this.bus.$emit("addpoint",{ //调用生成
city:x.City, this.bus.$emit("addpoint",newArr);
address:x.District
});
})
resultActive.forEach(x=>{
this.bus.$emit("addActivePoint",{
city:x.City,
address:x.District
});
})
}else{ }else{
this.Error(res.data.message); this.Error(res.data.message);
} }
},err => {}); },err => {});
} },
} }
}; };
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment