diff --git a/pages/index/index.js b/pages/index/index.js index dbf53e0..742a004 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -238,7 +238,6 @@ Page({ // 新 轮播图 点击事件 handleSwiper(e) { - console.log(e); let { appid, url, @@ -500,6 +499,7 @@ Page({ // 判断在哪边的 whichSide(res, targetData) { + console.log("leftHeight", this.leftHeight, "rightHeight", this.rightHeight); if (this.leftHeight <= this.rightHeight) { this.leftHeight = this.leftHeight + res this.data.listDataLeft.push(targetData) diff --git a/pages/index/index.json b/pages/index/index.json index cd8242a..2d70f2c 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -10,6 +10,7 @@ "card-person": "./cardPerson/cardPerson", "card-brands": "./cardBrands/cardBrands", "fix-footer": "../../template/fixFooter/fixFooter", - "announcement-popup": "../../template/announcementPopup/announcementPopup" + "announcement-popup": "../../template/announcementPopup/announcementPopup", + "to-top": "/template/toTop/toTop" } } \ No newline at end of file diff --git a/pages/personList/personList.js b/pages/personList/personList.js index e29e6ed..eaa1828 100644 --- a/pages/personList/personList.js +++ b/pages/personList/personList.js @@ -373,7 +373,7 @@ Page({ } } } - + if (ishere) { searchindex = i; this.setData({ @@ -400,6 +400,7 @@ Page({ location: that.data.location.value, school: that.data.school.value, page: this.data.page, + intermediarytype: 2, }) var that = this; @@ -432,13 +433,11 @@ Page({ // 清空数组 clear_data: function () { - this.setData({ page: 1, lists: [] }) this.get_list() - }, setSelectData(title) { @@ -709,7 +708,6 @@ Page({ }, // 提交出租方式 submittype(e) { - this.data.types.value = e.detail.data; this.setData({ types: this.data.types, @@ -719,7 +717,6 @@ Page({ }, // 提交排序 submitOrderby(e) { - this.data.orderby.value = e.detail.value; this.setData({ orderby: this.data.orderby @@ -769,5 +766,4 @@ Page({ miucms.closeAD(e.detail.id) }, - }) \ No newline at end of file diff --git a/pages/quarantineLists/quarantineLists.js b/pages/quarantineLists/quarantineLists.js index 4812422..1f831b1 100644 --- a/pages/quarantineLists/quarantineLists.js +++ b/pages/quarantineLists/quarantineLists.js @@ -30,6 +30,57 @@ Page({ }, listTab: {}, topTitle: "", + groupSearch: [], //组合最热 + location: { + value: [], + data: null + }, + types: { + value: '', + data: null + }, //6.24删除 + money: { + rent_min: 0, + rent_max: '' + }, + moreCondition: { + show: false, + data: { + gender: "0", + leaseterm: "0", + publish: "twomonth", + } + }, + + school: { + list: {}, + value: '' + }, + + orderby: { + value: 'timestamp', + list: [{ + name: "最新发布", + value: 'timestamp' + }, + { + name: "热门", + value: 'hotnum' + }, + { + name: "价格从低到高", + value: 'rentasc' + }, + { + name: "价格从高到低", + value: 'rentdesc' + }, + ] + }, + + selectGroupIndex: null, + + }, /** @@ -119,7 +170,8 @@ Page({ }) this.get_content(); this.getList(); - + this.getgroupSearch(); + this.getLocationList(); } else { setTimeout(function () { @@ -127,23 +179,104 @@ Page({ }, 200) } }, + + getgroupSearch() { + var that = this; + miucms.request(app.globalData.config.lists.groupsearch, {}).then(data => { + this.setData({ + groupSearch: data.data + }, function () { + that.caclulatesearchIndex() + }) + wx.hideLoading() + + }).catch(res => {}) + }, + + // 是否选中关键词 + caclulatesearchIndex() { + let groupSearch = this.data.groupSearch; + console.log("groupSearch", groupSearch); + let that = this; + let searchindex = null; + + for (let i = 0; i < groupSearch.length; i++) { + let ishere = true; + + for (let j in groupSearch[i].where) { + let moreCondition = ['gender', 'leaseterm', 'publish']; + let money = ['rent_min', 'rent_max']; + if (moreCondition.indexOf(j) > -1) { + + if (j != 'publish') { + if (groupSearch[i].where[j] * 1 != that.data.moreCondition.data[j] * 1) { + ishere = false; + break; + } + } else { + if (groupSearch[i].where[j] != that.data.moreCondition.data[j]) { + ishere = false; + break; + } + } + + } else if (money.indexOf(j) > -1) { + if (groupSearch[i].where[j] != that.data.money[j]) { + ishere = false; + break; + } + } else if (j == 'location') { + if (groupSearch[i].where[j].sort().toString() != that.data[j].value.sort().toString()) { + ishere = false; + break; + } + } else if (j == 'type') { + if (groupSearch[i].where[j] != that.data['types'].value) { + ishere = false; + break; + } + } else { + console.log(groupSearch[i].where[j], "j", j); + if (groupSearch[i].where[j] != that.data[j].value) { + ishere = false; + break; + } + } + } + + if (ishere) { + searchindex = i; + this.setData({ + selectGroupIndex: searchindex + }) + break; + } + } + }, + getList: function () { let that = this; - if (this.data.page.next_page === 0) { - return false - } - if (this.data.loading) { - return false - } + + if (this.data.loading || this.data.page.next_page === 0) return false + this.setData({ loading: true }) - // miucms.request(app.globalData.config.studentapartment.quarantineLists, { - miucms.request(app.globalData.baseURL + '/tenement/housingresources/lists', { + this.caclulatesearchIndex() + var sendData = Object.assign({}, this.data.options, this.data.moreCondition.data, this.data.money, { + session: wx.getStorageSync('session'), + orderby: this.data.orderby.value, + 'type': this.data.types.value, + location: that.data.location.value, + school: that.data.school.value, + // page: this.data.page, page: this.data.page.next_page, - intermediarytype: 1 - }).then(data => { + intermediarytype: 1, + }) + + // miucms.request(app.globalData.config.studentapartment.quarantineLists, { + miucms.request(app.globalData.baseURL + '/tenement/housingresources/lists', sendData).then(data => { if (data.extraparam) { wx.showModal({ title: '提示', @@ -202,4 +335,136 @@ Page({ }) }, + + // 提交更多 + myEventSelectSubmit(e) { + this.setData({ + moreCondition: { + show: false, + data: e.detail + }, + selectGroupIndex: null + }) + this.hasMoreCondition() + this.clear_data() + }, + + // 判断‘更多’是否加粗 + hasMoreCondition() { + let hascondition = false; + for (let i in this.data.moreCondition.data) { + // 存在一个就加粗 + if (this.data.moreCondition.data[i] != 0) hascondition = true; + } + this.setData({ + hascondition, + }) + }, + + // 租金条件筛选提交 + submitMoney(e) { + this.data.money = Object.assign({}, e.detail); + this.setData({ + selectGroupIndex: null, + money: this.data.money + }) + this.clear_data() + }, + + // 提交排序 + submitOrderby(e) { + this.data.orderby.value = e.detail.value; + this.setData({ + orderby: this.data.orderby + }) + this.clear_data() + }, + + // 选择热词 + selectGroup(e) { + let index = e.currentTarget.dataset.index; + let obj = this.data.groupSearch[index].where; + + this.data.school.value = obj.school || ''; //学校 + this.data.location.value = Array.isArray(obj.location) ? [...obj.location] : []; //区域 + this.data.types.value = obj['type']; //出租方式 + this.data.money.rent_min = obj.rent_min; + this.data.money.rent_max = obj.rent_max; //租金 + this.data.orderby.value = obj.orderby; //排序 + this.data.moreCondition.data = { + gender: obj.gender, + leaseterm: obj.leaseterm, + publish: obj.publish, + + } + this.setData({ + selectGroupIndex: index, + school: this.data.school, + location: this.data.location, + types: this.data.types, + money: this.data.money, + orderby: this.data.orderby, + moreCondition: this.data.moreCondition + }) + this.hasMoreCondition() + this.clear_data() + }, + + // 清空数组 + clear_data: function () { + this.setData({ + page: { + next_page: 1 + }, + data: [] + }) + this.getList() + }, + + // 获取地域列表 + getLocationList() { + let that = this; + + miucms.request(app.globalData.config.lists.region, {}).then(data => { + this.data.location.data = data.data.location; + this.data.types.data = data.data['type']; + this.data.school.list = data.data.school + that.setData({ + location: that.data.location, + types: that.data.types, + property: data.data.property, + school: that.data.school + }) + wx.hideLoading() + + }).catch(res => {}) + }, + + // 提交出租方式 + submittype(e) { + this.data.types.value = e.detail.data; + this.setData({ + types: this.data.types, + selectGroupIndex: null + }) + this.clear_data() + }, + + // 提交区域 + submitarea(e) { + let { + school, + location + } = e.detail; + this.data.school.value = school; + this.data.location.value = location; + this.setData({ + location: this.data.location, + school: this.data.school, + selectGroupIndex: null + }) + this.clear_data() + }, + + }) \ No newline at end of file diff --git a/pages/quarantineLists/quarantineLists.json b/pages/quarantineLists/quarantineLists.json index a5d0a18..c664b51 100644 --- a/pages/quarantineLists/quarantineLists.json +++ b/pages/quarantineLists/quarantineLists.json @@ -14,6 +14,8 @@ "ads": "../show/ads/ads", "tab": "../personList/tab/tab", "list-item": "../irentList/listItem/listItem", - "house-item": "/pages/restOfWorld/houseItem/houseItem" + "house-item": "/pages/restOfWorld/houseItem/houseItem", + "area-select": "/pages/personList/areaSelect/areaSelect" + } } \ No newline at end of file diff --git a/pages/quarantineLists/quarantineLists.wxml b/pages/quarantineLists/quarantineLists.wxml index 700713b..4319b8e 100644 --- a/pages/quarantineLists/quarantineLists.wxml +++ b/pages/quarantineLists/quarantineLists.wxml @@ -7,7 +7,48 @@ + + + + {{ item['keyword'] }} + + + + + + + + + + + + + + + + + {{ (money.rent_min || '') + '~' + (money.rent_max || '') }} + + 租金 + + + + + + + + 更多 + + + + + + + + + + @@ -17,6 +58,13 @@ + + + + - + {{ item.intermediary_text }} diff --git a/template/filtrate/filtrate.js b/template/filtrate/filtrate.js index ef40722..d8c0ea1 100644 --- a/template/filtrate/filtrate.js +++ b/template/filtrate/filtrate.js @@ -165,7 +165,6 @@ Component({ this.setData({ show:false }) - console.log('myEventDetail:', myEventDetail) this.triggerEvent('selectSubmit', myEventDetail, myEventOption) }