同路由切换
This commit is contained in:
@@ -170,7 +170,6 @@ let watchInfo = () => {
|
||||
for(let key in data){
|
||||
store.state.seachSelect['seachPage'][key]=seachData[key]
|
||||
}
|
||||
console.log(store.state.seachSelect)
|
||||
}
|
||||
router.push({
|
||||
path: '/detail',
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<div class="dis-f jus-x al-item">
|
||||
<div class="body-maxWidth mg-t-35">
|
||||
<breadcrumb :data="housingInfo['data']" :operation='setOperation'></breadcrumb>
|
||||
{{ pageType == 3 || (recommendListData.length == 0 || publisherList.length == 0) }}
|
||||
<el-affix :offset="0" @change="changeTitleType" z-index="700">
|
||||
<div class="top-bar-box dis-f jus-x" v-show="titleType">
|
||||
<div class="top-bar dis-f al-item jus-bet">
|
||||
@@ -421,7 +420,7 @@
|
||||
<!-- -->
|
||||
|
||||
<div class="map-box"
|
||||
v-if="pageType != 3 && housingInfo['data'] && housingInfo['data'].info.longitude">
|
||||
v-if="pageType != 3 && housingInfo['data'] && housingInfo['data'].info.location">
|
||||
<div class="dis-f al-item title-box">
|
||||
<img src="../assets/img/detail/mapIcon.png" class="img" alt="">
|
||||
<span class="title">{{
|
||||
@@ -724,8 +723,8 @@
|
||||
</div>
|
||||
<!-- 推荐 -->
|
||||
<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 class="body-maxWidth housing-title" style="margin-top:50px;">
|
||||
{{ pageType==2&&housingInfo['data'].isintermediary?`发布者的其他房源(${publisherList.length})`:'附近房源' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="dis-f jus-x al-item" style="position: relative;" v-if="pageType != 3">
|
||||
@@ -745,7 +744,7 @@
|
||||
</div>
|
||||
|
||||
<div class="dis-f jus-x bottom-tps"
|
||||
v-if="pageType != 3 && (recommendListData.length > 0 || publisherList.length > 0)">
|
||||
v-if="pageType ===1 || (pageType===2&&recommendListData.length>0&&housingInfo['data']&&housingInfo['data'].isintermediary)">
|
||||
- {{ loadText }} -
|
||||
</div>
|
||||
<footerTool class="mg-t-60"></footerTool>
|
||||
@@ -970,7 +969,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, onMounted, ref, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { reactive, onMounted, ref, nextTick, onBeforeUnmount,watch } from 'vue'
|
||||
import pageTopBar from '../components/pageTopBar/pageTopBar.vue';
|
||||
import circleBtn from '@/components/public/circle-btn.vue'
|
||||
import api from "../utils/api";
|
||||
@@ -979,7 +978,7 @@ import watchImage from '../components/detail/imageWatch.vue'
|
||||
import breadcrumb from '../components/detail/breadcrumb.vue'
|
||||
import mapInfo from '../components/public/viewMap.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouter,useRoute } from 'vue-router'
|
||||
import indexWaterfallBox from "../components/indexWaterfallBox/indexWaterfallBox.vue";
|
||||
import Masonry from 'masonry-layout';
|
||||
import transmitBtn from '@/components/public/transmitBtn.vue'
|
||||
@@ -1193,7 +1192,7 @@ let getHousingInfo = () => {
|
||||
housingInfo['data'] = res.data
|
||||
setHousingArr()
|
||||
setNavigation()
|
||||
distanceList.value = distanceList.value.concat(housingInfo['data']['info'].pointData || [])
|
||||
distanceList.value = housingInfo['data']['info'].pointData || []
|
||||
distanceList.value.unshift({
|
||||
address: true,
|
||||
name: housingInfo['data']['info'].address,
|
||||
@@ -1201,9 +1200,9 @@ let getHousingInfo = () => {
|
||||
concatInfo['data'] = store.state.indexData.wechat
|
||||
if (res.data.contacts) contacts['data'] = res.data.contacts
|
||||
console.log('pageType',pageType.value)
|
||||
if ( pageType.value ==2) {
|
||||
if ( pageType.value ==2&&housingInfo['data'].isintermediary) {
|
||||
getPublisherList()
|
||||
} else if (pageType.value == 1) {
|
||||
} else if (pageType.value !=3) {
|
||||
recommendList()
|
||||
}
|
||||
|
||||
@@ -1284,7 +1283,7 @@ const onPageSrcoll = (e) => {
|
||||
if (loadMore.value) {
|
||||
loadMore.value = false
|
||||
pages.value += 1
|
||||
if (housingInfo['data'].info.verified) {
|
||||
if (housingInfo['data'].isintermediary) {
|
||||
getPublisherList()
|
||||
} else {
|
||||
recommendList()
|
||||
@@ -1370,6 +1369,27 @@ const gridContainer = ref(null);
|
||||
let masonryInstance = null
|
||||
|
||||
let router = useRouter()
|
||||
let route = useRoute()
|
||||
|
||||
watch(route,()=>{
|
||||
let { id, type } = router.currentRoute.value.query
|
||||
uniqid.value = id
|
||||
pageType.value = type //1个人 2中介 3求房源
|
||||
publisherList.value=[]
|
||||
recommendListData.value=[]
|
||||
getHousingInfo()
|
||||
masonryInstance = new Masonry(gridContainer.value, {
|
||||
itemSelector: '.waterfall-box',
|
||||
gutter: 10
|
||||
});
|
||||
if (pageType.value != 3) {
|
||||
setTimeout(() => {
|
||||
window.addEventListener('scroll', onPageSrcoll, true);
|
||||
document.body.scrollTop = 0
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
let { id, type } = router.currentRoute.value.query
|
||||
uniqid.value = id
|
||||
@@ -1385,7 +1405,6 @@ onMounted(() => {
|
||||
document.body.scrollTop = 0
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
Reference in New Issue
Block a user