个人房源跳转
This commit is contained in:
@@ -19,9 +19,11 @@
|
|||||||
@click="setSelectData(item.id, item.data, item.name)" v-for="(item, i) in list" :key="i">
|
@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"
|
<div class="dis-f al-item">{{ item.name }} <div class="dis-f al-item"
|
||||||
v-show="selectTabCheck.id === item.id && selectTabCheck.id"> > 
|
v-show="selectTabCheck.id === item.id && selectTabCheck.id"> > 
|
||||||
<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
|
selectData.data && selectData.data.length
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
@@ -75,7 +77,8 @@
|
|||||||
v-show="selectTabCheck.id === item.id && selectTabCheck.id"> > 
|
v-show="selectTabCheck.id === item.id && selectTabCheck.id"> > 
|
||||||
<div :class="{ 'select-num': selectData.data && selectData.data.length }">
|
<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
|
selectData.data && selectData.data.length
|
||||||
}}
|
}}
|
||||||
</div>
|
</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) => {
|
let setHireTypeArr = (type, id) => {
|
||||||
@@ -577,16 +580,16 @@ let cleanSelect = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查找数据
|
//查找数据
|
||||||
let getAddressListId=(id,type)=>{
|
let getAddressListId = (id, type) => {
|
||||||
let data=null
|
let data = null
|
||||||
let checkList= type==='location'?list:type==='types'?hireTypeArr:type==='school'?store.state.seachTypeData[0].where:''
|
let checkList = type === 'location' ? list : type === 'types' ? hireTypeArr : type === 'school' ? store.state.seachTypeData[0].where : ''
|
||||||
let dataId=type==='types'?id.substring(0,1):id
|
let dataId = type === 'types' ? id.substring(0, 1) : id
|
||||||
checkList.map(res=>{
|
checkList.map(res => {
|
||||||
if(res.id==dataId){
|
if (res.id == dataId) {
|
||||||
if(type==='types'){
|
if (type === 'types') {
|
||||||
data=getHireType(res.hireType,id)
|
data = getHireType(res.hireType, id)
|
||||||
}else{
|
} else {
|
||||||
data= res
|
data = res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -594,43 +597,49 @@ let getAddressListId=(id,type)=>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查找出租类型
|
//查找出租类型
|
||||||
let getHireType=(data,id)=>{
|
let getHireType = (data, id) => {
|
||||||
let obj=null
|
console.log(data)
|
||||||
data.map(res=>{
|
let obj = null
|
||||||
if(res.id==id)obj=res
|
data.map(res => {
|
||||||
|
if (res.id == id) obj = res
|
||||||
})
|
})
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
//解数据
|
//解数据
|
||||||
let deconstructionData=(data={})=>{
|
let deconstructionData = (data = {}) => {
|
||||||
//第一个为type
|
//第一个为type
|
||||||
//type第一个参数为一级区域 第二个参数为二级区域
|
//type第一个参数为一级区域 第二个参数为二级区域
|
||||||
let seachData={}
|
let seachData = {}
|
||||||
let key = Object.keys(data)
|
let key = Object.keys(data)
|
||||||
key.map((res,index)=>{
|
key.map((res, index) => {
|
||||||
if(index===0){//类型
|
if (index === 0) {//类型
|
||||||
seachData['type']=res
|
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'):''
|
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 (index === 1) {//类型参数
|
||||||
if(seachData['type']!=='location') return
|
if (seachData['type'] === 'location') {
|
||||||
let address=getAddressListId(data[res],'location')
|
let address = getAddressListId(data[res], 'location')
|
||||||
seachData['areaItem']={}
|
seachData['areaItem'] = {}
|
||||||
seachData['areaItem'].id=address.id
|
seachData['areaItem'].id = address.id
|
||||||
seachData['areaItem'].name=address.name
|
seachData['areaItem'].name = address.name
|
||||||
seachData['areaItem'].data=address.data
|
seachData['areaItem'].data = address.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index === 2) {
|
||||||
|
seachData['cotenancy'] = res
|
||||||
|
seachData['cotenancyData'] = getAddressListId(data[res], 'types')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return seachData
|
return seachData
|
||||||
}
|
}
|
||||||
|
|
||||||
let deconstructionSeachData=null
|
let deconstructionSeachData = null
|
||||||
|
|
||||||
//根据路由设置参数
|
//根据路由设置参数
|
||||||
let setRouterQuerySet = ref(true)
|
let setRouterQuerySet = ref(true)
|
||||||
let routerQuerySet = () => {
|
let routerQuerySet = () => {
|
||||||
deconstructionSeachData=deconstructionData(routeQuery.data)
|
deconstructionSeachData = deconstructionData(routeQuery.data)
|
||||||
console.log(deconstructionSeachData)
|
console.log(deconstructionSeachData)
|
||||||
if (!setRouterQuerySet.value) return
|
if (!setRouterQuerySet.value) return
|
||||||
//路由参数设置
|
//路由参数设置
|
||||||
@@ -642,8 +651,8 @@ let routerQuerySet = () => {
|
|||||||
otherData.value = [{ title: '认证房源', id: 'isverified' }, { title: '有电梯', id: 'iselevator' }, { title: '有阳台', id: 'issunshinearea' }]
|
otherData.value = [{ title: '认证房源', id: 'isverified' }, { title: '有电梯', id: 'iselevator' }, { title: '有阳台', id: 'issunshinearea' }]
|
||||||
}
|
}
|
||||||
if (Object.keys(routeQuery.data).length > 0) {
|
if (Object.keys(routeQuery.data).length > 0) {
|
||||||
if (Object.keys(deconstructionSeachData).length===0) return
|
if (Object.keys(deconstructionSeachData).length === 0) return
|
||||||
let data = deconstructionSeachData.areaItem
|
// let data = deconstructionSeachData.areaItem
|
||||||
if (deconstructionSeachData.type === 'school') {
|
if (deconstructionSeachData.type === 'school') {
|
||||||
|
|
||||||
selectPosition.value = 'school'
|
selectPosition.value = 'school'
|
||||||
@@ -664,15 +673,14 @@ let routerQuerySet = () => {
|
|||||||
selectTabCheck.data = deconstructionSeachData.areaItem.data;
|
selectTabCheck.data = deconstructionSeachData.areaItem.data;
|
||||||
selectData.data = seachAreaId(deconstructionSeachData.selectData)
|
selectData.data = seachAreaId(deconstructionSeachData.selectData)
|
||||||
|
|
||||||
if (routeQuery.data.types) {
|
if (deconstructionSeachData.cotenancy) {
|
||||||
let types = JSON.parse(routeQuery.data.types)
|
let type = deconstructionSeachData.cotenancyData.id.toString().substring(0, 1)
|
||||||
let { data } = types
|
hireTypeObj.id = deconstructionSeachData.cotenancyData.id
|
||||||
let type = data.id.toString().substring(0, 1)
|
hireTypeObj.title = deconstructionSeachData.cotenancyData.title
|
||||||
hireTypeObj.id = selectData.data.length == 0 ? '' : data.id
|
|
||||||
hireTypeObj.title = selectData.data.length == 0 ? '' : data.name
|
|
||||||
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
|
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
|
||||||
}
|
}
|
||||||
nextTick(()=>{
|
if(deconstructionSeachData.selectData[0])
|
||||||
|
nextTick(() => {
|
||||||
setCheckBoxData(deconstructionSeachData.selectData)//设置地区选项
|
setCheckBoxData(deconstructionSeachData.selectData)//设置地区选项
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -963,7 +963,6 @@
|
|||||||
<!-- 右下角咨询 -->
|
<!-- 右下角咨询 -->
|
||||||
<circle-btn></circle-btn>
|
<circle-btn></circle-btn>
|
||||||
<back-to-top></back-to-top>
|
<back-to-top></back-to-top>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -1140,21 +1139,25 @@ let setNavigation = () => {
|
|||||||
console.log(location)
|
console.log(location)
|
||||||
if (!location) return
|
if (!location) return
|
||||||
if (pageType.value == 1 || pageType.value == 2) {
|
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)])}`)
|
// console.log(`${store.state.routeList['secondaryIndex'].path}/location/${JSON.stringify([housingInfo['data']['info'].location.substring(0, 1)])}`)
|
||||||
store.state.routeList['thirdIndex'] = {
|
store.state.routeList['thirdIndex'] = {
|
||||||
path: `${store.state.routeList['secondaryIndex'].path}`,
|
path: `${store.state.routeList['secondaryIndex'].path}`,
|
||||||
query: {
|
query: {
|
||||||
type: 'location',
|
location: '',
|
||||||
name: location[housingInfo['data']['info'].location.substring(0, 1)],
|
areaItem: housingInfo['data']['info'].location.substring(0, 1),
|
||||||
id: housingInfo['data']['info'].location.substring(0, 1),
|
types: housingInfo['data']['info'].type.substring(0, 1)
|
||||||
types: `${type[housingInfo['data']['info'].type.substring(0, 1)]},${housingInfo['data']['info'].type}`
|
|
||||||
},
|
},
|
||||||
title: `${location[housingInfo['data']['info'].location.substring(0, 1)]}${type[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)
|
if (housingInfo['data']['info'].location.length > 0)
|
||||||
store.state.routeList['fourthIndex'] = {
|
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]}`
|
title: `${location[housingInfo['data']['info'].location]}${type[housingInfo['data']['info'].type]}`
|
||||||
}
|
}
|
||||||
} else if (pageType.value == 4) {
|
} else if (pageType.value == 4) {
|
||||||
|
|||||||
Reference in New Issue
Block a user