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