|
@@ -12,7 +12,7 @@ Page({ |
|
@@ -12,7 +12,7 @@ Page({ |
|
12
|
map:{
|
12
|
map:{
|
|
13
|
latitude: 23.099994,
|
13
|
latitude: 23.099994,
|
|
14
|
longitude: 113.324520,
|
14
|
longitude: 113.324520,
|
|
15
|
- scale:18,
|
15
|
+ scale:4,
|
|
16
|
height:300,
|
16
|
height:300,
|
|
17
|
},
|
17
|
},
|
|
18
|
markers: [{
|
18
|
markers: [{
|
|
@@ -24,7 +24,7 @@ Page({ |
|
@@ -24,7 +24,7 @@ Page({ |
|
24
|
height: 50
|
24
|
height: 50
|
|
25
|
}],
|
25
|
}],
|
|
26
|
seller:{},
|
26
|
seller:{},
|
|
27
|
- polygons:{},
|
27
|
+ //polygons:{},
|
|
28
|
},
|
28
|
},
|
|
29
|
qqmapsdk:null,
|
29
|
qqmapsdk:null,
|
|
30
|
/**
|
30
|
/**
|
|
@@ -94,9 +94,10 @@ Page({ |
|
@@ -94,9 +94,10 @@ Page({ |
|
94
|
this.setData({
|
94
|
this.setData({
|
|
95
|
map:map,
|
95
|
map:map,
|
|
96
|
})
|
96
|
})
|
|
97
|
- //this.getMarkers();
|
|
|
|
98
|
- this.getMapPos();
|
|
|
|
99
|
- }).catch(()=>{
|
97
|
+ this.getMarkers();
|
|
|
|
98
|
+ //this.getMapPos();
|
|
|
|
99
|
+ }).catch((e)=>{
|
|
|
|
100
|
+ console.log(e);
|
|
100
|
this.selectComponent('#showModal').options({
|
101
|
this.selectComponent('#showModal').options({
|
|
101
|
header:'定位失败',
|
102
|
header:'定位失败',
|
|
102
|
body:'需要地理位置授权'
|
103
|
body:'需要地理位置授权'
|
|
@@ -145,46 +146,64 @@ Page({ |
|
@@ -145,46 +146,64 @@ Page({ |
|
145
|
getMarkers(pos){
|
146
|
getMarkers(pos){
|
|
146
|
let map=this.data.map;
|
147
|
let map=this.data.map;
|
|
147
|
let markers=[];
|
148
|
let markers=[];
|
|
148
|
- let count=50;
|
|
|
|
149
|
- let x=(pos[1].latitude-pos[0].latitude)/count;
|
|
|
|
150
|
- let y=(pos[1].longitude-pos[0].longitude)/count;
|
|
|
|
151
|
- for(var i=1;i<count;i++){
|
|
|
|
152
|
- let v=parseInt(Math.random()*10)%2==0?-1:1;
|
|
|
|
153
|
- markers.push({
|
|
|
|
154
|
- id: i,
|
|
|
|
155
|
- iconPath: "/pages/image/ding.png",
|
|
|
|
156
|
- latitude: map.latitude+(x*i*v),
|
|
|
|
157
|
- longitude: map.longitude+(y*i*v),
|
|
|
|
158
|
- width: 24,
|
|
|
|
159
|
- height: 30,
|
|
|
|
160
|
- title:'店铺名称t'+i,
|
|
|
|
161
|
- // callout:{
|
|
|
|
162
|
- // content:'店铺名称cc'+i,
|
|
|
|
163
|
- // color:'#f00',
|
|
|
|
164
|
- // fontSize:30,
|
|
|
|
165
|
- // borderRadius:5,
|
|
|
|
166
|
- // borderWidth:1,
|
|
|
|
167
|
- // borderColor:'#f00',
|
|
|
|
168
|
- // bgColor:'#fff',
|
|
|
|
169
|
- // padding:5,
|
|
|
|
170
|
- // display:'BYCLICK',//BYCLICK,ALWAYS
|
|
|
|
171
|
- // textAlign:'center',
|
|
|
|
172
|
- // },
|
|
|
|
173
|
- label:{
|
|
|
|
174
|
- content:'店铺名称lc'+i,
|
|
|
|
175
|
- color:'#353535',
|
|
|
|
176
|
- fontSize:13,
|
|
|
|
177
|
- anchorX:-50,
|
|
|
|
178
|
- anchorY:1,
|
|
|
|
179
|
- borderWidth:1,
|
|
|
|
180
|
- borderColor:'#B4B0B0',
|
|
|
|
181
|
- borderRadius:20,
|
|
|
|
182
|
- bgColor:'#fff',
|
|
|
|
183
|
- padding:5,
|
|
|
|
184
|
- textAlign:'center',
|
|
|
|
185
|
- },
|
|
|
|
186
|
- })
|
|
|
|
187
|
- }
|
149
|
+ App.Reserve.Sellers({
|
|
|
|
150
|
+ lat:map.latitude,
|
|
|
|
151
|
+ lng:map.longitude,
|
|
|
|
152
|
+ offset:0,
|
|
|
|
153
|
+ rows:100,
|
|
|
|
154
|
+ }).then(res=>{
|
|
|
|
155
|
+ if(res.ret==200){
|
|
|
|
156
|
+ res.data.forEach(seller=>{
|
|
|
|
157
|
+ markers.push({
|
|
|
|
158
|
+ id: seller.id,
|
|
|
|
159
|
+ iconPath: "/pages/image/ding.png",
|
|
|
|
160
|
+ latitude: seller.lat,
|
|
|
|
161
|
+ longitude: seller.long,
|
|
|
|
162
|
+ width: 24,
|
|
|
|
163
|
+ height: 30,
|
|
|
|
164
|
+ title:seller.seller_name,
|
|
|
|
165
|
+ label:{
|
|
|
|
166
|
+ content:seller.seller_name,
|
|
|
|
167
|
+ color:'#353535',
|
|
|
|
168
|
+ fontSize:13,
|
|
|
|
169
|
+ anchorX:-50,
|
|
|
|
170
|
+ anchorY:1,
|
|
|
|
171
|
+ borderWidth:1,
|
|
|
|
172
|
+ borderColor:'#B4B0B0',
|
|
|
|
173
|
+ borderRadius:20,
|
|
|
|
174
|
+ bgColor:'#fff',
|
|
|
|
175
|
+ padding:5,
|
|
|
|
176
|
+ textAlign:'center',
|
|
|
|
177
|
+ }
|
|
|
|
178
|
+ })
|
|
|
|
179
|
+ })
|
|
|
|
180
|
+ }else{
|
|
|
|
181
|
+ for(var i=1;i<50;i++){
|
|
|
|
182
|
+ markers.push({
|
|
|
|
183
|
+ id: i,
|
|
|
|
184
|
+ iconPath: "/pages/image/ding.png",
|
|
|
|
185
|
+ latitude: parseFloat(map.latitude) + Math.random()*(parseInt(Math.random()*10)%2==0?-1:1)/500,
|
|
|
|
186
|
+ longitude: parseFloat(map.longitude) +Math.random()*(parseInt(Math.random()*10)%2==0?-1:1)/500,
|
|
|
|
187
|
+ width: 24,
|
|
|
|
188
|
+ height: 30,
|
|
|
|
189
|
+ title:'店铺名称t'+i,
|
|
|
|
190
|
+ label:{
|
|
|
|
191
|
+ content:'店铺名称lc'+i,
|
|
|
|
192
|
+ color:'#353535',
|
|
|
|
193
|
+ fontSize:13,
|
|
|
|
194
|
+ anchorX:-50,
|
|
|
|
195
|
+ anchorY:1,
|
|
|
|
196
|
+ borderWidth:1,
|
|
|
|
197
|
+ borderColor:'#B4B0B0',
|
|
|
|
198
|
+ borderRadius:20,
|
|
|
|
199
|
+ bgColor:'#fff',
|
|
|
|
200
|
+ padding:5,
|
|
|
|
201
|
+ textAlign:'center',
|
|
|
|
202
|
+ },
|
|
|
|
203
|
+ })
|
|
|
|
204
|
+ }
|
|
|
|
205
|
+ }
|
|
|
|
206
|
+ })
|
|
188
|
this.setData({
|
207
|
this.setData({
|
|
189
|
markers:markers,
|
208
|
markers:markers,
|
|
190
|
})
|
209
|
})
|