|
...
|
...
|
@@ -22,18 +22,83 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
console.log(options,'pppppppppp')
|
|
|
|
if(options.frompage && options.frompage=='search'){
|
|
|
|
this.filterParams=null;
|
|
|
|
if(options.filter){
|
|
|
|
this.filterParams=JSON.parse(options.filter)
|
|
|
|
this.setData({
|
|
|
|
filterParams:this.filterParams,
|
|
|
|
})
|
|
|
|
this.filterGroupData.average=this.filterParams.active
|
|
|
|
}
|
|
|
|
if(options.city){
|
|
|
|
this.city=JSON.parse(options.city)
|
|
|
|
}
|
|
|
|
this.findSellerData=null
|
|
|
|
if(options.hows){
|
|
|
|
this.findSellerData=JSON.parse(options.hows)
|
|
|
|
let paramStr=this.findSellerData.paramStr.split(" ");
|
|
|
|
this.setData({
|
|
|
|
findSellerData:this.findSellerData,
|
|
|
|
headerHows:[
|
|
|
|
paramStr[0].substr(0,6),
|
|
|
|
paramStr[1]+' '+paramStr[2],
|
|
|
|
],
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
// this.options=options;
|
|
|
|
// let map=this.data.map;
|
|
|
|
// map.latitude = this.options.lat;
|
|
|
|
// map.longitude = this.options.lng;
|
|
|
|
// map.scale = mapScale;
|
|
|
|
// this.setData({
|
|
|
|
// map:map
|
|
|
|
// })
|
|
|
|
if(options.hasSuggestion){
|
|
|
|
let pos=options.centre_pos.split(',')
|
|
|
|
this.suggestion={
|
|
|
|
latitude:pos[0],
|
|
|
|
longitude:pos[1],
|
|
|
|
title:options.keyword,
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
hasSuggestion:true,
|
|
|
|
suggestion:this.suggestion,
|
|
|
|
keyword:this.options.keyword,
|
|
|
|
})
|
|
|
|
delete this.options.keyword
|
|
|
|
}else if(this.options.keyword){
|
|
|
|
this.setData({
|
|
|
|
keyword:options.keyword,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
PubSub.on(
|
|
|
|
'searchParamList',
|
|
|
|
data=>{
|
|
|
|
console.log('searchParamList.msg',data)
|
|
|
|
if(data.fun=='setSuggestion'){
|
|
|
|
this.setSuggestion(data.suggestion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
this.move=false;
|
|
|
|
const systeminfo=wx.getSystemInfoSync();
|
|
|
|
let ratio=750/systeminfo.windowWidth;
|
|
|
|
console.log(systeminfo)
|
|
|
|
this.setData({
|
|
|
|
height:systeminfo.windowHeight-(350/ratio)
|
|
|
|
})
|
|
|
|
this.systeminfo=systeminfo;
|
|
|
|
this.ratio=ratio;
|
|
|
|
// this.setData({
|
|
|
|
// height:systeminfo.windowHeight-(350/ratio),
|
|
|
|
// })
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady: function () {
|
|
|
|
|
|
|
|
this.selectComponent('#getpos').getPos();
|
|
|
|
},
|
|
|
|
|
|
...
|
...
|
@@ -61,7 +126,27 @@ Page({ |
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
if(this.hasOneListPage()){
|
|
|
|
PubSub.off('searchParamList')
|
|
|
|
if(this.suggestion){
|
|
|
|
PubSub.emit('searchParam',{fun:'setSuggestion',suggestion:this.suggestion})
|
|
|
|
}else if(this.hasCleanSuggestion){
|
|
|
|
PubSub.emit('searchParam', {fun:'moveToLocation'})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
hasOneListPage(){//判断是否只有一个列表页面
|
|
|
|
let pages = getCurrentPages();
|
|
|
|
let pc=0
|
|
|
|
pages.forEach(p=>{
|
|
|
|
if(p.route=='pages/reserve/map' && this.options.frompage){
|
|
|
|
pc++;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if(pc==1){//只有一个列表页
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
...
|
...
|
@@ -76,24 +161,33 @@ Page({ |
|
|
|
url: './index'
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onpos(e) {
|
|
|
|
let res = e.detail;
|
|
|
|
console.log('onpos.res', res);
|
|
|
|
let map = this.data.map;
|
|
|
|
if (!res.latitude){
|
|
|
|
map.latitude = def_latitude;
|
|
|
|
map.longitude = def_longitude;
|
|
|
|
}else{
|
|
|
|
map.latitude = res.latitude;
|
|
|
|
map.longitude = res.longitude;
|
|
|
|
}
|
|
|
|
map.scale = mapScale;
|
|
|
|
this.user.latitude = res.latitude;
|
|
|
|
this.user.longitude = res.longitude;
|
|
|
|
let sdobj = {
|
|
|
|
map: map,
|
|
|
|
}
|
|
|
|
this.setData(sdobj)
|
|
|
|
onpos(e) {
|
|
|
|
let res = e.detail;
|
|
|
|
console.log('onpos.res', res,this.options.formpage,this.options.formpage=='search');
|
|
|
|
console.log('hahahhahahhaha',this.options);
|
|
|
|
let map = this.data.map;
|
|
|
|
if (!res.latitude){
|
|
|
|
map.latitude = def_latitude;
|
|
|
|
map.longitude = def_longitude;
|
|
|
|
}else{
|
|
|
|
if(this.options.frompage){
|
|
|
|
map.latitude = this.options.lat;
|
|
|
|
map.longitude = this.options.lng;
|
|
|
|
}else{
|
|
|
|
map.latitude = res.latitude;
|
|
|
|
map.longitude = res.longitude;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
map.scale = mapScale;
|
|
|
|
this.user.latitude = res.latitude;
|
|
|
|
this.user.longitude = res.longitude;
|
|
|
|
let sdobj = {
|
|
|
|
map: map,
|
|
|
|
}
|
|
|
|
this.setData(sdobj)
|
|
|
|
|
|
|
|
},
|
|
|
|
setLoacl(e){
|
|
|
|
let pos=util.attr(e,'val').split(',');
|
|
...
|
...
|
@@ -113,6 +207,7 @@ Page({ |
|
|
|
},
|
|
|
|
moveToLocation() {
|
|
|
|
console.log('moveToLocation')
|
|
|
|
this.oldmap=null;
|
|
|
|
this.selectComponent('#getpos').getPos(true);
|
|
|
|
},
|
|
|
|
debounceTimer:null,
|
|
...
|
...
|
@@ -126,11 +221,35 @@ Page({ |
|
|
|
},wait);
|
|
|
|
},
|
|
|
|
regionChange(e){
|
|
|
|
console.log('55555',e)
|
|
|
|
if(e.type=='end'){
|
|
|
|
console.log('regionChange', e)
|
|
|
|
this.debounce(this.regionChangeDo,800)
|
|
|
|
console.log('regionChange', e);
|
|
|
|
this.debounce(this.regionChangeDo,800);
|
|
|
|
// if(this.move==false){
|
|
|
|
// this.debounce(this.regionChangeDo,800);
|
|
|
|
// this.move=true;
|
|
|
|
// }else{
|
|
|
|
// // wx.showToast({
|
|
|
|
// // title:e.causedBy
|
|
|
|
// // })
|
|
|
|
// if(e.causedBy=='drag'){
|
|
|
|
// // wx.showToast({
|
|
|
|
// // title:e.detail.causedBy
|
|
|
|
// // })
|
|
|
|
// this.sellers=[];
|
|
|
|
// this.setData({
|
|
|
|
// markers:[]
|
|
|
|
// })
|
|
|
|
// this.makeSellers();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tapregionchange(){
|
|
|
|
this.debounce(this.regionChangeDo,800);
|
|
|
|
},
|
|
|
|
mapCtx:null,
|
|
|
|
mapData: {
|
|
|
|
latitude: 0,
|
|
...
|
...
|
@@ -144,6 +263,13 @@ Page({ |
|
|
|
},
|
|
|
|
regionChangeDo(){
|
|
|
|
console.log('regionChangeDo')
|
|
|
|
// let map=this.data.map;
|
|
|
|
// map.latitude = this.options.lat;
|
|
|
|
// map.longitude = this.options.lng;
|
|
|
|
// map.scale = mapScale;
|
|
|
|
// this.setData({
|
|
|
|
// map:map
|
|
|
|
// })
|
|
|
|
if(!this.mapCtx){
|
|
|
|
this.mapCtx = wx.createMapContext('map')
|
|
|
|
}
|
|
...
|
...
|
@@ -153,18 +279,168 @@ Page({ |
|
|
|
this.mapScale = res.scale;
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
this.mapCtx.getRegion({
|
|
|
|
success: (res) => {
|
|
|
|
console.log('yyyyyyy',res);
|
|
|
|
let newmap={},distance=0;
|
|
|
|
if (res.southwest.latitude) {
|
|
|
|
this.mapData.region = res
|
|
|
|
let newragion=res;
|
|
|
|
let singlelat=(res.northeast.latitude-res.southwest.latitude)/this.systeminfo.windowHeight;
|
|
|
|
let distancelat=singlelat*(400/this.ratio);
|
|
|
|
let test=Number(distancelat.toFixed(7));
|
|
|
|
let oldlat=Number(res.southwest.latitude.toFixed(7));
|
|
|
|
let southwestlat=oldlat+test;
|
|
|
|
console.log('pua',test,oldlat,southwestlat);
|
|
|
|
newragion.southwest.latitude=southwestlat;
|
|
|
|
this.mapData.region = newragion;
|
|
|
|
console.log('uuuuuuu',newragion,southwestlat)
|
|
|
|
newmap.lat=(this.mapData.region.southwest.latitude + this.mapData.region.northeast.latitude) / 2;
|
|
|
|
newmap.lng=(this.mapData.region.southwest.longitude + this.mapData.region.northeast.longitude) / 2
|
|
|
|
if(this.oldmap){
|
|
|
|
distance=this.getdistance(newmap.lat,newmap.lng,this.oldmap.lat,this.oldmap.lng);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this.selectComponent('#filter-group').hide();
|
|
|
|
this.getSellers();
|
|
|
|
console.log('distance',distance);
|
|
|
|
if(this.options.frompage && this.options.frompage=='search'){
|
|
|
|
if(distance>=2){
|
|
|
|
this.getList();
|
|
|
|
}else{
|
|
|
|
if(!this.oldmap){
|
|
|
|
this.oldmap=newmap;
|
|
|
|
this.getList();
|
|
|
|
console.log('6666666666666')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(distance>=2){
|
|
|
|
this.getSellers();
|
|
|
|
}else{
|
|
|
|
if(!this.oldmap){
|
|
|
|
this.oldmap=newmap;
|
|
|
|
this.getSellers();
|
|
|
|
console.log('6666666666666')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
|
|
add(a,b){
|
|
|
|
console.log("a",a);
|
|
|
|
console.log("b",b);
|
|
|
|
console.log("a+b",a+Number(b.toFixed(15)));
|
|
|
|
return a+b;
|
|
|
|
},
|
|
|
|
getdistance(la1,lo1,la2,lo2) {
|
|
|
|
console.log('9999',la1,lo1,la2,lo2)
|
|
|
|
var La1 = la1 * Math.PI / 180.0;
|
|
|
|
var La2 = la2 * Math.PI / 180.0;
|
|
|
|
var La3 = La1 - La2;
|
|
|
|
var Lb3 = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0;
|
|
|
|
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2) + Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2)));
|
|
|
|
s = s * 6378.137;//地球半径
|
|
|
|
s = Math.round(s * 10000) / 10000;
|
|
|
|
return s;
|
|
|
|
// console.log("计算结果",s)
|
|
|
|
},
|
|
|
|
hasSellers:0,
|
|
|
|
sellers:[],
|
|
|
|
suggestion:null,
|
|
|
|
setSuggestion(suggestion){
|
|
|
|
console.log('tttttt')
|
|
|
|
this.suggestion=suggestion
|
|
|
|
this.hasCleanSuggestion=false
|
|
|
|
this.setData({
|
|
|
|
suggestion:suggestion,
|
|
|
|
hasSuggestion:true,
|
|
|
|
})
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
getList(){
|
|
|
|
this.setData({
|
|
|
|
hasLoading:true,
|
|
|
|
})
|
|
|
|
this.offset=1 //page
|
|
|
|
this.size=20 //page size
|
|
|
|
this.param={
|
|
|
|
offset:this.offset,
|
|
|
|
size:this.size,
|
|
|
|
code:this.city?this.city.code:'',
|
|
|
|
pid:this.city?this.city.pid:'',
|
|
|
|
keyword:this.options.keyword||'',
|
|
|
|
...this.findSellerData.paramObj,
|
|
|
|
}
|
|
|
|
console.log('this.location',this.location)
|
|
|
|
if(this.suggestion){
|
|
|
|
this.param.lat_extend=this.suggestion.latitude
|
|
|
|
this.param.lng_extend=this.suggestion.longitude
|
|
|
|
}else if(this.location){
|
|
|
|
this.param.lat_extend=this.location.latitude
|
|
|
|
this.param.lng_extend=this.location.longitude
|
|
|
|
}
|
|
|
|
this.hasFilterData=false
|
|
|
|
if(this.filterGroupData.tags){
|
|
|
|
this.param.tags = this.filterGroupData.tags;
|
|
|
|
this.hasFilterData=true
|
|
|
|
}
|
|
|
|
console.log('this.filterGroupData',this.filterGroupData)
|
|
|
|
if (this.filterGroupData.cuisine) {
|
|
|
|
this.param.cuisine = this.filterGroupData.cuisine;
|
|
|
|
this.hasFilterData=true
|
|
|
|
}
|
|
|
|
if(this.filterGroupData.average){
|
|
|
|
this.param.average = this.filterGroupData.average;
|
|
|
|
this.hasFilterData=true
|
|
|
|
}
|
|
|
|
|
|
|
|
App.Customer.GetSellerListByFoods(this.param).then(res=>{
|
|
|
|
this.setData({
|
|
|
|
rsl:[],
|
|
|
|
hasMore:res.data.length==this.size,
|
|
|
|
// sellers:this.sellerFormat(res.data),
|
|
|
|
hasLoading:false,
|
|
|
|
//hasDisabled:this.getHasDisabled(res.data.length>0,this.data.multiIndex[0]>0 || tags.length>0 || this.findSellerData)
|
|
|
|
hasFilterData:this.hasFilterData,
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
current:0
|
|
|
|
})
|
|
|
|
this.sellers=this.sellerFormat(res.data);
|
|
|
|
this.makeMarker();
|
|
|
|
this.makeSellers();
|
|
|
|
this.debounce(this.makeDefMarker,300);
|
|
|
|
// this.hasGetSellerEnd=true
|
|
|
|
// this.triggerEvent('event',{type:'getListEnd',total:res.data.length})
|
|
|
|
/*
|
|
|
|
if(res.data.length==0 && this.offset==1 && this.location){
|
|
|
|
this.GetRecommendSellerList()
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
})
|
|
|
|
},
|
|
|
|
sellerFormat(sellers){
|
|
|
|
// sellers.forEach((seller) => {
|
|
|
|
// if(seller.distance || seller.distance===0) {
|
|
|
|
// seller.distance = parseInt(seller.distance);
|
|
|
|
// if (seller.distance > 1000) {
|
|
|
|
// seller.distance = (seller.distance / 1000).toFixed(2) + 'km'
|
|
|
|
// } else {
|
|
|
|
// seller.distance += 'm';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
sellers.forEach(seller=>{
|
|
|
|
if(this.findSellerData){
|
|
|
|
seller.findSellerParamObj=this.findSellerData.paramObj
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return sellers;
|
|
|
|
},
|
|
|
|
getSellers(){
|
|
|
|
console.log('getSellers',this.mapScale,this.mapData)
|
|
|
|
this.setData({
|
|
...
|
...
|
@@ -176,15 +452,16 @@ Page({ |
|
|
|
lng: this.user.longitude == def_longitude ? '' : this.user.longitude,
|
|
|
|
offset: 0,
|
|
|
|
rows: 200,
|
|
|
|
distance: 100000,
|
|
|
|
distance: 20000,
|
|
|
|
map: JSON.stringify({...this.mapData.region, scale: 50})
|
|
|
|
}
|
|
|
|
console.log('222222',param)
|
|
|
|
if (param.lat) {
|
|
|
|
param.centre_pos = `${param.lat},${param.lng}`
|
|
|
|
} else {
|
|
|
|
let lat = (this.mapData.region.southwest.latitude + this.mapData.region.northeast.latitude) / 2
|
|
|
|
let lng = (this.mapData.region.southwest.longitude + this.mapData.region.northeast.longitude) / 2
|
|
|
|
param.centre_pos = `${lat},${lng}`
|
|
|
|
param.centre_pos = `${lat},${lng}`;
|
|
|
|
}
|
|
|
|
this.hasFilterData=false
|
|
|
|
if(this.filterGroupData.tags){
|
|
...
|
...
|
@@ -215,6 +492,9 @@ Page({ |
|
|
|
v.cateStr=v.cateStr.join('/')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
current:0
|
|
|
|
})
|
|
|
|
this.sellers=res.data.list;
|
|
|
|
this.makeMarker();
|
|
|
|
this.makeSellers();
|
|
...
|
...
|
@@ -226,8 +506,10 @@ Page({ |
|
|
|
|
|
|
|
},
|
|
|
|
makeMarker(){
|
|
|
|
console.log('699965606970970797707970')
|
|
|
|
this.mapCtx.getScale({
|
|
|
|
success: (res) => {
|
|
|
|
console.log('iiiiiiiii',res)
|
|
|
|
this.mapData.scale = res.scale;
|
|
|
|
let markers=[]
|
|
|
|
let sellersLength=this.sellers.length
|
|
...
|
...
|
@@ -235,49 +517,52 @@ Page({ |
|
|
|
if(seller.scale>this.mapData.scale) return;
|
|
|
|
let marker = {
|
|
|
|
id: seller.id,
|
|
|
|
iconPath: "http://nosqn.colorcun.com/custom/lite-online/cates/circle1x5.png" + cates_version,
|
|
|
|
// iconPath: "http://nosqn.colorcun.com/custom/lite-online/cates/circle1x5.png" + cates_version,
|
|
|
|
iconPath:'http://nosqn.colorcun.com/map-icon.png',
|
|
|
|
latitude: seller.lat,
|
|
|
|
longitude: seller.long,
|
|
|
|
width: 8,
|
|
|
|
height: 8,
|
|
|
|
width: 33,
|
|
|
|
height: 36,
|
|
|
|
//title:seller.seller_name,
|
|
|
|
zIndex: sellersLength - si,
|
|
|
|
zIndexBak: sellersLength - si,
|
|
|
|
//seller: seller,
|
|
|
|
};
|
|
|
|
// marker.callout={
|
|
|
|
// content: ' ' + seller.sellername + ' ',
|
|
|
|
// color: '#353535',
|
|
|
|
// fontSize: 12,
|
|
|
|
// borderWidth: 1,
|
|
|
|
// borderColor: '#cccccc',
|
|
|
|
// borderRadius: 50,
|
|
|
|
// bgColor: '#fefefe',
|
|
|
|
// padding: 5,
|
|
|
|
// textAlign: 'left',
|
|
|
|
// display:'BYCLICK',
|
|
|
|
// };
|
|
|
|
marker.callout={
|
|
|
|
content:seller.selleralias ? seller.selleralias : seller.sellername,
|
|
|
|
color: '#000000',
|
|
|
|
fontSize: 12,
|
|
|
|
borderWidth: 0,
|
|
|
|
// borderColor: '#cccccc',
|
|
|
|
borderRadius: 0,
|
|
|
|
bgColor: 'transparent',
|
|
|
|
padding: 0,
|
|
|
|
textAlign: 'center',
|
|
|
|
display:'ALWAYS',
|
|
|
|
anchorX:0,
|
|
|
|
anchorY:48,
|
|
|
|
};
|
|
|
|
// marker.calloutDisplay='BYCLICK';
|
|
|
|
if (seller.mode.length > 0) {
|
|
|
|
seller.mode.forEach(x => {
|
|
|
|
if (x.id == 1) {//大图标
|
|
|
|
marker.iconPath = "http://nosqn.colorcun.com/custom/lite-online/cates/其他菜品.png";
|
|
|
|
if (seller.cate.length > 0) {
|
|
|
|
marker.iconPath = seller.cate[0].icon
|
|
|
|
}
|
|
|
|
marker.iconPath = marker.iconPath.replace(/\/cates\/(.*)\.png/, function ($0, $1) {
|
|
|
|
return '/cates/' + encodeURI($1) + '.png'
|
|
|
|
})
|
|
|
|
marker.iconPath += cates_version
|
|
|
|
marker.width = 20;
|
|
|
|
marker.height = 25;
|
|
|
|
}
|
|
|
|
// if(x.id==2){//商家名
|
|
|
|
// marker.callout.display='ALWAYS';
|
|
|
|
// marker.calloutDisplay='ALWAYS';
|
|
|
|
// }
|
|
|
|
})
|
|
|
|
}
|
|
|
|
// if (seller.mode.length > 0) {
|
|
|
|
// seller.mode.forEach(x => {
|
|
|
|
// if (x.id == 1) {//大图标
|
|
|
|
// marker.iconPath = "http://nosqn.colorcun.com/custom/lite-online/cates/其他菜品.png";
|
|
|
|
// if (seller.cate.length > 0) {
|
|
|
|
// marker.iconPath = seller.cate[0].icon
|
|
|
|
// }
|
|
|
|
// marker.iconPath = marker.iconPath.replace(/\/cates\/(.*)\.png/, function ($0, $1) {
|
|
|
|
// return '/cates/' + encodeURI($1) + '.png'
|
|
|
|
// })
|
|
|
|
// marker.iconPath += cates_version
|
|
|
|
// marker.width = 25;
|
|
|
|
// marker.height = 28;
|
|
|
|
// }
|
|
|
|
// if(x.id==2){//商家名
|
|
|
|
// marker.callout.display='ALWAYS';
|
|
|
|
// marker.calloutDisplay='ALWAYS';
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
markers.push(marker)
|
|
|
|
})
|
|
|
|
markers.push({
|
|
...
|
...
|
@@ -290,10 +575,14 @@ Page({ |
|
|
|
zIndex: 9999,
|
|
|
|
zIndexBak:9999,
|
|
|
|
})
|
|
|
|
console.log('kkkkkkkkkk',markers)
|
|
|
|
this.setData({
|
|
|
|
markers:markers,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
fail:()=>{
|
|
|
|
console.log('fail')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
makeSellers(){
|
|
...
|
...
|
@@ -310,48 +599,61 @@ Page({ |
|
|
|
this.markertap({markerId:id});
|
|
|
|
},
|
|
|
|
makeDefMarker(){
|
|
|
|
console.log('mmmmmmmmm',this.data.markers,!this.activeSellerID && this.data.markers.length>0)
|
|
|
|
if(!this.activeSellerID && this.data.markers.length>0){
|
|
|
|
this.markertap({markerId:this.data.markers[0].id})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
hasScrollToIng:false,
|
|
|
|
markertap(e,scrollTo=true){
|
|
|
|
console.log(e)
|
|
|
|
if(!e.markerId || e.markerId=='local') return;
|
|
|
|
let markers=this.data.markers
|
|
|
|
this.activeSellerID = e.markerId
|
|
|
|
let bl = 1.2;
|
|
|
|
markers.forEach((m, i) => {
|
|
|
|
m.iconPath = m.iconPath.replace('/cates-active/', '/cates/')
|
|
|
|
// m.iconPath = m.iconPath.replace('/cates-active/', '/cates/');
|
|
|
|
if(m.id!='local'){
|
|
|
|
m.iconPath='http://nosqn.colorcun.com/map-icon.png';
|
|
|
|
m.width = 33;
|
|
|
|
m.height = 36;
|
|
|
|
}
|
|
|
|
|
|
|
|
m.zIndex = m.zIndexBak
|
|
|
|
if (m.width == 20 * bl) {
|
|
|
|
m.width = 20;
|
|
|
|
m.height = 25;
|
|
|
|
}
|
|
|
|
if (m.width == 12) {
|
|
|
|
m.width = 8;
|
|
|
|
m.height = 8;
|
|
|
|
}
|
|
|
|
// if (m.width == 20 * bl) {
|
|
|
|
// m.width = 20;
|
|
|
|
// m.height = 25;
|
|
|
|
// }
|
|
|
|
// if (m.width == 12) {
|
|
|
|
// m.width = 8;
|
|
|
|
// m.height = 8;
|
|
|
|
// }
|
|
|
|
if(m.callout){
|
|
|
|
m.callout.borderColor= '#cccccc';
|
|
|
|
m.callout.bgColor= '#fefefe';
|
|
|
|
m.callout.color= '#353535';
|
|
|
|
m.callout.display=m.calloutDisplay;
|
|
|
|
// m.callout.borderColor= 'rgba(0,0,0,0)';
|
|
|
|
m.callout.bgColor= 'transparent';
|
|
|
|
m.callout.color= '#000000';
|
|
|
|
m.callout.display='ALWAYS';
|
|
|
|
m.callout.anchorY=48;
|
|
|
|
}
|
|
|
|
if (m.id == e.markerId) {
|
|
|
|
m.iconPath = m.iconPath.replace('/cates/', '/cates-active/')
|
|
|
|
if (m.width == 20) {
|
|
|
|
m.width = 20 * bl;
|
|
|
|
m.height = 25 * bl;
|
|
|
|
} else {
|
|
|
|
m.width = 12;
|
|
|
|
m.height = 12;
|
|
|
|
}
|
|
|
|
m.zIndex = 9999
|
|
|
|
// m.iconPath = m.iconPath.replace('/cates/', '/cates-active/')
|
|
|
|
m.iconPath='http://nosqn.colorcun.com/map-icon-active.png'
|
|
|
|
// if (m.width == 20) {
|
|
|
|
// m.width = 20 * bl;
|
|
|
|
// m.height = 25 * bl;
|
|
|
|
// } else {
|
|
|
|
// m.width = 12;
|
|
|
|
// m.height = 12;
|
|
|
|
// }
|
|
|
|
m.width = 41;
|
|
|
|
m.height = 48;
|
|
|
|
m.zIndex = 9999;
|
|
|
|
if(m.callout){
|
|
|
|
m.callout.borderColor= '#F05522';
|
|
|
|
m.callout.bgColor= '#F05522';
|
|
|
|
m.callout.color= '#fefefe';
|
|
|
|
// m.callout.borderColor= 'rgba(0,0,0,0)';
|
|
|
|
m.callout.bgColor= 'transparent';
|
|
|
|
m.callout.color= '#000000';
|
|
|
|
m.callout.display='ALWAYS';
|
|
|
|
m.callout.anchorY=60;
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
current:i,
|
...
|
...
|
|