收藏同步 距离房源更新

This commit is contained in:
2023-07-27 12:03:13 +08:00
parent ec456e000d
commit 49f1105e28
7 changed files with 57 additions and 26 deletions

View File

@@ -163,6 +163,13 @@ let pageType=ref('')
//跳转
let router = useRouter()
let watchInfo = () => {
let seachData=router.currentRoute.value.query
if(pageType.value===4){
for(let key in data){
store.state.seachSelect['seachPage'][key]=seachData[key]
}
console.log(store.state.seachSelect)
}
router.push({
path: '/detail',
query: {
@@ -178,7 +185,7 @@ onMounted(() => {
if(type){
pageType.value=type
}else{
pageType.value=routePath.value==='/personHousing'?1:routePath.value==='/intermediaryHousing'?2:routePath.value==='/needHousing'?3:''
pageType.value=routePath.value==='/personHousing'?1:routePath.value==='/intermediaryHousing'?2:routePath.value==='/needHousing'?3:routePath.value==='/seachPage'?4:''
}
})

View File

@@ -2,7 +2,7 @@
<div class="pos-r">
<div class="authentication-top"
:class="[pageType==2?'intermediary-top':'']"
v-if="data['data'] && data['data'].info && data['data'].info.verified === 1">
v-if="data['data'] && data['data'].info && (data['data'].info.verified === 1||data['data'].isintermediary)">
<div class="dis-f al-item jus-bet">
<div v-if="pageType==1">
<img src="../../assets/img/detail/authenticationLogon.png" class="logo" alt="">
@@ -100,11 +100,10 @@ let {type}=router.currentRoute.value.query
pageType.value=type
//导航数据
let storeData = store.state.routeList
console.log('storeData', storeData)
watchEffect(() => {
data['data'] = props.data
console.log(data['data'])
console.log(pageType.value)
})
</script>

View File

@@ -45,7 +45,7 @@
v-show="tabType === 'need'">
求房源
</div>
求房源
求房源{{ tabType }}
</div>
<div class="top-btn dis-f jus-x al-item second" v-if="isNeedHousing" @click="selectPage('intermediary')"
:class="{ 'select-top-btn-bg': tabType === 'intermediary' }">
@@ -55,7 +55,7 @@
</div>
</div>
</div>
<div class="top-btn dis-f jus-x al-item second" v-if="!isNeedHousing"
<div class="top-btn dis-f jus-x al-item second" v-if="!isNeedHousing&&houseingPageType!=6"
@click="selectPage('intermediary')" :class="{ 'select-top-btn-bg': tabType === 'intermediary' }">
<div class="first-select" v-show="tabType === 'person'">
<div class="box">
@@ -74,7 +74,7 @@
中介房源 {{ seachKey.key && seachKey.key.intermediary && seachKey.key.intermediary.count }}
</div>
<div class="top-btn dis-f jus-x al-item third" @click="selectPage('apartment')"
:class="{ 'select-top-btn-bg': tabType === 'apartment' }" v-if="!isNeedHousing">
:class="{ 'select-top-btn-bg': tabType === 'apartment' }" v-if="!isNeedHousing&&houseingPageType!=6">
<div class="second-select-third-box" v-show="tabType === 'intermediary'">
<div class="box">
@@ -197,7 +197,7 @@ let selectTabBoxInfo = ref(null)//个人/中介筛选实例
let apartmentSelectInfo = ref(null)//公寓筛选实例
//设置请求数据
let selectPage = (type) => {
if (type === seachAllType['tabType']) return
if (type === seachAllType['tabType']||houseingPageType==6) return
if (type === 'apartment') {
selectTabBoxInfo.value.cleanSelect()//清空筛选数据
} else {
@@ -228,13 +228,16 @@ let getDataList = props.getDataList
//搜索内容
let seachVal = ref('')
let isNeedHousing = ref(false)
seachVal.value = route.currentRoute.value.query.keyword.replace(/\s/g, "")
seachVal.value = route.currentRoute.value.query.keyword&&route.currentRoute.value.query.keyword.replace(/\s/g, "")
//判断是否从求房源页面跳转
isNeedHousing.value = route.currentRoute.value.query.isNeedHousing === 'true'
//判断当前是什么页面
let houseingPageType = route.currentRoute.value.query.houseingPageType
console.log('houseingPageType',houseingPageType)
let type = houseingPageType === '0' ? 'person' : houseingPageType === '1' ? 'intermediary' : houseingPageType === '6' ? 'need' : 'apartment'
tabType.value = type
//页面判断
let checkPageType = () => {

View File

@@ -579,7 +579,7 @@ let routerQuerySet = () => {
if (!setRouterQuerySet.value) return
//路由参数设置
if ((routeQuery.data && routeQuery.data.houseingPageType === '1') || (routePath.value === '/intermediaryHousing')) {
otherData = reactive([{ title: '认证中介', id: 'isverified' }, { title: '有电梯', id: 'iselevator' }, { title: '有阳台', id: 'issunshinearea' }])
otherData = reactive([{ title: '认证中介', id: 'isintermediary' }, { title: '有电梯', id: 'iselevator' }, { title: '有阳台', id: 'issunshinearea' }])
} else {
otherData = reactive([{ title: '认证房源', id: 'isverified' }, { title: '有电梯', id: 'iselevator' }, { title: '有阳台', id: 'issunshinearea' }])
}

View File

@@ -68,7 +68,7 @@ const routes = [
}
},
{//求房源
path: '/needHousing/:type?/:data?/:areaItem?/:types?',
path: '/needHousing',
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/needHousing.vue'),
meta: {
title: '求房源',

View File

@@ -19,7 +19,9 @@ export default createStore({
title:'',
}
},//导航路由列表
seachSelect:{},//保存筛选条件
seachSelect:{
seachPage:{}
},//保存筛选条件
showloginmodal: false, // 是否需要登录状态
},
getters: {

View File

@@ -1,7 +1,7 @@
<template>
<div>
<pageTopBar></pageTopBar>
<div class="dis-f jus-x al-item" :class="{'mg-b-80':pageType==3}">
<div class="dis-f jus-x al-item" :class="{'mg-b-80':pageType==3&&(recommendListData.length==0||publisherList.length==0)}">
<div class="body-maxWidth mg-t-35">
<breadcrumb :data="housingInfo['data']" :operation='setOperation'></breadcrumb>
<el-affix :offset="0" @change="changeTitleType" z-index="700">
@@ -12,7 +12,7 @@
v-if="pageType == 1 &&
housingInfo['data'] &&
housingInfo['data'].info.verified" alt="">
<img src="../assets/homeImage/intermediaryTabImg.png" class="intermediary-logo" v-if="pageType == 2 &&
<img src="../assets/homeImage/intermediaryTabImg.png" class="intermediary-logo" style="margin-right:10px;" v-if="pageType == 2 &&
housingInfo['data'] &&
housingInfo['data'].isintermediary == 1" alt="">
<div class="line" v-if="housingInfo['data'] && housingInfo['data'].info.verified"></div>
@@ -46,12 +46,12 @@
</div>
<div class="dis-f al-item">
<div class="tool-btn dis-f al-item jus-x">
<div class="dis-f al-item">
<img src="../assets/img/detail/collect.png" class="tool-icon" alt="">
<img src="../assets/img/detail/collectT.png" v-show="false" class="tool-icon"
<div class="dis-f al-item" @click="setOperation">
<img src="../assets/img/detail/collect.png" v-show="housingInfo['data']&&!housingInfo['data'].isfav" class="tool-icon" alt="">
<img src="../assets/img/detail/collectT.png" v-show="housingInfo['data']&&housingInfo['data'].isfav" class="tool-icon"
alt="">
<span>
收藏
{{ housingInfo['data']&&housingInfo['data'].isfav ? housingInfo['data']&&housingInfo['data']['info'].count_fav : '收藏' }}
</span>
</div>
<div class="line" style="margin:0 20px;"></div>
@@ -440,7 +440,7 @@
<div class="top-box"></div>
<div class="title-box dis-f al-item jus-x">
<span class="title">房源距离院校</span>
<img src="../assets/img/detail/close.png" class="close-icon" alt="">
<img src="../assets/img/detail/close.png" class="close-icon" @click="showDistance=false" alt="">
</div>
<div class="distance-info-data dis-f" v-if="distanceList.length > 0">
<div class="dis-f al-item school-info" v-for="(item, index) in distanceList"
@@ -513,7 +513,8 @@
</div>
<div class="houseing-info-box dis-f al-item jus-bet">
<div class="dis-f al-item houseing-info-box-s">
房源ID: <span class="houseing-id" @click="clone('123456789')">{{ housingInfo['data'] &&
房源ID: <span class="houseing-id" @click="clone(housingInfo['data'] &&
housingInfo['data'].info.uid)">{{ housingInfo['data'] &&
housingInfo['data'].info.uid }}</span>
<span class="browse-box">
浏览: <span class="text">{{ housingInfo['data'] && housingInfo['data'].info.count_view
@@ -551,7 +552,7 @@
<div>
如房源信息中有内容侵犯了您的合法权益,可点击屏幕右侧的举报或联系寄托方同学(微信号
<el-dropdown>
<span class="text-line" @click="clone('gternet2')">{{
<span class="text-line" @click="clone(concatInfo.data && concatInfo.data.wechat)">{{
concatInfo.data && concatInfo.data.wechat }}</span>
<template #dropdown>
<el-dropdown-menu>
@@ -671,7 +672,7 @@
</div>
<div class="dis-f jus-x ">
<div class="wx-qrcode-box dis-f jus-x al-item">
<img src="../assets/img/detail/wxQrCode.svg" class="wx-qrcode" alt="">
<img :src="housingInfo['data'] && housingInfo['data'].qrcode" class="wx-qrcode" alt="">
</div>
</div>
<div class="dis-f jus-x s-w-100">
@@ -708,7 +709,7 @@
<img :src="contacts['data'].businesscard&&contacts['data'].businesscard[0].image" class="img" alt="">
</div>
<!-- 推荐 -->
<div class="dis-f jus-x" v-if="pageType != 3">
<div class="dis-f jus-x" v-if="pageType != 3&&(recommendListData.length > 0||publisherList.length > 0)">
<div class="body-maxWidth housing-title" style="margin-top:30px;">
附近房源
</div>
@@ -728,7 +729,7 @@
</div>
</div>
</div>
<div class="dis-f jus-x bottom-tps" v-if="pageType != 3">
<div class="dis-f jus-x bottom-tps" v-if="pageType != 3&&(recommendListData.length > 0||publisherList.length > 0)">
- {{ loadText }} -
</div>
<footerTool></footerTool>
@@ -999,6 +1000,9 @@ let imgListTab = ref(0)
let interval = ''
//点击方向按钮
let moveImageList = (type) => {
let clientWidth = imageList.value.clientWidth
let scrollWidth = imageList.value.scrollWidth
if(type === 'right'&&imageLIst.value[imgListTab.value] + clientWidth >= scrollWidth)return
if ((type === 'left' && imgListTab.value === 0) || (imgListTab.value === imageLIst.value.length - 1 && type === 'right')) return
type === 'left' ? imgListTab.value-- : imgListTab.value++
setOffsetWidth(imageLIst.value[imgListTab.value], type)
@@ -1107,7 +1111,7 @@ let setNavigation = () => {
if (!location) return
if (pageType.value == 1 || pageType.value == 2) {
// type=location&data=["2.2"]&areaItem={"id":2,"name":"九龙"}
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'] = {
path: `${store.state.routeList['secondaryIndex'].path}/location/${JSON.stringify([housingInfo['data']['info'].location.substring(0, 1)])}/${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, 1)],id:housingInfo['data']['info'].type}})}`,
title: `${location[housingInfo['data']['info'].location.substring(0, 1)]}${type[housingInfo['data']['info'].type.substring(0, 1)]}房源`
@@ -1117,6 +1121,21 @@ let setNavigation = () => {
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}})}`,
title: `${location[housingInfo['data']['info'].location]}${type[housingInfo['data']['info'].type]}`
}
}else if(pageType.value == 4){
store.state.routeList['thirdIndex'] = {
path:{
path:`${store.state.routeList['secondaryIndex'].path}`,
query:{
id: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}`,
title: `${location[housingInfo['data']['info'].location]}${type[housingInfo['data']['info'].type]}`
}
}
}
//中介数据
@@ -1315,7 +1334,7 @@ let router = useRouter()
onMounted(() => {
let { id, type } = router.currentRoute.value.query
uniqid.value = id
pageType.value = type
pageType.value = type //1个人 2中介 3求房源 4搜索
getHousingInfo()
masonryInstance = new Masonry(gridContainer.value, {
itemSelector: '.waterfall-box',
@@ -2021,6 +2040,7 @@ img {
.wx-qrcode {
width: 103px;
height: 103px;
border-radius:50%;
}
}