...
|
...
|
@@ -22,9 +22,9 @@ Page({ |
|
|
addressarr: [],
|
|
|
textarr: [],
|
|
|
pricearr: [],
|
|
|
selad:-1,
|
|
|
selte:-1,
|
|
|
selword:-1
|
|
|
selad: -1,
|
|
|
selte: -1,
|
|
|
selword: -1
|
|
|
},
|
|
|
|
|
|
|
...
|
...
|
@@ -34,7 +34,7 @@ Page({ |
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
console.log(options)
|
|
|
if (options.index!=undefined){
|
|
|
if (options.index != undefined) {
|
|
|
this.setData({
|
|
|
index: options.index,
|
|
|
type_id: Number(options.index) + 1
|
...
|
...
|
@@ -54,8 +54,29 @@ Page({ |
|
|
page: 1,
|
|
|
searcharr: [],
|
|
|
show: true,
|
|
|
sousuoword: true
|
|
|
sousuoword: true,
|
|
|
addressarr: [],
|
|
|
textarr: [],
|
|
|
pricearr: [],
|
|
|
})
|
|
|
this.data.address.forEach(function(value,index,array){
|
|
|
value.sel=false
|
|
|
})
|
|
|
this.data.text.forEach(function (value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
this.data.price.forEach(function (value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
this.setData({
|
|
|
address: this.data.address,
|
|
|
price: this.data.price,
|
|
|
text: this.data.text
|
|
|
})
|
|
|
console.log(this.data.address)
|
|
|
console.log(this.data.price)
|
|
|
console.log(this.data.text)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 获取关键字列表
|
...
|
...
|
@@ -89,12 +110,12 @@ Page({ |
|
|
newarr.push(obj)
|
|
|
})
|
|
|
that.setData({
|
|
|
address:that.data.address,
|
|
|
text:that.data.text,
|
|
|
price:newarr
|
|
|
address: that.data.address,
|
|
|
text: that.data.text,
|
|
|
price: newarr
|
|
|
})
|
|
|
|
|
|
console.log(that.data.address,that.data.text,that.data.price)
|
|
|
console.log(that.data.address, that.data.text, that.data.price)
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
...
|
...
|
@@ -103,19 +124,19 @@ Page({ |
|
|
|
|
|
// 搜素地名关键字
|
|
|
seladdress(e) {
|
|
|
let that=this;
|
|
|
|
|
|
let id=e.currentTarget.dataset.id;
|
|
|
let index=e.currentTarget.dataset.index;
|
|
|
that.data.address.forEach(function(value,indexk,array){
|
|
|
if(id==value.id){
|
|
|
value.sel=!value.sel;
|
|
|
if(value.sel==true){
|
|
|
let that = this;
|
|
|
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
that.data.address.forEach(function(value, indexk, array) {
|
|
|
if (id == value.id) {
|
|
|
value.sel = !value.sel;
|
|
|
if (value.sel == true) {
|
|
|
that.data.addressarr.push(value.id)
|
|
|
}else{
|
|
|
that.data.addressarr.forEach(function(value,indexl,array){
|
|
|
if(id==value){
|
|
|
that.data.addressarr.splice(indexl,1)
|
|
|
} else {
|
|
|
that.data.addressarr.forEach(function(value, indexl, array) {
|
|
|
if (id == value) {
|
|
|
that.data.addressarr.splice(indexl, 1)
|
|
|
}
|
|
|
})
|
|
|
}
|
...
|
...
|
@@ -123,23 +144,43 @@ Page({ |
|
|
})
|
|
|
|
|
|
that.setData({
|
|
|
address:that.data.address,
|
|
|
addressarr:that.data.addressarr
|
|
|
address: that.data.address,
|
|
|
addressarr: that.data.addressarr
|
|
|
})
|
|
|
|
|
|
app.globalData.addressarr = this.data.addressarr;
|
|
|
|
|
|
app.globalData.textarr = this.data.textarr;
|
|
|
app.globalData.pricearr = this.data.pricearr;
|
|
|
app.globalData.keyword = this.data.keyword;
|
|
|
app.globalData.type_id = this.data.type_id;
|
|
|
app.globalData.index = this.data.index;
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/searchsecond/searchsecond',
|
|
|
})
|
|
|
|
|
|
|
|
|
// this.setData({
|
|
|
// page: 1,
|
|
|
// searcharr: [],
|
|
|
// sousuoword: false
|
|
|
// })
|
|
|
|
|
|
// this.getsousuo();
|
|
|
},
|
|
|
|
|
|
// 搜索内容关键词
|
|
|
seltext(e){
|
|
|
seltext(e) {
|
|
|
let that = this;
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
that.data.text.forEach(function (value, indexk, array) {
|
|
|
that.data.text.forEach(function(value, indexk, array) {
|
|
|
if (id == value.id) {
|
|
|
value.sel = !value.sel;
|
|
|
if (value.sel == true) {
|
|
|
that.data.textarr.push(value.id)
|
|
|
} else {
|
|
|
that.data.textarr.forEach(function (value, indexl, array) {
|
|
|
that.data.textarr.forEach(function(value, indexl, array) {
|
|
|
if (id == value) {
|
|
|
that.data.textarr.splice(indexl, 1)
|
|
|
}
|
...
|
...
|
@@ -152,19 +193,38 @@ Page({ |
|
|
text: that.data.text,
|
|
|
textarr: that.data.textarr
|
|
|
})
|
|
|
app.globalData.addressarr = this.data.addressarr;
|
|
|
|
|
|
app.globalData.textarr = this.data.textarr;
|
|
|
app.globalData.pricearr = this.data.pricearr;
|
|
|
app.globalData.keyword = this.data.keyword;
|
|
|
app.globalData.type_id = this.data.type_id;
|
|
|
app.globalData.index = this.data.index;
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/searchsecond/searchsecond',
|
|
|
})
|
|
|
|
|
|
|
|
|
// this.setData({
|
|
|
// page: 1,
|
|
|
// searcharr: [],
|
|
|
// sousuoword: false
|
|
|
// })
|
|
|
|
|
|
// this.getsousuo();
|
|
|
|
|
|
console.log(that.data.text);
|
|
|
console.log(that.data.textarr)
|
|
|
},
|
|
|
|
|
|
// 搜索价格关键词
|
|
|
selprice(e){
|
|
|
selprice(e) {
|
|
|
let that = this;
|
|
|
console.log(that.data.price)
|
|
|
let price=e.currentTarget.dataset.price;
|
|
|
let price = e.currentTarget.dataset.price;
|
|
|
console.log(price)
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
that.data.price.forEach(function (value, indexk, array) {
|
|
|
that.data.price.forEach(function(value, indexk, array) {
|
|
|
|
|
|
if (price == value.name) {
|
|
|
console.log(value.name)
|
...
|
...
|
@@ -172,7 +232,7 @@ Page({ |
|
|
if (value.sel == true) {
|
|
|
that.data.pricearr.push(value.name)
|
|
|
} else {
|
|
|
that.data.pricearr.forEach(function (value, indexl, array) {
|
|
|
that.data.pricearr.forEach(function(value, indexl, array) {
|
|
|
if (price == value) {
|
|
|
that.data.pricearr.splice(indexl, 1)
|
|
|
}
|
...
|
...
|
@@ -185,7 +245,24 @@ Page({ |
|
|
price: that.data.price,
|
|
|
pricearr: that.data.pricearr
|
|
|
})
|
|
|
app.globalData.addressarr = this.data.addressarr;
|
|
|
|
|
|
app.globalData.textarr = this.data.textarr;
|
|
|
app.globalData.pricearr = this.data.pricearr;
|
|
|
app.globalData.keyword = this.data.keyword;
|
|
|
app.globalData.type_id = this.data.type_id;
|
|
|
app.globalData.index = this.data.index;
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/searchsecond/searchsecond',
|
|
|
})
|
|
|
|
|
|
// this.setData({
|
|
|
// page: 1,
|
|
|
// searcharr: [],
|
|
|
// sousuoword: false
|
|
|
// })
|
|
|
|
|
|
// this.getsousuo();
|
|
|
|
|
|
},
|
|
|
|
...
|
...
|
@@ -213,6 +290,17 @@ Page({ |
|
|
|
|
|
},
|
|
|
sousuo() {
|
|
|
app.globalData.addressarr = this.data.addressarr;
|
|
|
|
|
|
app.globalData.textarr = this.data.textarr;
|
|
|
app.globalData.pricearr = this.data.pricearr;
|
|
|
app.globalData.keyword = this.data.keyword;
|
|
|
app.globalData.type_id = this.data.type_id;
|
|
|
app.globalData.index = this.data.index;
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/searchsecond/searchsecond',
|
|
|
})
|
|
|
|
|
|
|
|
|
// if (this.data.keyword == '') {
|
|
|
// wx.showToast({
|
...
|
...
|
@@ -223,13 +311,13 @@ Page({ |
|
|
|
|
|
|
|
|
// }
|
|
|
this.setData({
|
|
|
page: 1,
|
|
|
searcharr: [],
|
|
|
sousuoword: false
|
|
|
})
|
|
|
// this.setData({
|
|
|
// page: 1,
|
|
|
// searcharr: [],
|
|
|
// sousuoword: false
|
|
|
// })
|
|
|
|
|
|
this.getsousuo();
|
|
|
// this.getsousuo();
|
|
|
},
|
|
|
|
|
|
|
...
|
...
|
@@ -242,9 +330,9 @@ Page({ |
|
|
let param = {
|
|
|
type_id: that.data.type_id,
|
|
|
keyword: that.data.keyword,
|
|
|
address:that.data.addressarr,
|
|
|
price:that.data.pricearr,
|
|
|
text:that.data.textarr,
|
|
|
address: that.data.addressarr,
|
|
|
price: that.data.pricearr,
|
|
|
text: that.data.textarr,
|
|
|
page: that.data.page,
|
|
|
pageNum: 10
|
|
|
}
|
...
|
...
|
@@ -326,7 +414,26 @@ Page({ |
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
|
|
|
this.data.address.forEach(function (value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
this.data.text.forEach(function (value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
this.data.price.forEach(function (value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
this.setData({
|
|
|
address: this.data.address,
|
|
|
price: this.data.price,
|
|
|
text: this.data.text,
|
|
|
keyword:'',
|
|
|
textarr:[],
|
|
|
addressarr:[],
|
|
|
pricearr:[],
|
|
|
type_id:1,
|
|
|
index:0
|
|
|
})
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -340,7 +447,10 @@ Page({ |
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
|
|
|
// wx.redirectTo({
|
|
|
// url: '/pages/search/search',
|
|
|
// })
|
|
|
// wx.navigateBack
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -354,6 +464,7 @@ Page({ |
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
if (this.data.show == false) {
|
|
|
let newpage = this.data.page;
|
|
|
newpage++;
|
|
|
this.setData({
|
...
|
...
|
@@ -361,6 +472,8 @@ Page({ |
|
|
})
|
|
|
|
|
|
this.getsousuo()
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
...
|
...
|
|