|
...
|
...
|
@@ -24,6 +24,7 @@ Page({ |
|
|
|
height: 50
|
|
|
|
}],
|
|
|
|
seller:{},
|
|
|
|
polygons:{},
|
|
|
|
},
|
|
|
|
qqmapsdk:null,
|
|
|
|
/**
|
|
...
|
...
|
@@ -93,7 +94,8 @@ Page({ |
|
|
|
this.setData({
|
|
|
|
map:map,
|
|
|
|
})
|
|
|
|
this.getMarkers();
|
|
|
|
//this.getMarkers();
|
|
|
|
this.getMapPos();
|
|
|
|
}).catch(()=>{
|
|
|
|
this.selectComponent('#showModal').options({
|
|
|
|
header:'定位失败',
|
|
...
|
...
|
@@ -140,15 +142,19 @@ Page({ |
|
|
|
this.selectComponent('#seller-box').show();
|
|
|
|
wx.hideTabBar();
|
|
|
|
},
|
|
|
|
getMarkers(){
|
|
|
|
getMarkers(pos){
|
|
|
|
let map=this.data.map;
|
|
|
|
let markers=[];
|
|
|
|
for(var i=1;i<50;i++){
|
|
|
|
let count=50;
|
|
|
|
let x=(pos[1].latitude-pos[0].latitude)/count;
|
|
|
|
let y=(pos[1].longitude-pos[0].longitude)/count;
|
|
|
|
for(var i=1;i<count;i++){
|
|
|
|
let v=parseInt(Math.random()*10)%2==0?-1:1;
|
|
|
|
markers.push({
|
|
|
|
id: i,
|
|
|
|
iconPath: "/pages/image/ding.png",
|
|
|
|
latitude: parseFloat(map.latitude) + Math.random()*(parseInt(Math.random()*10)%2==0?-1:1)/500,
|
|
|
|
longitude: parseFloat(map.longitude) +Math.random()*(parseInt(Math.random()*10)%2==0?-1:1)/500,
|
|
|
|
latitude: map.latitude+(x*i*v),
|
|
|
|
longitude: map.longitude+(y*i*v),
|
|
|
|
width: 24,
|
|
|
|
height: 30,
|
|
|
|
title:'店铺名称t'+i,
|
|
...
|
...
|
@@ -183,8 +189,39 @@ Page({ |
|
|
|
markers:markers,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//seller box 通知
|
|
|
|
sellerBoxEvent(e){
|
|
|
|
wx.showTabBar();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//根据中心点计算坐标范围
|
|
|
|
getMapPos(){
|
|
|
|
let map=this.data.map;
|
|
|
|
let latitude=parseFloat(map.latitude);
|
|
|
|
let longitude=parseFloat(map.longitude);
|
|
|
|
let w2=getApp().system.windowWidth/2
|
|
|
|
let h2=getApp().system.windowHeight/2
|
|
|
|
let ys=w2*map.scale/1000000;
|
|
|
|
let xs=h2*map.scale/1000000;
|
|
|
|
let polygons=[
|
|
|
|
{
|
|
|
|
points:[
|
|
|
|
{latitude: latitude-xs, longitude: longitude+ys},
|
|
|
|
|
|
|
|
|
|
|
|
{latitude: latitude+xs, longitude: longitude+ys},
|
|
|
|
{latitude: latitude-xs, longitude: longitude-ys},
|
|
|
|
|
|
|
|
{latitude: latitude+xs, longitude: longitude-ys},
|
|
|
|
|
|
|
|
],
|
|
|
|
strokeWidth:5,
|
|
|
|
strokeColor:'#00000055',
|
|
|
|
fillColor:'#00000088'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
this.setData({
|
|
|
|
polygons:polygons,
|
|
|
|
})
|
|
|
|
this.getMarkers([{latitude: latitude-xs, longitude: longitude-ys},{latitude: latitude+xs, longitude: longitude+ys}])
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|