From abd6311019f17d0869a86459809e88367444b39f Mon Sep 17 00:00:00 2001 From: A1300399510 Date: Wed, 28 Jun 2023 12:02:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/askHousing/askHousing.js | 53 ++++++++++++++++++++++++++++++-- pages/askHousing/askHousing.wxml | 8 +++-- pages/restOfWorld/restOfWorld.js | 3 +- pages/show/show.js | 6 ++-- pages/user/user.js | 3 +- 5 files changed, 63 insertions(+), 10 deletions(-) diff --git a/pages/askHousing/askHousing.js b/pages/askHousing/askHousing.js index 09341d7..d0767af 100644 --- a/pages/askHousing/askHousing.js +++ b/pages/askHousing/askHousing.js @@ -984,6 +984,14 @@ Page({ if (field == "leasetime") { popUpIs = "ofDate" popUpStepState = 1 + let today = new Date(); + let year = today.getFullYear(); + let month = String(today.getMonth() + 1).padStart(2, '0'); + let day = String(today.getDate()).padStart(2, '0'); + value = `${year}-${month}-${day}`; + this.setData({ + 'newinfo.leasetime': value + }) } this.setData({ @@ -1098,6 +1106,23 @@ Page({ else targetValue.push(key) } + + if (popUpdate.field == "location") { + console.log("key", key >>> 0); + let index = targetValue.indexOf((key >>> 0).toString()) + console.log("index", index, targetValue); + if (index != -1) targetValue.splice(index, 1); + + + // if (index !== -1) location.splice(index, 1); + + // if () { + + // } + + // targetValue + } + if (popUpdate.field == "location" && targetValue.length > 6) return targetValue.sort() @@ -1113,6 +1138,29 @@ Page({ }, + // 目标区域的的特殊不限处理 + targetAreaUnlimited(e) { + let key = e.currentTarget.dataset.key + let location = this.data.newinfo['location'] + + let index = location.indexOf(key); + // 选中的 + if (index !== -1) location.splice(index, 1); + else { // 取消 + location = location.filter(item => item && !item.startsWith(key.toString())); + location.push(key) + } + location.sort() + + if (location.length > 6) return + + this.data.newinfo['location'] = location + this.setData({ + ['popUpdate.value']: location, + newinfo: this.data.newinfo + }) + }, + // 弹出上角的关闭弹窗 closePopUp() { let currentField = this.data.fieldinfo[this.data.popUpit][this.data.step].field @@ -1263,7 +1311,8 @@ Page({ return } - if (this.data.fieldinfo[this.data.popUpit][this.data.step].field == "gender" && this.data.newinfo['type'].indexOf("合租") == -1) { + console.log("type", this.data.newinfo['type']); + if (this.data.fieldinfo[this.data.popUpit][this.data.step].field == "gender" && this.data.newinfo['type'] && this.data.newinfo['type'].indexOf("合租") == -1) { this.setData({ step: this.data.step + 1 }) @@ -1619,7 +1668,7 @@ Page({ if (field == "rent" && this.data.newinfo[field].length < 2) { this.setData({ - [`nnewinfo${field}`]: popUpdate['value'] + [`newinfo${field}`]: popUpdate['value'] }) } diff --git a/pages/askHousing/askHousing.wxml b/pages/askHousing/askHousing.wxml index f2c54e2..63edda8 100644 --- a/pages/askHousing/askHousing.wxml +++ b/pages/askHousing/askHousing.wxml @@ -640,7 +640,8 @@ {{ index + 1 }} - {{ locationObj[m1.floor(item)] }} > {{ locationObj[item] }} + {{ locationObj[m1.floor(item)] + '>' + '不限' }} + {{ locationObj[m1.floor(item)] }} > {{ locationObj[item] }} @@ -665,16 +666,17 @@ {{ ite.value }} + 不限 {{ it.value }} - {{ index + 1}} - {{ locationObj[m1.floor(item)] + '>' + locationObj[item] }} + {{ locationObj[m1.floor(item)] + '>' + '不限' }} + {{ locationObj[m1.floor(item)] + '>' + locationObj[item] }} diff --git a/pages/restOfWorld/restOfWorld.js b/pages/restOfWorld/restOfWorld.js index bd8439e..0849262 100644 --- a/pages/restOfWorld/restOfWorld.js +++ b/pages/restOfWorld/restOfWorld.js @@ -509,7 +509,7 @@ Page({ let pendingData = element['location'] || [] let locationList = [] for (const key in location) { - if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) locationList.push(`${location[Math.trunc(key)]} > ${location[key]}`) + if (pendingData.indexOf(key) != -1) locationList.push(`${location[Math.trunc(key)]} > ${ Math.trunc(key) != key ? location[key] : '不限' }`) } element['locationList'] = locationList }) @@ -520,7 +520,6 @@ Page({ list }) } - }, diff --git a/pages/show/show.js b/pages/show/show.js index a848437..9039c26 100644 --- a/pages/show/show.js +++ b/pages/show/show.js @@ -389,11 +389,13 @@ Page({ let location = langs.location // 遍历替换区域的值 所有房源 let pendingData = info['location'] || '' let locationList = [] + console.log("location", pendingData); for (const key in location) { - if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) { + // if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) { + if (pendingData.indexOf(key) != -1) { locationList.push({ head: location[Math.trunc(key)], - end: location[key], + end: Math.trunc(key) != key ? location[key] : '不限', }) } } diff --git a/pages/user/user.js b/pages/user/user.js index 45a15d0..f4d87ea 100644 --- a/pages/user/user.js +++ b/pages/user/user.js @@ -968,7 +968,8 @@ Page({ if (Array.isArray(pendingData)) { let locationList = [] for (const key in location) { - if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) locationList.push(`${location[Math.trunc(key)]} > ${location[key]}`) + // if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) locationList.push(`${location[Math.trunc(key)]} > ${location[key]}`) + if (pendingData.indexOf(key) != -1) locationList.push(`${location[Math.trunc(key)]} > ${ Math.trunc(key) != key ? location[key] : '不限' }`) } ele['locationList'] = locationList } else if (location[pendingData]) ele['location'] = `${location[Math.trunc(pendingData)]} > ${location[pendingData]}`