Commit abb476aba4fd67cb4937308a6400d29f35a3cbfd

Authored by wangfan
1 parent 28e37864

reserve index

... ... @@ -12,7 +12,7 @@ Page({
map:{
latitude: 23.099994,
longitude: 113.324520,
scale:18,
scale:4,
height:300,
},
markers: [{
... ... @@ -24,7 +24,7 @@ Page({
height: 50
}],
seller:{},
polygons:{},
//polygons:{},
},
qqmapsdk:null,
/**
... ... @@ -94,9 +94,10 @@ Page({
this.setData({
map:map,
})
//this.getMarkers();
this.getMapPos();
}).catch(()=>{
this.getMarkers();
//this.getMapPos();
}).catch((e)=>{
console.log(e);
this.selectComponent('#showModal').options({
header:'定位失败',
body:'需要地理位置授权'
... ... @@ -145,46 +146,64 @@ Page({
getMarkers(pos){
let map=this.data.map;
let markers=[];
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: map.latitude+(x*i*v),
longitude: map.longitude+(y*i*v),
width: 24,
height: 30,
title:'店铺名称t'+i,
// callout:{
// content:'店铺名称cc'+i,
// color:'#f00',
// fontSize:30,
// borderRadius:5,
// borderWidth:1,
// borderColor:'#f00',
// bgColor:'#fff',
// padding:5,
// display:'BYCLICK',//BYCLICK,ALWAYS
// textAlign:'center',
// },
label:{
content:'店铺名称lc'+i,
color:'#353535',
fontSize:13,
anchorX:-50,
anchorY:1,
borderWidth:1,
borderColor:'#B4B0B0',
borderRadius:20,
bgColor:'#fff',
padding:5,
textAlign:'center',
},
})
}
App.Reserve.Sellers({
lat:map.latitude,
lng:map.longitude,
offset:0,
rows:100,
}).then(res=>{
if(res.ret==200){
res.data.forEach(seller=>{
markers.push({
id: seller.id,
iconPath: "/pages/image/ding.png",
latitude: seller.lat,
longitude: seller.long,
width: 24,
height: 30,
title:seller.seller_name,
label:{
content:seller.seller_name,
color:'#353535',
fontSize:13,
anchorX:-50,
anchorY:1,
borderWidth:1,
borderColor:'#B4B0B0',
borderRadius:20,
bgColor:'#fff',
padding:5,
textAlign:'center',
}
})
})
}else{
for(var i=1;i<50;i++){
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,
width: 24,
height: 30,
title:'店铺名称t'+i,
label:{
content:'店铺名称lc'+i,
color:'#353535',
fontSize:13,
anchorX:-50,
anchorY:1,
borderWidth:1,
borderColor:'#B4B0B0',
borderRadius:20,
bgColor:'#fff',
padding:5,
textAlign:'center',
},
})
}
}
})
this.setData({
markers:markers,
})
... ...
... ... @@ -49,6 +49,9 @@ export default {
'App.Reserve.GetReserveUser':null,
//预定列表
'App.Reserve.GetReserveList':null
'App.Reserve.GetReserveList':null,
//商家列表
'App.Reserve.Sellers':null,
}
\ No newline at end of file
... ...