跳转数据重构

This commit is contained in:
luJianJun 2023-07-27 18:18:33 +08:00
parent 2580116fc3
commit 9fab9f298f
2 changed files with 46 additions and 29 deletions

View File

@ -468,7 +468,7 @@ let listSortCheck = (item) => {
//
let hireTypeArr = shallowReactive([{ hireType: [], title: '不限' }, { title: '合租', hireType: [] }, { hireType: [], title: '整租' }])
let hireTypeArr = shallowReactive([{ hireType: [], title: '不限' }, { title: '合租',id:1, hireType: [] }, { hireType: [],id:2, title: '整租' }])
//
let setHireTypeArr = (type, id) => {
@ -577,14 +577,20 @@ let cleanSelect = () => {
// setCheckData([])
}
//
let getAddressListId=(id)=>{
list.map(res=>{
if(res.id==id){
//
let getAddressListId=(id,type)=>{
let data=null
let checkList= type==='location'?list:type==='types'?hireTypeArr:type==='school'?school:''
let dataId= type==='location'?id:type==='types'?id.substring(0,1):''
checkList.map(res=>{
console.log(res,id)
if(res.id==dataId){
console.log(res)
return res
data= res
}
})
console.log(data)
return data
}
//
@ -596,26 +602,28 @@ let deconstructionData=(data={})=>{
key.map((res,index)=>{
if(index===0){//
seachData['type']=res
seachData['selectData']=data[res]
seachData['selectData']=seachData['type']==='location'?data[res].split(','):getAddressListId(data[res],'types')
}
if(index===1){//
let address=getAddressListId(data[res])
console.log(address)
seachData['areaItem']={id:'',name:'',data:''}
if(index===1){//
if(seachData['type']!=='location') return
let address=getAddressListId(data[res],'location')
seachData['areaItem']={}
seachData['areaItem'].id=address.id
seachData['areaItem'].name=address.name
seachData['areaItem'].data=address.data
}
})
console.log(seachData)
return seachData
}
let deconstructionSeachData=null
//
let setRouterQuerySet = ref(true)
let routerQuerySet = () => {
console.log(123, routeQuery)
deconstructionData(routeQuery.data)
return
deconstructionSeachData=deconstructionData(routeQuery.data)
console.log(deconstructionSeachData)
if (!setRouterQuerySet.value) return
//
if ((routeQuery.data && routeQuery.data.houseingPageType === '1') || (routePath.value === '/intermediaryHousing')) {
@ -626,24 +634,26 @@ let routerQuerySet = () => {
otherData.value = [{ title: '认证房源', id: 'isverified' }, { title: '有电梯', id: 'iselevator' }, { title: '有阳台', id: 'issunshinearea' }]
}
if (Object.keys(routeQuery.data).length > 0) {
if (!routeQuery.data || routeQuery.data && !routeQuery.data.data) return
let data = routeQuery.data.data.split(',')
if (Object.keys(deconstructionSeachData).length===0) return
let data = deconstructionSeachData.areaItem
if (routeQuery.data.type === 'school') {
selectPosition.value = 'school'
schoolSelectObj.id = data.id
schoolSelectObj.title = data.title
} else if (routeQuery.data.type === 'types') {
let type = data.id.toString().substring(0, 1)
} else if (deconstructionSeachData.type === 'types') {
let type = deconstructionSeachData.selectData.toString().substring(0, 1)
hireTypeObj.id = data.id
hireTypeObj.title = data.name
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
} else if (routeQuery.data.type === 'location') {
let areaItem = routeQuery.data.areaItem ? routeQuery.data.areaItem.split(',') : ''
selectTabCheck.id = areaItem[0]*1;
selectTabCheck.title = areaItem[1];
selectTabCheck.data = list[selectTabCheck.id].data;
console.log(list)
selectData.data = seachAreaId(data)
} else if (deconstructionSeachData.type === 'location') {
selectTabCheck.id = deconstructionSeachData.areaItem.id;
selectTabCheck.title = deconstructionSeachData.areaItem.title;
selectTabCheck.data = deconstructionSeachData.areaItem.data;
selectData.data = seachAreaId(deconstructionSeachData.selectData)
if (routeQuery.data.types) {
let types = JSON.parse(routeQuery.data.types)
let { data } = types
@ -652,7 +662,7 @@ let routerQuerySet = () => {
hireTypeObj.title = selectData.data.length == 0 ? '' : data.name
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
}
setCheckBoxData(data)//
setCheckBoxData(deconstructionSeachData.selectData)//
}
}
setRouterQuerySet.value = false

View File

@ -370,12 +370,19 @@ let indexWaterfallBoxCheck = (res) => {
//
let personHouseingInfo = (type, data, areaItem) => {
console.log(type, data, areaItem)
let areaItems=JSON.parse(areaItem)
let areaItems={}
let setData=null
if(type==="location"){
areaItems=JSON.parse(areaItem)
setData=data.toString()
}else if(type==='types'){
setData=data.id
}
router.push({
path: `/personHousing`,
query: {
[type]:data.toString(),
areaItem:`${areaItems['id']}`
[type]:setData,
areaItem:areaItems['id']?`${areaItems['id']}`:''
},
// params:{
// type,