This commit is contained in:
A1300399510 2023-04-25 20:51:11 +08:00
parent 22d4ba3528
commit 7d1bce8174
4 changed files with 424 additions and 264 deletions

View File

@ -190,7 +190,7 @@ Page({
fieldinfo: [],
inputList: ['acreage'],
contactInformation: 'contactInformation',
popUpIs: '', // 弹窗的 is
popUpIs: '0', // 弹窗的 is 默认 0 ,只是去掉初始化时报 null 的警告
popUpdate: [], // 目标数据
popUpSubtitle: '',
popUpStepState: '', // 0是啥都没有 1 是 保存 2 是保存加下一步
@ -228,7 +228,7 @@ Page({
property: {
name: '房屋类型',
popUpIs: 'new-marquee-box',
popUpStepState: 1,
popUpStepState: 2,
it: 'basic',
field: "property"
},
@ -248,7 +248,7 @@ Page({
sunshinearea: {
name: '晾晒区',
popUpIs: 'new-marquee-box',
popUpStepState: 1,
popUpStepState: 2,
field: "sunshinearea"
},
acreage: {
@ -258,6 +258,12 @@ Page({
it: 'basic',
field: "acreage"
},
location: {
name: '目标区域',
popUpIs: 'pop-target-area',
popUpStepState: 2,
field: "location"
},
gender: {
name: '同住人性别要求',
popUpIs: 'AListOF',
@ -311,7 +317,6 @@ Page({
max: 10000, // 两个slider所能达到的最大值
min: 0, // 两个slider所能取的最小值
rate: 100, // slider的最大最小值之差和100或1000之间的比率
scale: 1, // 比例系数。页面显示值的时候需要将slider1Value(slider2Value)乘以比例系数scale
slider1Max: 10000, // slider1的最大取值
slider1Value: 0, // slider1的值
slider2Value: 10000, // slider2的值
@ -322,29 +327,34 @@ Page({
rightSliderPriceWidthX: '0%',
aboutRulesList: {}, // 关于发布的数据
locationObj: {}, // 目标区域的数据
propertyObj: {}, // 房屋类型的配置数据
floorObj: {}, // 房屋类型的配置数据
sunshineareaObj: {}, // 房屋类型的配置数据
},
// 开始滑动
changeStart: function (e) {
var idx = parseInt(e.currentTarget.dataset.idx)
let popUpdate = this.data.popUpdate
if (idx === 1) {
// dW是当前操作的slider所能占据的最大宽度百分数
var dW = (this.data.slider2Value - this.data.min) / this.data.rate
var dW = (popUpdate.slider2Value - popUpdate.min) / popUpdate.rate
this.setData({
slider1W: dW,
slider2W: 100 - dW,
slider1Max: this.data.slider2Value,
slider2Min: this.data.slider2Value,
change: false
['popUpdate.slider1W']: dW,
['popUpdate.slider2W']: 100 - dW,
['popUpdate.slider1Max']: popUpdate.slider2Value,
['popUpdate.slider2Min']: popUpdate.slider2Value,
['popUpdate.change']: false
})
} else if (idx === 2) {
var dw = (this.data.max - this.data.slider1Value) / this.data.rate
var dw = (popUpdate.max - popUpdate.slider1Value) / popUpdate.rate
this.setData({
slider2W: dw,
slider1W: 100 - dw,
slider1Max: this.data.slider1Value,
slider2Min: this.data.slider1Value,
change: false
['popUpdate.slider2W']: dw,
['popUpdate.slider1W']: 100 - dw,
['popUpdate.slider1Max']: popUpdate.slider1Value,
['popUpdate.slider2Min']: popUpdate.slider1Value,
['popUpdate.change']: false
})
}
},
@ -353,26 +363,31 @@ Page({
changing: function (e) {
var idx = parseInt(e.currentTarget.dataset.idx)
var value = e.detail.value
// let rightSliderPriceWidthX = (this.data.max - value) / 116 - 21
let rightSliderPriceWidthX = 100 - (value / this.data.max * 100)
let leftSliderPriceWidthX = value / this.data.max * 100
let popUpdate = this.data.popUpdate
console.log("popUpdate", popUpdate);
let rightSliderPriceWidthX = 100 - (value / popUpdate.max * 100)
let leftSliderPriceWidthX = value / popUpdate.max * 100
if (idx === 1) {
this.setData({
slider1Value: value,
leftSliderPriceWidthX: leftSliderPriceWidthX + '%'
['popUpdate.slider1Value']: value,
['popUpdate.leftSliderPriceWidthX']: leftSliderPriceWidthX + '%'
})
} else if (idx === 2) {
this.setData({
slider2Value: value,
rightSliderPriceWidthX: rightSliderPriceWidthX + '%'
['popUpdate.slider2Value']: value,
['popUpdate.rightSliderPriceWidthX']: rightSliderPriceWidthX + '%'
})
}
popUpdate.value = [popUpdate.slider1Value, popUpdate.slider2Value]
},
changed: function (e) {
if (this.data.slider1Value === this.data.slider2Value && this.data.slider2Value === this.data.max) {
let popUpdate = this.data.popUpdate
if (popUpdate.slider1Value === popUpdate.slider2Value && popUpdate.slider2Value === popUpdate.max) {
this.setData({
change: true
['popUpdate.change']: true
})
}
},
@ -442,7 +457,7 @@ Page({
},
get_config() {
var that = this;
var that = this;
if (app.globalData.config.lists) {
config = app.globalData.config;
that.setData({
@ -513,16 +528,35 @@ Page({
let locationhead = ""
let locationtail = ""
let aa = this.data.aa
let locationObj = {}
for (const key in data.fieldinfo) {
let choices = null
data.fieldinfo[key].forEach(element => {
if (!element) return
// fieldinfoNew[element.field] = {}
// console.log("fieldinfoNew[element.field]",aa[element.field].popUpIs);
// fieldinfoNew[element.field]['popUpIs'] = aa[element.field].popUpIs
fieldinfoNew[element.field] = {}
if (aa[element.field]) {
fieldinfoNew[element.field]['popUpIs'] = aa[element.field].popUpIs
fieldinfoNew[element.field]['popUpStepState'] = aa[element.field].popUpStepState
}
if (element.field == "rent" || element.field == "acreage") {
fieldinfoNew[element.field]['change'] = false
fieldinfoNew[element.field]['max'] = 10000
fieldinfoNew[element.field]['min'] = 0
fieldinfoNew[element.field]['rate'] = 100
fieldinfoNew[element.field]['slider1Max'] = 10000
fieldinfoNew[element.field]['slider1Value'] = 100
fieldinfoNew[element.field]['slider2Value'] = 1000
fieldinfoNew[element.field]['slider2Min'] = 0
fieldinfoNew[element.field]['slider1W'] = 100
fieldinfoNew[element.field]['slider2W'] = 0
fieldinfoNew[element.field]['leftSliderPriceWidthX'] = '0%'
fieldinfoNew[element.field]['rightSliderPriceWidthX'] = '0%'
}
fieldinfoNew[element.field]['value'] = data.info[element.field]
if (element.field == 'type') {
let choices = element.choices
let choicesnew = []
@ -539,6 +573,8 @@ Page({
value: el.value,
key: el.key,
field: newfield,
popUpIs: "AListOF",
popUpStepState: 2,
choices: []
}
} else {
@ -549,16 +585,20 @@ Page({
})
}
});
fieldinfoNew[element.field] = ({
let obj = {
choices: choicesnew,
field: element.field,
title: element.title,
type: element.type,
popupwindow: element.popupwindow,
required: element.required,
})
}
Object.assign(fieldinfoNew[element.field], obj)
return
}
if (element.field == 'rentalduration') {
if (this.data.types == 'edit' || this.data.types == 'edit1') {
element.choices.forEach((el, i) => {
@ -568,7 +608,7 @@ Page({
}
})
}
fieldinfoNew[element.field] = ({
let obj = {
choices: [{
field: element.field,
value: "不限租期",
@ -582,30 +622,48 @@ Page({
type: element.type,
popupwindow: element.popupwindow,
required: element.required,
})
}
Object.assign(fieldinfoNew[element.field], obj)
return
}
if (element.field == 'leasetime') {
fieldinfoNew[element.field] = ({
let obj = {
choices: [{
field: "leasetime",
value: "随时",
}, {
field: "leasetime",
value: "选择日期",
choices: element.choices,
// choices: element.choices,
choices: [1],
}],
field: element.field,
title: element.title,
type: element.type,
popupwindow: element.popupwindow,
required: element.required,
})
}
Object.assign(fieldinfoNew[element.field], obj)
return
}
if (element.field == 'property' || element.field == 'gender' || element.field == 'intermediary' || element.field == 'elevator' || element.field == 'sunshinearea') {
if (element.field == 'property' || element.field == "floor" || element.field == 'sunshinearea') {
let obj = {}
let choices = element.choices
obj[0] = '不限'
choices.forEach(el => {
obj[el.key] = el.value
})
this.setData({
[`${element.field}Obj`]: obj
})
}
if (element.field == 'property' || element.field == 'gender' || element.field == 'intermediary' || element.field == 'elevator' || element.field == 'sunshinearea' || element.field == 'publishergender' || element.field == 'floor') {
choices = []
if (element.choices.length >= 0) {
if (this.data.types == 'edit' || this.data.types == 'edit1') {
@ -631,7 +689,7 @@ Page({
}
}
fieldinfoNew[element.field] = ({
let obj = ({
choices: element.choices,
field: element.field,
title: element.title,
@ -639,6 +697,7 @@ Page({
popupwindow: element.popupwindow,
required: element.required,
})
Object.assign(fieldinfoNew[element.field], obj)
return
}
@ -662,43 +721,47 @@ Page({
key: el.key,
choices: []
}
locationObj[el.key] = el.value
} else {
choicesnew[Math.trunc(el.key) - 1]['choices'].push({
value: el.value,
key: el.key,
field: element.field
})
locationObj[el.key] = el.value
}
// console.log("choicesnew", choicesnew);
});
fieldinfoNew[element.field] = ({
let obj = {
choices: choicesnew,
field: element.field,
title: element.title,
type: element.type,
popupwindow: element.popupwindow,
required: element.required,
})
}
Object.assign(fieldinfoNew[element.field], obj)
return
}
fieldinfoNew[element.field] = ({
choices,
let obj = ({
// choices,
field: element.field,
title: element.title,
unit: element.unit,
unit: element.unit ? element.unit : null,
type: element.type,
placeholder: element.placeholder,
popupwindow: element.popupwindow,
required: element.required,
})
Object.assign(fieldinfoNew[element.field], obj)
});
}
console.log("fieldinfoNew", fieldinfoNew);
if (data.info.floor != null) data.info.floor = data.info.floor != 0 ? data.info.floor + '楼' : null
// if (data.info.floor != null) data.info.floor = data.info.floor != 0 ? data.info.floor + '楼' : null
if (data.type == "edit") this.data.contactInformationState = data.info.iswechattype
else data.info.iswechattype = 0
@ -748,7 +811,7 @@ Page({
pitchyear: this.data.pitchyear,
pitchmonth: this.data.pitchmonth,
pitchday: this.data.pitchday,
locationObj,
})
wx.hideLoading()
@ -1440,11 +1503,13 @@ Page({
},
bindChange: function (e) {
const val = e.detail.value
const val = e.detail.value[0]
console.log(e, "sdfd");
let popUpdate = this.data.popUpdate
this.setData({
leaseTimeValue: val,
['newinfo.rentalduration']: this.data.fieldinfoNew['rentalduration'].choices[1].choices[val].value
['newinfo.rentalduration']: popUpdate.choices[val].value
// ['newinfo.rentalduration']: this.data.fieldinfoNew['rentalduration'].choices[1].choices[val].value
})
},
@ -1574,9 +1639,8 @@ Page({
pitchday: day,
newinfo: this.data.newinfo
})
this.data.step = this.data.step - 1
let that = this
that.popUpNextStep()
// this.data.step = this.data.step - 1
this.popUpNextStep()
},
// 点击操作弹出弹窗
@ -1586,16 +1650,15 @@ Page({
step,
it
} = e.currentTarget.dataset
let popUpIs = ""
let popUpStepState = ""
let fieldinfoNew = this.data.fieldinfoNew
if (this.data.fieldinfo[it][step].popupwindow == 0) return
this.data.aa.forEach(element => {
if (this.data.fieldinfo[it][step].title == element.name) {
popUpIs = element.popUpIs
popUpStepState = element.popUpStepState
}
});
popUpIs = fieldinfoNew[field].popUpIs
popUpStepState = fieldinfoNew[field].popUpStepState
if (popUpIs == 'nearSchool') {
this.data.nearSchoolList.push({
@ -1613,18 +1676,23 @@ Page({
if (popUpIs == 'unilineInput' || popUpIs == 'multilineInput' || popUpIs == 'multilineInput1') this.data.focustitle = field
console.log("this.data.newinfo[field9]", this.data.newinfo[field]);
this.data.fieldinfoNew[field]['value'] = this.data.newinfo[field]
console.log("this.data.fieldinfoNew[field]['value']", this.data.fieldinfoNew[field]['value']);
this.setData({
step,
popUpIs,
popUpdate: this.data.fieldinfoNew[field],
popUpdate: {
...this.data.fieldinfoNew[field]
},
popUpit: it,
popUpStepState,
focustitle: this.data.focustitle
})
},
// 选择弹窗选项
// 选择弹窗选项 单选
selectOption(e) {
let {
choices,
@ -1639,28 +1707,47 @@ Page({
field = e.currentTarget.dataset.field
} else field = e
let popUpSubtitle1 = this.data.popUpSubtitle
let popUpIs = ""
let popUpTitle = ""
let popUpStepState = ""
let popUpSubtitle = ""
if (choices) {
popUpSubtitle = value
this.setData({
popUpdate: {
choices
},
})
} else {
popUpIs = this.data.popUpIs
let popUpStepState = this.data.popUpStepState
if (field == "rentalduration") {
popUpIs = "leaseTime"
popUpStepState = 2
}
if (field == "leasetime") {
popUpIs = "ofDate"
popUpStepState = 1
}
this.setData({
['popUpdate.choices']: choices,
['popUpdate.value']: value,
popUpSubtitle,
popUpIs,
// popUpIs: choices['popUpIs'],
popUpStepState,
})
console.log("popUpTitle", this.data.popUpTitle);
popUpSubtitle
return
} else {
// 选择出租方式后需要 >> 显示
if (this.data.fieldinfo[this.data.popUpit][this.data.step].field == 'type') {
let headValue = this.data.popUpdate.value
this.setData({
step: this.data.step + 1,
popUpdate: this.data.fieldinfo[this.data.popUpit][this.data.step + 1],
[`newinfo.${this.data.fieldinfo[this.data.popUpit][this.data.step].field}`]: popUpSubtitle1 + '>>' + value
popUpdate: this.data.fieldinfo[this.data.popUpit][this.data.step + 1], // 这是一步的数据了
[`newinfo.${this.data.fieldinfo[this.data.popUpit][this.data.step].field}`]: headValue + '>>' + value
})
} else if (this.data.fieldinfo[this.data.popUpit][this.data.step].field == 'leasetime' && value != '随时') {
@ -1674,50 +1761,50 @@ Page({
[`newinfo.${this.data.fieldinfo[this.data.popUpit][this.data.step].field}`]: value
})
}
}
this.data.aa.forEach(element => {
if (value == element.name) {
popUpStepState = element.popUpStepState
popUpIs = element.popUpIs
popUpTitle = this.data.fieldinfo[element.it][this.data.step].title
}
});
// this.data.aa.forEach(element => {
// if (value == element.name) {
// popUpStepState = element.popUpStepState
// popUpIs = element.popUpIs
// popUpTitle = this.data.fieldinfo[element.it][this.data.step].title
// }
// });
if (popUpIs == "") {
if (this.data.fieldinfo[this.data.popUpit].length == this.data.step && this.data.popUpOrder.indexOf(this.data.popUpit) != -1) {
this.data.popUpit = this.data.popUpOrder[this.data.popUpOrder.indexOf(this.data.popUpit) + 1]
this.data.step = 0
}
this.data.aa.forEach(element => {
if (this.data.fieldinfo[this.data.popUpit][this.data.step].title == element.name) {
let field = this.data.fieldinfo[this.data.popUpit][this.data.step].field
if (field == 'video') {
if (this.data.videos.length > 0) {
this.setData({
popUpIs: ""
})
return
}
} else if (this.data.newinfo[field] != null && this.data.newinfo[field] != "") {
this.setData({
popUpIs: ""
})
return
}
this.optionScroll(field)
popUpIs = element.popUpIs
popUpTitle = this.data.fieldinfo[this.data.popUpit][this.data.step].title
popUpStepState = element.popUpStepState
if (popUpIs == 'unilineInput' || popUpIs == 'multilineInput' || popUpIs == 'multilineInput1') {
this.data.focustitle = this.data.fieldinfo[this.data.popUpit][this.data.step].field
}
let fieldinfoNew = this.data.fieldinfoNew
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) {
this.setData({
popUpdate: this.data.fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field],
focustitle: this.data.focustitle
popUpIs: ""
})
return
}
});
} else if (this.data.newinfo[field] != null && this.data.newinfo[field] != "") {
this.setData({
popUpIs: ""
})
return
}
this.optionScroll(field)
popUpIs = popUpdate.popUpIs
popUpTitle = popUpdate.title
popUpStepState = popUpdate.popUpStepState
if (popUpIs == 'unilineInput' || popUpIs == 'multilineInput' || popUpIs == 'multilineInput1') {
this.data.focustitle = popUpdate.field
}
this.setData({
popUpdate,
focustitle: this.data.focustitle
})
}
if (popUpIs == 'nearSchool') {
@ -1743,6 +1830,40 @@ Page({
})
},
// 选择弹窗选项多选
selectMultipleOption(e) {
let {
key,
value
} = e.currentTarget.dataset
let popUpdate = this.data.popUpdate
console.log("popUpdate.value", popUpdate.value);
let targetValue = popUpdate.value ? [...popUpdate.value] : []
if (key == 0) targetValue = [0]
else {
if (targetValue.includes(0)) targetValue.splice(targetValue.indexOf(0), 1)
if (targetValue.includes(key)) targetValue.splice(targetValue.indexOf(key), 1)
else targetValue.push(key)
}
if (popUpdate.field == "location" && targetValue.length > 6) return
targetValue.sort()
if (targetValue.length == 0) targetValue = [0]
this.data.newinfo[popUpdate.field] = targetValue
this.setData({
['popUpdate.value']: targetValue,
newinfo: this.data.newinfo
})
},
// 弹出上角的关闭弹窗
closePopUp() {
let currentField = this.data.fieldinfo[this.data.popUpit][this.data.step].field
@ -1761,16 +1882,20 @@ Page({
this.data.newinfo.leasetime = ""
}
console.log("leaseTimeValue", this.data.leaseTimeValue);
let popUpdate = this.data.popUpdate
let leaseTimeValue = this.data.leaseTimeValue
if (this.data.popUpIs == 'leaseTime' && currentField == 'rentalduration') {
this.setData({
['newinfo.rentalduration']: this.data.fieldinfoNew['rentalduration'].choices[1].choices[this.data.leaseTimeValue].value
['newinfo.rentalduration']: popUpdate.choices[leaseTimeValue].value
})
}
if (currentField == 'floor') {
this.setData({
['newinfo.floor']: this.data.floorValue - 2 > 0 ? this.data.floorValue - 2 + '楼' : this.data.floorValue - 3 + '楼'
})
// this.setData({
// ['newinfo.floor']: this.data.floorValue - 2 > 0 ? this.data.floorValue - 2 + '楼' : this.data.floorValue - 3 + '楼'
// })
}
this.setData({
@ -1801,6 +1926,7 @@ Page({
// 弹窗右上角的跳过
popUpSkip(e) {
let fieldinfoNew = this.data.fieldinfoNew
let currentFieldinfo = this.data.fieldinfo[this.data.popUpit][this.data.step] // 当前步数的 fieldinfo 数据
// 在 学校弹窗 跳过时需要 验证是否有填学校名称,没有填则删除数据
if (currentFieldinfo.field == 'school') {
@ -1829,31 +1955,33 @@ Page({
return
}
this.data.aa.forEach(element => {
if (this.data.fieldinfo[this.data.popUpit][this.data.step].title == element.name) {
if (element.popUpIs == 'nearSchool') {
this.data.nearSchoolList.push({
name: '',
distance: ""
})
this.setData({
nearSchoolList: this.data.nearSchoolList
})
}
this.optionScroll(this.data.fieldinfo[this.data.popUpit][this.data.step].field)
this.setData({
popUpIs: element.popUpIs,
popUpTitle: this.data.fieldinfo[this.data.popUpit][this.data.step].title,
popUpdate: this.data.fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field],
popUpStepState: element.popUpStepState
})
}
});
let popUpdate = fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field]
// this.data.aa.forEach(element => {
// if (this.data.fieldinfo[this.data.popUpit][this.data.step].title == element.name) {
if (popUpdate.popUpIs == 'nearSchool') {
this.data.nearSchoolList.push({
name: '',
distance: ""
})
this.setData({
nearSchoolList: this.data.nearSchoolList
})
}
this.optionScroll(popUpdate.field)
this.setData({
popUpIs: popUpdate.popUpIs,
popUpTitle: popUpdate.title,
// popUpdate: this.data.fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field],
popUpdate,
popUpStepState: popUpdate.popUpStepState
})
// }
// });
},
// 下一步
popUpNextStep(e) {
let currentField = this.data.fieldinfo[this.data.popUpit][this.data.step].field
let currentField = this.data.popUpdate.field
let popUpIs = ""
// 下一步是附近学校时 判断学校名是否为空 空则删除对应学校数据
@ -1872,14 +2000,14 @@ Page({
// 出租时长
if (currentField == 'rentalduration') {
this.setData({
['newinfo.rentalduration']: this.data.fieldinfoNew['rentalduration'].choices[1].choices[this.data.leaseTimeValue].value
['newinfo.rentalduration']: this.data.popUpdate.choices[this.data.leaseTimeValue].value
// ['newinfo.rentalduration']: this.data.fieldinfoNew['rentalduration'].choices[1].choices[this.data.leaseTimeValue].value
})
}
// 楼层
if (currentField == 'floor') {
if (currentField == 'rent') {
this.setData({
['newinfo.floor']: this.data.floorValue - 2 > 0 ? this.data.floorValue - 2 + '楼' : this.data.floorValue - 3 + '楼'
['newinfo.rent']: this.data.popUpdate.value
})
}
@ -1913,12 +2041,14 @@ Page({
this.setData({
step: this.data.step + 1
})
if (this.data.fieldinfo[this.data.popUpit].length == this.data.step && this.data.popUpOrder.indexOf(this.data.popUpit) != -1) {
this.data.popUpit = this.data.popUpOrder[this.data.popUpOrder.indexOf(this.data.popUpit) + 1]
this.data.step = 0
}
// 判断下一步是否有值,有则隐藏弹窗
console.log("nextfield", nextfield, "this.data.popUpit", this.data.popUpit);
let nextfield = this.data.fieldinfo[this.data.popUpit][this.data.step].field
// 判断下一步学校是否有值原因是school值没有直接放在 nextfield 里,需要特殊处理
if (nextfield == 'school' && this.data.nearSchoolList.length != 0) {
@ -1945,46 +2075,48 @@ Page({
return
}
this.data.aa.forEach(element => {
if (this.data.fieldinfo[this.data.popUpit][this.data.step].title == element.name) {
// 附近学校没有数据时加一个默认数据
if (element.popUpIs == 'nearSchool' && this.data.nearSchoolList.length == 0) {
this.data.nearSchoolList.push({
name: '',
distance: ""
})
}
// 因为 field == 'address' 分香港和非香港地区 这个是香港地区的 地址调用地图API
if (this.data.fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field].field == 'address') {
if (this.data.fieldinfoNew.address.type == 'map') {
element.popUpIs = "AddressHongKong"
}
}
console.log(this.data.fieldinfo[this.data.popUpit][this.data.step].field);
console.log("441", this.data.popUpdate);
if (this.data.types.indexOf('edit') > -1 && this.data.fieldinfo[this.data.popUpit][this.data.step].popupwindow == 0) {
this.setData({
popUpIs: ""
})
return
}
let field = this.data.fieldinfo[this.data.popUpit][this.data.step].field
let popUpdate = {
...this.data.fieldinfoNew[field]
}
let popUpStepState = popUpdate.popUpStepState
this.optionScroll(this.data.fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field].field)
if (element.popUpIs == 'unilineInput' || element.popUpIs == 'multilineInput' || element.popUpIs == 'multilineInput1') {
this.data.focustitle = this.data.fieldinfo[this.data.popUpit][this.data.step].field
}
// return
// this.data.aa.forEach(element => {
// if (this.data.fieldinfo[this.data.popUpit][this.data.step].title == element.name) {
this.setData({
popUpdate: this.data.fieldinfoNew[this.data.fieldinfo[this.data.popUpit][this.data.step].field],
popUpIs: element.popUpIs,
popUpStepState: element.popUpStepState,
popUpTitle: this.data.fieldinfo[this.data.popUpit][this.data.step].title,
popUpSubtitle: "",
nearSchoolList: this.data.nearSchoolList,
focustitle: this.data.focustitle
})
}
});
// 因为 field == 'address' 分香港和非香港地区 这个是香港地区的 地址调用地图API
if (this.data.fieldinfoNew[popUpdate.field].field == 'address') {
if (this.data.fieldinfoNew.address.type == 'map') popUpIs = "AddressHongKong"
}
if (this.data.types.indexOf('edit') > -1 && popUpdate.popupwindow == 0) {
this.setData({
popUpIs: ""
})
return
}
this.optionScroll(this.data.fieldinfoNew[popUpdate.field].field)
if (popUpdate.popUpIs == 'unilineInput' || popUpdate.popUpIs == 'multilineInput' || popUpdate.popUpIs == 'multilineInput1') {
this.data.focustitle = popUpdate.field
}
this.setData({
popUpdate,
popUpIs: popUpdate.popUpIs,
popUpStepState: popUpdate.popUpStepState,
popUpTitle: popUpdate.title,
popUpSubtitle: "",
nearSchoolList: this.data.nearSchoolList,
focustitle: this.data.focustitle
})
// }
// });
},
// 单行输入框的输入
@ -2436,5 +2568,20 @@ Page({
return
},
// 单独处理目标区域的删除
deleteLocation(e) {
let key = e.currentTarget.dataset.key
let location = this.data.newinfo.location
let value = this.data.popUpdate.value
location.splice(location.indexOf(key), 1)
this.setData({
['newinfo.location']: location,
['popUpdate.value']: location,
})
}
})

View File

@ -1,28 +1,39 @@
<!-- 求房源 -->
<import src="../common/common.wxml" />
<wxs module="m1">
function fn(arr, arg, state) {
var result = {
indexOf: false,
toString: ''
}
for (var i = 0; i < arr.length; i++) {
if (state == 'type' || state == 'location') {
if (arr[i] && arr[i].indexOf(arg) != -1) {
result.indexOf = true
return result
}
} else {
if (arr[i] && arr[i] == arg) {
result.indexOf = true
return result
}
module.exports = {
fn: function (arr, arg, state) { // 判断是否 包含的
var result = {
indexOf: false,
toString: ''
}
result.indexOf[i] = arr.indexOf(arg) > -1;
if (state == 'location' && arr.indexOf(arg) != -1) {
result.indexOf = true
return result
}
for (var i = 0; i < arr.length; i++) {
if (state == 'type') {
if (arr[i] && arr[i].indexOf(arg) != -1) {
result.indexOf = true
return result
}
} else {
if (arr[i] && arr[i] == arg) {
result.indexOf = true
return result
}
}
result.indexOf[i] = arr.indexOf(arg) > -1;
}
return result;
},
floor: function (value) { // 数据向下取值的
return Math.floor(value)
}
return result;
}
module.exports.fn = fn;
// module.exports.fn = fn;
</wxs>
<import src="../../wxParse/wxParse.wxml" />
@ -41,7 +52,7 @@
<!-- <template is="fail-pop"></template> -->
<!-- 租金预算 -->
<!-- <template is="rent-budget" data="{{ min,max,change,slider2W,slider1Max,slider2Min,slider1Value,slider2Value,rate,scale,slider1W,slider2W,leftSliderPriceWidthX,rightSliderPriceWidthX,left }}"></template> -->
<!-- <template is="rent-budget" data="{{ min,max,change,slider1Max,slider2Min,slider1Value,slider2Value,rate,scale,slider1W,slider2W,leftSliderPriceWidthX,rightSliderPriceWidthX,left }}"></template> -->
<!-- 目标区域 -->
<!-- <template is="pop-target-area"></template> -->
@ -101,19 +112,24 @@
<!-- 基础区域 -->
<view class="edit-option-item">
<block wx:for="{{ fieldinfo.basic }}" wx:key="index">
<block wx:for="{{ fieldinfo.basic }}" wx:key="index"> {{ item.field }}
<template wx:if="{{ item.field == 'acreage' }}" is="pageInput" data="{{ item,index,it:'basic',newinfo,fieldinfo }}"></template>
<template wx:elif="{{ item.field == 'property' || item.field == 'floor' }}" is="clickInputUnderArrow" data="{{ item,index,it:'basic',newinfo }}"></template>
<template wx:else is="clickInput" data="{{ item,index,it:'basic',newinfo,fieldinfoNew,leaseTimeValue }}"></template>
<template wx:elif="{{ item.field == 'property' || item.field == 'floor' || item.field == 'sunshinearea' }}" is="clickInputUnderArrowMultiple" data="{{ item,index,it:'basic',newinfo,fieldinfo,propertyObj,floorObj,sunshineareaObj }}"></template>
<template wx:else is="clickInputUnderArrow" data="{{ item,index,it:'basic',newinfo,fieldinfo }}"></template>
<!-- <template wx:if="{{ item.field == 'property' || item.field == 'floor' }}" is="clickInputUnderArrow" data="{{ item,index,it:'basic',newinfo,fieldinfo }}"></template> -->
<!-- <template wx:else is="clickInput" data="{{ item,index,it:'basic',newinfo,fieldinfoNew,leaseTimeValue }}"></template> -->
</block>
</view>
<!-- 所在区域 -->
<view class="edit-option-item">
<block wx:for="{{ fieldinfo.address }}" wx:key="index">
<template wx:if="{{ item.field == 'location' }}" is="target-area"></template>
<!-- <template wx:if="{{ item.field == 'school' && nearSchoolList.length > 0 }}" is="nearbySchool" data="{{ item, nearSchoolList,index }}"></template>
<template wx:else is="clickInput" data="{{ item,it:'address',index,newinfo,fieldinfo,newcity}}"></template> -->
<block wx:if="{{ newinfo['location'].length == 0 }}">
<template is="clickInputUnderArrow" data="{{ item,index,it:'address',newinfo,fieldinfo }}"></template>
</block>
<block wx:else>
<template wx:if="{{ item.field == 'location' }}" data="{{ item,index,it:'address',fieldinfo, newinfo, locationObj }}" is="target-area"></template>
</block>
</block>
</view>
@ -157,7 +173,7 @@
</view>
<view class="contactInformation-wechat-input" wx:elif="{{ contactInformationState == 1 }}">
<input type="text" placeholder="{{ item.placeholder }}" data-field="{{ item.field }}" bindinput="popUpInput" value="{{newinfo[item.field]}}" bindblur="microSignalCheck" />
<input type="text" placeholder="{{ item.placeholder }}" data-field="{{ item.field }}" bindinput="popUpInput" value="{{ newinfo[item.field] }}" bindblur="microSignalCheck" />
<view class="contactInformation-close" bindtap="contactInformationwechatcut" data-state="0">
<image src="/img/plusgrey.png"></image>
</view>
@ -221,7 +237,7 @@
<!-- 弹窗应该出现那个状态在这里处理-->
<view class="pop-up-dispose">
<template is="{{ popUpIs }}" data="{{ item:popUpdate,fieldinfoNew,popUpSubtitle,leaseTimeValue,week, calculateOfDateList,calculateOfDateTime,popUpTitle,floorValue,popUpStepState,newinfo,nearSchoolList,contactInformationState,fieldinfo,imgs,videos,areaRegionIndex,newtype,newStatus,focustitle,pitchyear,pitchmonth,pitchday,focusState }}"></template>
<template is="{{ popUpIs }}" data="{{ item:popUpdate,fieldinfoNew,popUpSubtitle,leaseTimeValue,week, calculateOfDateList,calculateOfDateTime,popUpTitle,floorValue,popUpStepState,newinfo,nearSchoolList,contactInformationState,fieldinfo,imgs,videos,areaRegionIndex,newtype,newStatus,focustitle,pitchyear,pitchmonth,pitchday,focusState,locationObj }}"></template>
</view>
<!-- 触发规则1时 重复发布 -->
@ -265,6 +281,26 @@
</view>
</template>
<!-- 禁用的输入框款-箭头下 -->
<template name="clickInputUnderArrowMultiple">
<view class="clickInput-box {{'clickInput' + item.field }}">
<view class="clickInput-title">{{ item.title }}<text style="color:#C54235;margin-left: 10rpx;">*</text></view>
<view class="clickInput" bindtap="clickOption" data-field="{{ item.field }}" data-step="{{ index }}" data-it="{{ it }}"> {{ item.field }}
<block wx:if="{{ item.field == 'property' && newinfo[item.field].length != 0 }}">
<block wx:for="{{ newinfo[item.field] }}" wx:for-item="it">{{ propertyObj[it] }}{{ index != newinfo[item.field].length - 1 ? ' / ' : '' }}</block>
</block>
<block wx:elif="{{ item.field == 'floor' && newinfo[item.field].length != 0 }}">
<block wx:for="{{ newinfo[item.field] }}" wx:for-item="it">{{ floorObj[it] }}{{ index != newinfo[item.field].length - 1 ? ' / ' : '' }}</block>
</block>
<block wx:elif="{{ item.field == 'sunshinearea' && newinfo[item.field].length != 0 }}">
<block wx:for="{{ newinfo[item.field] }}" wx:for-item="it">{{ sunshineareaObj[it] }}{{ index != newinfo[item.field].length - 1 ? ' / ' : '' }}</block>
</block>
<input wx:else disabled type="{{ item.type }}" placeholder="请选择" value="{{newinfo[item.field]}}" />
<view class="clickInputBottomArrow"></view>
</view>
</view>
</template>
<!-- 当前页页面直接操作的输入框 -- 例如 面积 月租 -->
<template name="pageInput">
<view class="pageInput-box {{'clickInput' + item.field }}">
@ -323,7 +359,6 @@
<view class="AListOF pop-up" catchtouchmove="handScroll">
<view class="pop-up-box">
<view class="pop-up-top" bindtap="closePopUp">
<!-- <view class="pop-up-arrow"></view> -->
<image class="pop-up-arrow" mode="widthFix" src="/img/back.png"></image>
</view>
<view class="pop-up-title">{{ item.title || popUpTitle }}</view>
@ -411,7 +446,6 @@
<view class="leaseTime pop-up">
<view class="pop-up-box">
<view class="pop-up-top" bindtap="closePopUp">
<!-- <view class="pop-up-arrow"></view> -->
<image class="pop-up-arrow" mode="widthFix" src="/img/back.png"></image>
</view>
<view class="pop-up-title">{{ item.title || popUpTitle }}</view>
@ -678,7 +712,7 @@
<!-- <view class="pop-up-arrow"></view> -->
<image class="pop-up-arrow" mode="widthFix" src="/img/back.png"></image>
</view>
<view class="pop-up-title">选择期</view>
<view class="pop-up-title">选择租期</view>
<view class="ofDate-week">
<view class="ofDate-week-item" wx:for="{{ week }}" wx:key="index">{{ item }}</view>
@ -841,24 +875,25 @@
<view class="pop-up-top" bindtap="closePopUp">
<image class="pop-up-arrow" mode="widthFix" src="/img/back.png"></image>
</view>
<view class="pop-up-title">租金预算</view>
<view class="rent-budget-unit flexcenter">HK$/月</view>
<view class="pop-up-title">{{ item.title }}</view>
<view wx:if="{{ item.field == 'rent' }}" class="rent-budget-unit flexcenter">{{ item.unit }}/月</view>
<view wx:else class="rent-budget-unit flexcenter">{{ item.unit }}</view>
<view class='sliderHCon'>
<view class='twoSlider'>
<view class='select-construct'>
<view class="select-value flexcenter" style="left: {{ leftSliderPriceWidthX }};right: {{ rightSliderPriceWidthX }};">{{ slider1Value }} ~ {{ slider2Value }}</view>
<view class="select-value flexcenter" style="left: {{ item.leftSliderPriceWidthX }};right: {{ item.rightSliderPriceWidthX }};">{{ item.slider1Value }} ~ {{ item.slider2Value }}</view>
<view class='select-area'>
<view class='slider-container'>
<slider style='width:{{slider1W+"%"}}' class='slider-left' min='{{min}}' max='{{slider1Max}}' color='#50e3c2' activeColor='#f2f2f2' bindchanging='changing' catchtouchstart='changeStart' block-size="14" block-color="#50e3c2" bindchange='changed' data-idx='1' value="{{ slider1Value }}"></slider>
<slider wx:if='{{!change}}' style='width:{{slider2W+"%"}}' class='slider-right' min='{{slider2Min}}' max='{{max}}' color='#f2f2f2' activeColor='#50e3c2' bindchanging='changing' catchtouchstart='changeStart' block-size="14" block-color="#50e3c2" bindchange='changed' data-idx='2' value="{{ slider2Value }}"></slider>
<slider style='width:{{ item.slider1W+"%" }}' class='slider-left' min='{{ item.min }}' max='{{ item.slider1Max }}' color='#50e3c2' activeColor='#f2f2f2' bindchanging='changing' catchtouchstart='changeStart' block-size="14" block-color="#50e3c2" bindchange='changed' data-idx='1' value="{{ item.slider1Value }}"></slider>
<slider wx:if='{{ !item.change }}' style='width:{{ item.slider2W+"%" }}' class='slider-right' min='{{ item.slider2Min }}' max='{{ item.max }}' color='#f2f2f2' activeColor='#50e3c2' bindchanging='changing' catchtouchstart='changeStart' block-size="14" block-color="#50e3c2" bindchange='changed' data-idx='2' value="{{ item.slider2Value }}"></slider>
</view>
</view>
</view>
</view>
</view>
<template is="pop-up-footer" data="{{ popUpStepState:1,field:item.field,newtype,newStatus }}"></template>
<template is="pop-up-footer" data="{{ popUpStepState:item.popUpStepState ,field:item.field,newtype,newStatus }}"></template>
</view>
</view>
@ -869,14 +904,14 @@
<view class="target-area clickInput-box">
<view class="clickInput-title">目标区域<text style="color:#C54235;margin-left: 10rpx;">*</text></view>
<view class="target-area-list">
<view class="target-area-item flexacenter" wx:for="{{ 3 }}" wx:key="index">
<view class="target-area-index flexcenter">{{ index }}</view>
<view class="target-area-content">九龙 > 尖沙咀/佐敦</view>
<image class="target-area-cross" src="/img/close-c.png"></image>
<view class="target-area-item flexacenter" wx:for="{{ newinfo.location }}" wx:key="index">
<view class="target-area-index flexcenter">{{ index + 1 }}</view>
<view class="target-area-content">九龙 > {{ locationObj[item] }}</view>
<image bindtap="deleteLocation" data-key="{{ item }}" class="target-area-cross" src="/img/close-c.png"></image>
</view>
</view>
<view class="target-area-edit flexcenter">
<view class="target-area-edit flexcenter" bindtap="clickOption" data-field="{{ item.field }}" data-step="{{ index }}" data-it="{{ it }}">
<image class="target-area-edit-icon" src="/img/pen-edit.png" mode="widthFix"></image> 修改
</view>
@ -893,24 +928,23 @@
<view class="pop-up-title">目标区域</view>
<text class="last-step-text">最多可选择6个目标区域</text>
<view class="pop-area-list">
<view class="pop-area-item" wx:for="{{ 5 }}">
<view class="pop-area-name">港岛</view>
<view class="pop-area-item" wx:for="{{ item.choices }}" wx:for-item="ite">
<view class="pop-area-name">{{ ite.value }}</view>
<view class="pop-area-content flexflex">
<view class="pop-area-content-item flexcenter {{ index == 0 ? 'pitch' : '' }}" wx:for="{{ 10 }}" wx:key="index">不限</view>
<view class="pop-area-content-item flexcenter {{ m1.fn(newinfo.location,it.key,item.field).indexOf ? 'pitch' : '' }}" wx:for="{{ ite.choices }}" wx:key="index" wx:for-item="it" catchtap="selectMultipleOption" data-key="{{ it.key }}">{{ it.value }}</view>
</view>
</view>
</view>
<view class="pop-area-pitch-list flexacenter">
<view class="pop-area-pitch-item flexacenter" wx:for="{{ 2 }}" wx:key="index">
<view class="pop-area-pitch-item flexacenter" wx:for="{{ newinfo.location }}" wx:key="index">
<view class="pop-area-pitch-index flexcenter">{{ index + 1}}</view>
<view class="pop-area-pitch-content flexacenter">上环上环上环上环/中环</view>
<image class="pop-area-pitch-cross" src="/img/close-c.png"></image>
<view class="pop-area-pitch-content flexacenter">{{ locationObj[m1.floor(item)] + '>' + locationObj[item] }}</view>
<image class="pop-area-pitch-cross" catchtap="deleteLocation" data-key="{{ item }}" src="/img/close-c.png"></image>
</view>
</view>
<template is="pop-up-footer" data="{{ popUpStepState:2,field:item.field,newtype,newStatus }}"></template>
</view>
</view>
@ -924,22 +958,26 @@
<view class="pop-up-top" bindtap="closePopUp">
<image class="pop-up-arrow" mode="widthFix" src="/img/back.png"></image>
</view>
<view class="pop-up-title">服务类型</view>
<view class="pop-new-marquee-unlimited flexacenter">
<image wx:if="{{ false }}" class="pop-new-marquee-unlimited-icom" mode="widthFix" src="/img/green-circle-pitch.svg"></image>
<view class="pop-new-marquee-unlimited-icom pop-new-marquee-unlimited-unselected-icom"></view>
<view class="pop-up-title">{{ item.title }}</view>
<view class="pop-new-marquee-unlimited flexacenter" catchtap="selectMultipleOption" data-key="0">
<image wx:if="{{ item.value[0] == 0 }}" class="pop-new-marquee-unlimited-icom" mode="widthFix" src="/img/green-circle-pitch.svg"></image>
<view wx:else class="pop-new-marquee-unlimited-icom pop-new-marquee-unlimited-unselected-icom"></view>
不限
</view>
<view class="pop-new-marquee-line"></view>
<view class="pop-new-marquee-list flexflex">
<view class="pop-new-marquee-item flexacenter" wx:for="{{ 7 }}" wx:key="index">
<view class="pop-new-marquee-case"></view>唐楼
<view class="pop-new-marquee-item flexacenter" wx:for="{{ item.choices }}" wx:for-item="it" wx:key="index" catchtap="selectMultipleOption" data-value="{{ it.value }}" data-key="{{ it.key }}">
<image class="pop-new-marquee-pitch" wx:if="{{ m1.fn(item.value,it.key,item.field).indexOf }}" src="/img/green-block-pitch.svg"></image>
<view class="pop-new-marquee-case" wx:else></view>
{{ it.value }}
</view>
</view>
<template is="pop-up-footer" data="{{ popUpStepState:2 }}"></template>
<template is="pop-up-footer" data="{{ popUpStepState: item.popUpStepState }}"></template>
</view>
</view>
</template>
</template>
<template name="0"></template>

View File

@ -1,16 +1,16 @@
/* pages/edit/edit.wxss */
@import '../common//common.wxss';
@import '../common/common.wxss';
.header {
padding: 30rpx;
font-size: 30rpx;
font-size: 0;
}
.container {
padding-bottom: 170rpx;
width: 100vw;
overflow-x: hidden;
overflow-x: hidden;
background: rgba(246, 246, 246, 1);
}
@ -36,7 +36,6 @@
.header-tips {
color: #000000;
/* padding: 20px 30rpx; */
padding: 0px 30rpx;
line-height: 1.6;
border-top: 20rpx solid rgba(246, 246, 246, 1);
@ -56,7 +55,6 @@
display: flex;
align-items: center;
font-weight: 650;
}
.header-tips .name-tips image {
@ -221,7 +219,6 @@
position: fixed;
bottom: 0;
width: 750rpx;
/* height: 150rpx; */
height: 186rpx;
display: flex;
justify-content: space-between;
@ -237,17 +234,11 @@
display: flex;
justify-content: center;
align-items: center;
/* height: 90rpx; */
/* line-height: 90rpx; */
height: 96rpx;
line-height: 96rpx;
background-color: rgba(98, 177, 255, 1);
/* background-color: #333333; */
/* box-shadow: rgb(0 0 0 / 35%) 0px 0px 10rpx; */
/* border-radius: 50rpx; */
border-radius: 82.5rpx;
color: #fff;
/* font-weight: 400; */
font-weight: 650;
font-size: 36rpx;
color: #fff;
@ -282,7 +273,6 @@
.edit-box {
background-color: #fff;
/* border-radius: 60rpx 60rpx 0 0; */
}
.edit-top {
@ -491,13 +481,6 @@
width: 30rpx;
height: 30rpx;
transform: rotate(-90deg);
/* width: 20rpx; */
/* height: 20rpx; */
/* border-bottom: 7rpx solid #333333;
border-right: 7rpx solid #333333;
transform: rotate(45deg);
margin-top: -8rpx; */
}
@ -868,11 +851,9 @@
align-items: center;
justify-content: space-between;
width: 690rpx;
/* margin: 36rpx 0 66rpx; */
}
.contactInformation .contactInformation-wechat-item {
/* width: 330rpx; */
width: 690rpx;
height: 100rpx;
line-height: 100rpx;
@ -884,15 +865,6 @@
position: relative;
}
/* .contactInformation .contactInformation-wechat-item .contactInformation-recommend {
position: absolute;
top: 0;
right: 0;
margin: 0;
width: 70rpx;
height: 70rpx;
} */
.contactInformation .contactInformation-wechat-item image {
width: 28rpx;
height: 28rpx;
@ -914,7 +886,6 @@
.contactInformation .contactInformation-wechat-input {
display: flex;
border: 2rpx solid #d7d7d7;
border-radius: 20rpx;
}
@ -972,7 +943,6 @@
width: 100%;
display: flex;
justify-content: space-between;
/* padding: 0 64rpx; */
border-bottom: 2rpx dashed #d7d7d7;
line-height: 68rpx;
height: 68rpx;
@ -997,7 +967,6 @@
.ofDate .ofDate-date {
display: flex;
flex-wrap: wrap;
/* justify-content: space-between; */
margin-top: 34rpx;
padding: 0 25rpx;
}
@ -1413,7 +1382,6 @@
width: 108rpx;
height: 36rpx;
border-radius: 8rpx;
/* margin-left: calc(100% - 180rpx); */
margin-top: 60rpx;
margin-right: 69rpx;
align-self: flex-end;
@ -1583,6 +1551,7 @@ wx-slider .wx-slider-handle-wrapper {
width: 18rpx;
height: 18rpx;
margin-left: 24rpx;
padding: 6rpx;
}
.pop-target-area .last-step-text {
@ -1642,6 +1611,12 @@ wx-slider .wx-slider-handle-wrapper {
margin-right: 15rpx;
}
.pop-new-marquee-box .pop-new-marquee-list .pop-new-marquee-pitch {
width: 30rpx;
height: 30rpx;
margin-right: 15rpx;
}
.target-area {}
.target-area .target-area-list {

View File

@ -41,7 +41,7 @@
"ignoreUploadUnusedFiles": true
},
"compileType": "miniprogram",
"libVersion": "2.31.0",
"libVersion": "2.31.1",
"appid": "wx9c68fbf7886ea9c4",
"projectname": "%E5%AF%84%E6%89%98%E7%A7%9F%E6%88%BF",
"simulatorType": "wechat",