From fecbdf7e3c8e53fd79bb84036f5b9ccea99e62f7 Mon Sep 17 00:00:00 2001 From: A1300399510 Date: Wed, 26 Apr 2023 17:17:29 +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 | 64 +++++++++++++++++++++----------- pages/askHousing/askHousing.wxml | 3 +- 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/pages/askHousing/askHousing.js b/pages/askHousing/askHousing.js index 537b15b..e11ca33 100644 --- a/pages/askHousing/askHousing.js +++ b/pages/askHousing/askHousing.js @@ -835,7 +835,7 @@ Page({ // 初始化弹出的窗口 firstStepPopover() { - return + let field = 'type' let step = 0 let it = 'basic' @@ -845,16 +845,22 @@ Page({ let popUpIs = "" let popUpStepState = "" - this.data.aa.forEach(element => { - if (this.data.fieldinfo['status'][0].title == element.name) { - popUpIs = element.popUpIs - popUpStepState = element.popUpStepState - } - }); + let popUpdate = { + ...this.data.fieldinfoNew[field] + } + popUpIs = popUpdate.popUpIs + popUpStepState = popUpdate.popUpStepState + // this.data.aa.forEach(element => { + // if (this.data.fieldinfo['status'][0].title == element.name) { + // popUpIs = element.popUpIs + // popUpStepState = element.popUpStepState + // } + // }); + this.setData({ step, popUpIs, - popUpdate: this.data.fieldinfoNew[field], + popUpdate, popUpit: it, popUpStepState }) @@ -1515,8 +1521,9 @@ Page({ bindChange: function (e) { const val = e.detail.value[0] - console.log(e, "sdfd"); + // console.log(e, "sdfd"); let popUpdate = this.data.popUpdate + console.log("popUpdate.choices[val].value", popUpdate.choices[val].value, val); this.setData({ leaseTimeValue: val, ['newinfo.rentalduration']: popUpdate.choices[val].value @@ -1690,6 +1697,7 @@ Page({ this.data.newinfo[field] = [0] this.data.fieldinfoNew[field]['value'] = [0] } else this.data.fieldinfoNew[field]['value'] = this.data.newinfo[field] + this.setData({ step, popUpIs, @@ -1748,7 +1756,6 @@ Page({ popUpStepState, }) - console.log("popUpTitle", this.data.popUpTitle); return } else { @@ -1791,7 +1798,9 @@ Page({ let fieldinfoNew = this.data.fieldinfoNew // let popUpdate = { ...fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field] } - let popUpdate = { ...fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field] } + let popUpdate = { + ...fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field] + } let field = popUpdate.field if (field == 'video') { if (this.data.videos.length > 0) { @@ -1813,10 +1822,19 @@ Page({ if (popUpIs == 'unilineInput' || popUpIs == 'multilineInput' || popUpIs == 'multilineInput1') { this.data.focustitle = popUpdate.field } + + if (popUpdate.field == "sunshinearea" && this.data.newinfo['sunshinearea'].length == 0 ) { + this.data.newinfo['sunshinearea'] = [0] + popUpdate.value = [0] + } + + this.setData({ popUpdate, focustitle: this.data.focustitle }) + + console.log("0popUpdate", popUpdate); } if (popUpIs == 'nearSchool') { @@ -1834,6 +1852,7 @@ Page({ this.data.newinfo.leasetime = calculateOfDateList.year + '-' + calculateOfDateList.month + '-' + new Date().getDate() } + this.setData({ popUpSubtitle, popUpTitle, @@ -1862,7 +1881,6 @@ Page({ if (popUpdate.field == "location" && targetValue.length > 6) return - targetValue.sort() if (targetValue.length == 0) targetValue = [0] @@ -2118,6 +2136,12 @@ Page({ this.data.focustitle = popUpdate.field } + + if ((field == "floor" || field == "property" || field == 'sunshinearea') && this.data.newinfo[field].length == 0) { + this.data.newinfo[field] = [0] + popUpdate['value'] = [0] + } else popUpdate['value'] = this.data.newinfo[field] + this.setData({ popUpdate, popUpIs: popUpdate.popUpIs, @@ -2247,13 +2271,11 @@ Page({ newinfo.school = this.data.nearSchoolList - if (newinfo.rentalduration == '不限租期') { - newinfo.rentalduration = 0 - } + if (newinfo.rentalduration == '不限租期') newinfo.rentalduration = 0 + + + if (newinfo.leasetime == '随时') newinfo.leasetime = 0 - if (newinfo.leasetime == '随时') { - newinfo.leasetime = 0 - } for (const key in fieldinfo) { fieldinfo[key].forEach(element => { @@ -2263,10 +2285,10 @@ Page({ console.log("this.data.fieldinfoNew", this.data.fieldinfoNew); let fieldinfoNew = this.data.fieldinfoNew fieldinfoNew[element.field].choices.forEach(el => { - el.choices.forEach(e => { - if (newinfo.type && newinfo.type.indexOf(e.value) >= 0) newinfo.type = e.key + // el.choices.forEach(e => { + if (newinfo.type && newinfo.type.indexOf(el.value) >= 0) newinfo.type = el.key - }) + // }) }) } diff --git a/pages/askHousing/askHousing.wxml b/pages/askHousing/askHousing.wxml index 888b55d..8c808d8 100644 --- a/pages/askHousing/askHousing.wxml +++ b/pages/askHousing/askHousing.wxml @@ -437,13 +437,12 @@ - {{ item.title || popUpTitle }} {{popUpSubtitle}} - + {{item.value}}