个人房源跳转

This commit is contained in:
luJianJun 2023-07-27 19:43:15 +08:00
parent 81fbcd6b6e
commit 9879550544
2 changed files with 61 additions and 50 deletions

View File

@ -19,9 +19,11 @@
@click="setSelectData(item.id, item.data, item.name)" v-for="(item, i) in list" :key="i">
<div class="dis-f al-item">{{ item.name }} <div class="dis-f al-item"
v-show="selectTabCheck.id === item.id && selectTabCheck.id">&nbsp>&nbsp
<div :class="{ 'check-data': selectData.data && selectData.data.length > 0&&selectData.data.length!==selectTabCheck.data.length }">
<div
:class="{ 'check-data': selectData.data && selectData.data.length > 0 && selectData.data.length !== selectTabCheck.data.length }">
{{
selectData.data && selectData.data.length === 0||selectData.data.length===selectTabCheck.data.length ?'不限' :
selectData.data && selectData.data.length ===
0 || selectData.data.length === selectTabCheck.data.length ? '不限' :
selectData.data && selectData.data.length
}}
</div>
@ -75,7 +77,8 @@
v-show="selectTabCheck.id === item.id && selectTabCheck.id">&nbsp>&nbsp
<div :class="{ 'select-num': selectData.data && selectData.data.length }">
{{
selectData.data && selectData.data.length === 0||selectData.data.length===selectTabCheck.data.length ? '不限' :
selectData.data && selectData.data.length ===
0 || selectData.data.length === selectTabCheck.data.length ? '不限' :
selectData.data && selectData.data.length
}}
</div>
@ -468,7 +471,7 @@ let listSortCheck = (item) => {
//
let hireTypeArr = shallowReactive([{ hireType: [], title: '不限' }, { title: '合租',id:1, hireType: [] }, { hireType: [],id:2, title: '整租' }])
let hireTypeArr = shallowReactive([{ hireType: [], title: '不限' }, { title: '合租', id: 1, hireType: [] }, { hireType: [], id: 2, title: '整租' }])
//
let setHireTypeArr = (type, id) => {
@ -577,60 +580,66 @@ let cleanSelect = () => {
}
//
let getAddressListId=(id,type)=>{
let data=null
let checkList= type==='location'?list:type==='types'?hireTypeArr:type==='school'?store.state.seachTypeData[0].where:''
let dataId=type==='types'?id.substring(0,1):id
checkList.map(res=>{
if(res.id==dataId){
if(type==='types'){
data=getHireType(res.hireType,id)
}else{
data= res
let getAddressListId = (id, type) => {
let data = null
let checkList = type === 'location' ? list : type === 'types' ? hireTypeArr : type === 'school' ? store.state.seachTypeData[0].where : ''
let dataId = type === 'types' ? id.substring(0, 1) : id
checkList.map(res => {
if (res.id == dataId) {
if (type === 'types') {
data = getHireType(res.hireType, id)
} else {
data = res
}
}
}
})
return data
}
//
let getHireType=(data,id)=>{
let obj=null
data.map(res=>{
if(res.id==id)obj=res
let getHireType = (data, id) => {
console.log(data)
let obj = null
data.map(res => {
if (res.id == id) obj = res
})
return obj
}
//
let deconstructionData=(data={})=>{
let deconstructionData = (data = {}) => {
//type
//type
let seachData={}
let seachData = {}
let key = Object.keys(data)
key.map((res,index)=>{
if(index===0){//
seachData['type']=res
seachData['selectData']=seachData['type']==='location'?data[res].split(','):seachData['type']==='types'?getAddressListId(data[res],'types'):seachData['type']==='school'?getAddressListId(data[res],'school'):''
key.map((res, index) => {
if (index === 0) {//
seachData['type'] = res
seachData['selectData'] = seachData['type'] === 'location' ? data[res].split(',') : seachData['type'] === 'types' ? getAddressListId(data[res], 'types') : seachData['type'] === 'school' ? getAddressListId(data[res], 'school') : ''
}
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
if (index === 1) {//
if (seachData['type'] === 'location') {
let address = getAddressListId(data[res], 'location')
seachData['areaItem'] = {}
seachData['areaItem'].id = address.id
seachData['areaItem'].name = address.name
seachData['areaItem'].data = address.data
}
}
if (index === 2) {
seachData['cotenancy'] = res
seachData['cotenancyData'] = getAddressListId(data[res], 'types')
}
})
return seachData
}
let deconstructionSeachData=null
let deconstructionSeachData = null
//
let setRouterQuerySet = ref(true)
let routerQuerySet = () => {
deconstructionSeachData=deconstructionData(routeQuery.data)
deconstructionSeachData = deconstructionData(routeQuery.data)
console.log(deconstructionSeachData)
if (!setRouterQuerySet.value) return
//
@ -642,8 +651,8 @@ let routerQuerySet = () => {
otherData.value = [{ title: '认证房源', id: 'isverified' }, { title: '有电梯', id: 'iselevator' }, { title: '有阳台', id: 'issunshinearea' }]
}
if (Object.keys(routeQuery.data).length > 0) {
if (Object.keys(deconstructionSeachData).length===0) return
let data = deconstructionSeachData.areaItem
if (Object.keys(deconstructionSeachData).length === 0) return
// let data = deconstructionSeachData.areaItem
if (deconstructionSeachData.type === 'school') {
selectPosition.value = 'school'
@ -664,15 +673,14 @@ let routerQuerySet = () => {
selectTabCheck.data = deconstructionSeachData.areaItem.data;
selectData.data = seachAreaId(deconstructionSeachData.selectData)
if (routeQuery.data.types) {
let types = JSON.parse(routeQuery.data.types)
let { data } = types
let type = data.id.toString().substring(0, 1)
hireTypeObj.id = selectData.data.length == 0 ? '' : data.id
hireTypeObj.title = selectData.data.length == 0 ? '' : data.name
if (deconstructionSeachData.cotenancy) {
let type = deconstructionSeachData.cotenancyData.id.toString().substring(0, 1)
hireTypeObj.id = deconstructionSeachData.cotenancyData.id
hireTypeObj.title = deconstructionSeachData.cotenancyData.title
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
}
nextTick(()=>{
if(deconstructionSeachData.selectData[0])
nextTick(() => {
setCheckBoxData(deconstructionSeachData.selectData)//
})
}

View File

@ -963,7 +963,6 @@
<!-- 右下角咨询 -->
<circle-btn></circle-btn>
<back-to-top></back-to-top>
</template>
<script setup>
@ -1140,21 +1139,25 @@ let setNavigation = () => {
console.log(location)
if (!location) return
if (pageType.value == 1 || pageType.value == 2) {
// type=location&data=["2.2"]&areaItem={"id":2,"name":""}
// location=3.8,3.13&areaItem=3
// console.log(`${store.state.routeList['secondaryIndex'].path}/location/${JSON.stringify([housingInfo['data']['info'].location.substring(0, 1)])}`)
store.state.routeList['thirdIndex'] = {
path: `${store.state.routeList['secondaryIndex'].path}`,
query: {
type: 'location',
name: location[housingInfo['data']['info'].location.substring(0, 1)],
id: housingInfo['data']['info'].location.substring(0, 1),
types: `${type[housingInfo['data']['info'].type.substring(0, 1)]},${housingInfo['data']['info'].type}`
location: '',
areaItem: housingInfo['data']['info'].location.substring(0, 1),
types: housingInfo['data']['info'].type.substring(0, 1)
},
title: `${location[housingInfo['data']['info'].location.substring(0, 1)]}${type[housingInfo['data']['info'].type.substring(0, 1)]}房源`
}
if (housingInfo['data']['info'].location.length > 0)
store.state.routeList['fourthIndex'] = {
path: `${store.state.routeList['secondaryIndex'].path}/location/${JSON.stringify([housingInfo['data']['info'].location.substring(0, 3)])}/${JSON.stringify({ id: housingInfo['data']['info'].location.substring(0, 1), name: location[housingInfo['data']['info'].location.substring(0, 1)] })}/${JSON.stringify({ type: 'types', data: { name: type[housingInfo['data']['info'].type.substring(0, 3)], id: housingInfo['data']['info'].type } })}`,
query: {
location: housingInfo['data']['info'].location.substring(0, 3),
areaItem: housingInfo['data']['info'].location.substring(0, 1),
types: housingInfo['data']['info'].location.substring(0, 1)
},
path: `${store.state.routeList['secondaryIndex'].path}}/${JSON.stringify({ id: , name: location[housingInfo['data']['info'].location.substring(0, 1)] })}/${JSON.stringify({ type: 'types', data: { name: type[housingInfo['data']['info'].type.substring(0, 3)], id: housingInfo['data']['info'].type } })}`,
title: `${location[housingInfo['data']['info'].location]}${type[housingInfo['data']['info'].type]}`
}
} else if (pageType.value == 4) {