|
...
|
...
|
@@ -32,11 +32,20 @@ Page({ |
|
|
|
eventChannel:null,
|
|
|
|
onLoad: async function (options) {
|
|
|
|
//lat=34.21719&lng=108.89155&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":108.87545674591064,"latitude":34.204520114013846},"northeast":{"longitude":108.90764325408935,"latitude":34.229857981005225},"scale":15}&multiIndex=1&tags=1,2
|
|
|
|
//lat=39.65273&lng=118.15813&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":118.11012337295534,"latitude":39.61934377763755},"northeast":{"longitude":118.1262166270447,"latitude":39.63137569933196},"scale":15}&multiIndex=0¢re_pos=39.625360,118.118170&hasSuggestion=1&keywordTip=唐山站
|
|
|
|
this.options=options;
|
|
|
|
if(options.hasSuggestion){
|
|
|
|
let pos=options.centre_pos.split(',')
|
|
|
|
this.suggestion={
|
|
|
|
latitude:pos[0],
|
|
|
|
longitude:pos[1],
|
|
|
|
title:options.keyword,
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
hasSuggestion:true
|
|
|
|
hasSuggestion:true,
|
|
|
|
suggestion:this.suggestion
|
|
|
|
})
|
|
|
|
delete this.options.keyword
|
|
|
|
}
|
|
|
|
let tags=[
|
|
|
|
{id:1,name:'环境好'},
|
|
...
|
...
|
@@ -106,7 +115,9 @@ Page({ |
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
PubSub.off('searchParamList')
|
|
|
|
if(this.hasOneListPage()){
|
|
|
|
PubSub.off('searchParamList')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -122,20 +133,28 @@ Page({ |
|
|
|
onReachBottom: function () {
|
|
|
|
this.getListMore()
|
|
|
|
},
|
|
|
|
hasOneListPage(){//判断是否只有一个列表页面
|
|
|
|
let pages = getCurrentPages();
|
|
|
|
let pc=0
|
|
|
|
pages.forEach(p=>{
|
|
|
|
if(p.route=='pages/reserve/indexList'){
|
|
|
|
pc++;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if(pc==1){//只有一个列表页
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
},
|
|
|
|
hasGetSellerEnd:false,
|
|
|
|
hasCleanSuggestion:false,
|
|
|
|
async getList(){
|
|
|
|
let mapParam=this.options
|
|
|
|
this.offset=1 //page
|
|
|
|
this.size=20 //page size
|
|
|
|
if(mapParam.keywordTip){
|
|
|
|
this.setData({
|
|
|
|
keyword:mapParam.keywordTip,
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
this.setData({
|
|
|
|
keyword:mapParam.keyword||'',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
keyword:mapParam.keyword||'',
|
|
|
|
})
|
|
|
|
|
|
|
|
if(mapParam.keyword){
|
|
|
|
this.param={
|
|
...
|
...
|
@@ -161,7 +180,11 @@ Page({ |
|
|
|
this.setData({
|
|
|
|
keyword:this.suggestion.title,
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
}else if(this.hasCleanSuggestion){//清理地标使用人的位置
|
|
|
|
lat=this.location.latitude
|
|
|
|
lng=this.location.longitude
|
|
|
|
}
|
|
|
|
if(!lat || !lng){//不完整时,使用地图中心点
|
|
|
|
let map=JSON.parse(mapParam.map);
|
|
|
|
lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
|
|
|
|
lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
|
|
...
|
...
|
@@ -175,7 +198,7 @@ Page({ |
|
|
|
size:this.size,
|
|
|
|
distance:50,
|
|
|
|
};
|
|
|
|
if(this.suggestion){
|
|
|
|
if(this.suggestion || this.hasCleanSuggestion){
|
|
|
|
this.param.centre_pos=`${lat},${lng}`
|
|
|
|
}else{
|
|
|
|
if(mapParam.centre_pos){
|
|
...
|
...
|
@@ -260,13 +283,15 @@ Page({ |
|
|
|
value:[e.detail]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
PubSub.emit(
|
|
|
|
'searchParam',
|
|
|
|
{
|
|
|
|
fun:'caixiActive',
|
|
|
|
e:e,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
if(this.hasOneListPage()){
|
|
|
|
PubSub.emit(
|
|
|
|
'searchParam',
|
|
|
|
{
|
|
|
|
fun:'caixiActive',
|
|
|
|
e:e,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
bindMultiPickerChange(e){
|
|
|
|
console.log(e);
|
|
...
|
...
|
@@ -292,13 +317,15 @@ Page({ |
|
|
|
this.setData({
|
|
|
|
tags:tags,
|
|
|
|
})
|
|
|
|
PubSub.emit(
|
|
|
|
'searchParam',
|
|
|
|
{
|
|
|
|
fun:'tagsChange',
|
|
|
|
e:e,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
if(this.hasOneListPage()) {
|
|
|
|
PubSub.emit(
|
|
|
|
'searchParam',
|
|
|
|
{
|
|
|
|
fun: 'tagsChange',
|
|
|
|
e: e,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
setTimeout(()=>{this.getList();},0)
|
|
|
|
},
|
|
|
|
gotoDetail(e){
|
|
...
|
...
|
@@ -404,4 +431,15 @@ Page({ |
|
|
|
})
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
moveToLocation(){
|
|
|
|
this.suggestion=null
|
|
|
|
this.hasCleanSuggestion=true,
|
|
|
|
this.setData({
|
|
|
|
suggestion:null,
|
|
|
|
hasSuggestion:false,
|
|
|
|
keyword:'',
|
|
|
|
})
|
|
|
|
PubSub.emit('searchParam', {fun:'moveToLocation'})
|
|
|
|
setTimeout(()=>{this.getList()},0)
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|