中介详情显示房源

This commit is contained in:
2023-07-28 17:43:00 +08:00
parent 7bf9f59c75
commit 8da2aaf482
9 changed files with 63 additions and 40 deletions

View File

@@ -173,19 +173,13 @@ let watchInfo = () => {
path: '/detail', path: '/detail',
query: { query: {
id: data.data.uniqid, id: data.data.uniqid,
type:pageType.value
} }
}) })
} }
onMounted(() => { onMounted(() => {
imgRef = getCurrentInstance() imgRef = getCurrentInstance()
let {type}=router.currentRoute.value.query pageType.value=data.data.intermediary===1?2:data.data.intermediary===6?3:1
if(type){
pageType.value=type
}else{
pageType.value=data.data.intermediary===1?2:data.data.intermediary===6?3:1
}
}) })
</script> </script>

View File

@@ -103,7 +103,7 @@ let storeData = store.state.routeList
watchEffect(() => { watchEffect(() => {
data['data'] = props.data data['data'] = props.data
console.log(pageType.value) if(data['data']&&data['data']['info'])pageType.value=data['data']['info'].intermediary===1?2:data['data']['info'].intermediary===6?3:1
}) })
</script> </script>
@@ -221,12 +221,12 @@ img {
.top-round-s { .top-round-s {
position: absolute; position: absolute;
top: -13px; top: -17px;
left: -1px; left: 0px;
border-radius: 0 0 16px 0; border-radius: 0 0 16px 0;
background: rgba(174, 159, 251, 1); background: rgba(174, 159, 251, 1);
width: 23px; width: 22px;
height: 20px; height: 24px;
} }
.intermediary-bg{ .intermediary-bg{
background: rgba(173,214,247,1) !important; background: rgba(173,214,247,1) !important;

View File

@@ -116,13 +116,11 @@ location.data = store.state.indexData.config.location
let router = useRouter() let router = useRouter()
let watchInfo = () => { let watchInfo = () => {
console.log(itemData.type)
router.push({ router.push({
path: itemData.type === 'apartment' ? '/apartmentDetail' : '/detail', path: itemData.type === 'apartment' ? '/apartmentDetail' : '/detail',
query: { query: {
// id: itemData.type=='apartment'?itemData.id:itemData.uniqid, // id: itemData.type=='apartment'?itemData.id:itemData.uniqid,
[itemData.type == 'apartment' ? "uniqid" : "id"]: itemData.type == 'apartment' ? itemData.id : itemData.uniqid, [itemData.type == 'apartment' ? "uniqid" : "id"]: itemData.type == 'apartment' ? itemData.id : itemData.uniqid
type: itemData.intermediary == '1' ? 2 : itemData.intermediary == '6' ? 3 : !itemData.intermediary ? '' : 1
} }
}) })
} }
@@ -131,6 +129,7 @@ let watchAdv = () => {
if (itemData.url) { if (itemData.url) {
window.open(itemData.url) window.open(itemData.url)
} else { } else {
if(!itemData.path)return
watchInfo() watchInfo()
} }
} }

View File

@@ -36,11 +36,12 @@ export default createStore({
}, },
plugins:[ plugins:[
createPersistedstate({ createPersistedstate({
key:'data',
storage:window.sessionStorage, storage:window.sessionStorage,
reducer(val){ reducer(val){
console.log('val',val)
return{ return{
routeList:val.routeList, routeList:val.routeList
indexData:val.indexData
} }
} }
}) })

View File

@@ -629,7 +629,7 @@
<div v-if="checkUpdateTime(housingInfo['data'] && housingInfo['data'].info.updatetime)"> <div v-if="checkUpdateTime(housingInfo['data'] && housingInfo['data'].info.updatetime)">
<div class="dis-f al-item jus-x time-box" v-if="housingInfo['data'] && <div class="dis-f al-item jus-x time-box" v-if="housingInfo['data'] &&
housingInfo['data'].intermediarylistingcount > 0 && housingInfo['data'].intermediarylistingcount > 0 &&
housingInfo['data'] && ['config']['intermediary'] == 1 && housingInfo['data']['info']['intermediary'] == 1 &&
housingInfo['data'].isintermediary == 1"> housingInfo['data'].isintermediary == 1">
<img src="../assets/img/detail/presonNumIcon.png" class="icon" alt=""> <img src="../assets/img/detail/presonNumIcon.png" class="icon" alt="">
<span>房源 x{{ housingInfo['data'] && housingInfo['data'].intermediarylistingcount <span>房源 x{{ housingInfo['data'] && housingInfo['data'].intermediarylistingcount
@@ -759,7 +759,7 @@
</div> </div>
<div class="dis-f jus-x bottom-tps" <div class="dis-f jus-x bottom-tps"
v-if="pageType === 1 || (pageType === 2 && recommendListData.length > 0 && housingInfo['data'] && housingInfo['data'].isintermediary)"> v-if="(pageType === 1&&recommendListData.length > 0) || (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>
@@ -1165,10 +1165,10 @@ let setNavigation = () => {
// location=3.8,3.13&areaItem=3 // 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['secondaryIndex'] = { store.state.routeList['secondaryIndex'] = {
path: housingInfo['data']['info'].intermediary === 1 ? '/intermediaryHousing' : path: pageType.value===2 ? '/intermediaryHousing' :
housingInfo['data']['info'].intermediary === 6 ? '/needHousing' : '/personHousing', pageType.value===3 ? '/needHousing' : '/personHousing',
title: housingInfo['data']['info'].intermediary === 1 ? '中介房源' : title: pageType.value === 2 ? '中介房源' :
housingInfo['data']['info'].intermediary === 6 ? '求房源' : '个人房源' pageType.value===3 ? '求房源' : '个人房源'
} }
store.state.routeList['thirdIndex'] = { store.state.routeList['thirdIndex'] = {
path: `${store.state.routeList['secondaryIndex'].path}`, path: `${store.state.routeList['secondaryIndex'].path}`,
@@ -1209,6 +1209,7 @@ let getHousingInfo = () => {
console.log(res) console.log(res)
if (res.code === 200) { if (res.code === 200) {
housingInfo['data'] = res.data housingInfo['data'] = res.data
pageType.value =housingInfo['data']['info'].intermediary===1?2:housingInfo['data']['info'].intermediary===6?3:1 //1个人 2中介 3求房源
setHousingArr() setHousingArr()
setNavigation() setNavigation()
distanceList.value = housingInfo['data']['info'].pointData || [] distanceList.value = housingInfo['data']['info'].pointData || []
@@ -1218,7 +1219,6 @@ 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)
if (pageType.value == 2 && housingInfo['data'].isintermediary) { if (pageType.value == 2 && housingInfo['data'].isintermediary) {
getPublisherList() getPublisherList()
} else if (pageType.value != 3) { } else if (pageType.value != 3) {
@@ -1253,7 +1253,10 @@ let setOperation = () => {
//获取联系方式 //获取联系方式
let concatData = reactive({}) let concatData = reactive({})
let getConcatData = () => { let getConcatData = () => {
if (concatData['data']) return if (concatData['data']){
showConcat.value = true
return
}
api.contactData({ api.contactData({
token: housingInfo['data'].token token: housingInfo['data'].token
}).then(res => { }).then(res => {
@@ -1391,9 +1394,9 @@ let router = useRouter()
let route = useRoute() let route = useRoute()
watch(route, () => { watch(route, () => {
let { id, type } = router.currentRoute.value.query let { id } = router.currentRoute.value.query
uniqid.value = id uniqid.value = id
pageType.value = type //1个人 2中介 3求房源 pageType.value = housingInfo['data']['info'].intermediary===1?2:housingInfo['data']['info'].intermediary===6?3:1 //1个人 2中介 3求房源
publisherList.value = [] publisherList.value = []
recommendListData.value = [] recommendListData.value = []
getHousingInfo() getHousingInfo()
@@ -1410,9 +1413,8 @@ watch(route, () => {
}) })
onMounted(() => { onMounted(() => {
let { id, type } = router.currentRoute.value.query let { id } = router.currentRoute.value.query
uniqid.value = id uniqid.value = id
pageType.value = type //1个人 2中介 3求房源
getHousingInfo() getHousingInfo()
masonryInstance = new Masonry(gridContainer.value, { masonryInstance = new Masonry(gridContainer.value, {
itemSelector: '.waterfall-box', itemSelector: '.waterfall-box',

View File

@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
</div> </div>
<loadMoreText :loadText="loading?'加载中....':'到底了'"></loadMoreText> <loadMoreText :loadText="loadingText"></loadMoreText>
<listBtmPrompt></listBtmPrompt> <listBtmPrompt></listBtmPrompt>
<footerTool></footerTool> <footerTool></footerTool>
</div> </div>
@@ -52,6 +52,7 @@ let dataCount = ref(0)
let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 }) let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 })
let seachSelectData = reactive({ data: {} }) let seachSelectData = reactive({ data: {} })
let loading = ref(true) let loading = ref(true)
let loadingText=ref(' 加载中... ')
provide('count', dataCount) provide('count', dataCount)
//保存搜索设置 //保存搜索设置
@@ -85,6 +86,11 @@ let getDataList = (data) => {
api.getLists(postData).then(res => { api.getLists(postData).then(res => {
if (res.code === 200) { if (res.code === 200) {
dataList.data = res.data.data dataList.data = res.data.data
if(res.data.data.length<20){
loadingText.value=' 到底了 '
}else{
loadingText.value=' 加载中... '
}
if (pages.value === 1) { if (pages.value === 1) {
setInitial() setInitial()
} }

View File

@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
</div> </div>
<loadMoreText :loadText="loading?'加载中....':'到底了'"></loadMoreText> <loadMoreText :loadText="loadingText"></loadMoreText>
<listBtmPrompt></listBtmPrompt> <listBtmPrompt></listBtmPrompt>
<footerTool></footerTool> <footerTool></footerTool>
</div> </div>
@@ -52,6 +52,7 @@ let dataCount = ref(0)
let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 }) let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 })
let seachSelectData = reactive({ data: {} }) let seachSelectData = reactive({ data: {} })
let loading = ref(true) let loading = ref(true)
let loadingText=ref(' 加载中... ')
provide('count', dataCount) provide('count', dataCount)
//保存搜索设置 //保存搜索设置
@@ -85,6 +86,11 @@ let getDataList = (data) => {
api.getLists(postData).then(res => { api.getLists(postData).then(res => {
if (res.code === 200) { if (res.code === 200) {
dataList.data = res.data.data dataList.data = res.data.data
if(res.data.data.length<20){
loadingText.value=' 到底了 '
}else{
loadingText.value=' 加载中... '
}
if (pages.value === 1) { if (pages.value === 1) {
setInitial() setInitial()
} }

View File

@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
</div> </div>
<loadMoreText :loadText="loading ? '加载中....' : '到底了'"></loadMoreText> <loadMoreText :loadText="loadingText"></loadMoreText>
<listBtmPrompt></listBtmPrompt> <listBtmPrompt></listBtmPrompt>
<footerTool></footerTool> <footerTool></footerTool>
</div> </div>
@@ -58,6 +58,7 @@ let dataCount = ref(0)
let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 }) let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 })
let seachSelectData = reactive({ data: {} }) let seachSelectData = reactive({ data: {} })
let loading = ref(true) let loading = ref(true)
let loadingText = ref(' 加载中... ')
provide('count', dataCount) provide('count', dataCount)
//保存搜索设置 //保存搜索设置
@@ -91,6 +92,11 @@ let getDataList = (data) => {
api.getLists(postData).then(res => { api.getLists(postData).then(res => {
if (res.code === 200) { if (res.code === 200) {
dataList.data = res.data.data dataList.data = res.data.data
if(res.data.data.length<20){
loadingText.value=' 到底了 '
}else{
loadingText.value=' 加载中... '
}
if (pages.value === 1) { if (pages.value === 1) {
setInitial() setInitial()
} }

View File

@@ -5,7 +5,7 @@
<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">
<div class="dis-f jus-bet" <div class="dis-f jus-bet"
v-show="dataList.data && dataList.data.length > 0&&seachSelectData.data.tabType!=='apartment' && seachSelectData.data.intermediary !== ''"> v-show="dataList.data && dataList.data.length > 0 && seachSelectData.data.tabType !== 'apartment' && seachSelectData.data.intermediary !== ''">
<div ref="list"> <div ref="list">
<biserialItem v-for="(item, i) in pageList['1']" :key="i" :item="item" :imgLoad="watchImgLoad" <biserialItem v-for="(item, i) in pageList['1']" :key="i" :item="item" :imgLoad="watchImgLoad"
listId="1"></biserialItem> listId="1"></biserialItem>
@@ -15,7 +15,7 @@
listId="2"></biserialItem> listId="2"></biserialItem>
</div> </div>
</div> </div>
<div v-show="seachSelectData.data&&seachSelectData.data.tabType==='apartment' && dataList.data && dataList.data.length > 0" <div v-show="seachSelectData.data && seachSelectData.data.tabType === 'apartment' && dataList.data && dataList.data.length > 0"
ref="gridContainer"> ref="gridContainer">
<apartment-item v-for="item in listApartment" :item="item"></apartment-item> <apartment-item v-for="item in listApartment" :item="item"></apartment-item>
</div> </div>
@@ -24,12 +24,11 @@
</div> </div>
</div> </div>
</div> </div>
<loadMoreText :loadText="loading ? '加载中....' : '到底了'"></loadMoreText> <loadMoreText :loadText="loadingText"></loadMoreText>
<listBtmPrompt></listBtmPrompt> <listBtmPrompt></listBtmPrompt>
<footerTool></footerTool> <footerTool></footerTool>
</div> </div>
<back-to-top></back-to-top> <back-to-top></back-to-top>
</template> </template>
<script setup> <script setup>
@@ -60,6 +59,7 @@ let dataCount = ref(0)//数据数量
let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 })//双列瀑布数据 let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 })//双列瀑布数据
let seachSelectData = reactive({ data: {} })//搜索数据 let seachSelectData = reactive({ data: {} })//搜索数据
let loading = ref(true)//开关 let loading = ref(true)//开关
let loadingText = ref(` 加载中..... `)
let listApartment = ref([])//公寓数据 let listApartment = ref([])//公寓数据
let masonryInstance = null//瀑布实例 let masonryInstance = null//瀑布实例
provide('count', dataCount) provide('count', dataCount)
@@ -108,6 +108,11 @@ let getDataList = (data) => {
console.log(res.data) console.log(res.data)
// console.log(seachSelectData.data) // console.log(seachSelectData.data)
dataList.data = res.data.data dataList.data = res.data.data
if (res.data.data.length < 20) {
loadingText.value = ` 到底了 `
} else {
loadingText.value = ' 加载中... '
}
if (seachSelectData.data.tabType !== 'apartment') { if (seachSelectData.data.tabType !== 'apartment') {
if (pages.value === 1) { if (pages.value === 1) {
setInitial() setInitial()
@@ -123,12 +128,16 @@ let getDataList = (data) => {
let data = res.data let data = res.data
dataList.count = res.data.count dataList.count = res.data.count
dataCount.value = res.data.count dataCount.value = res.data.count
if(pages.value===1)listApartment.value=[] if (pages.value === 1) listApartment.value = []
listApartment.value = listApartment.value.concat(data.data) listApartment.value = listApartment.value.concat(data.data)
console.log(seachSelectData.data) console.log(seachSelectData.data)
nextTick(() => { nextTick(() => {
masonryInstance.reloadItems(); masonryInstance.reloadItems();
masonryInstance.layout(); masonryInstance.layout();
if (res.data.data.length >= 20) {
console.log(123)
loading.value = true
}
}) })
} }
inputModuleInfo.value.setListCount(seachSelectData.data, dataList.count) inputModuleInfo.value.setListCount(seachSelectData.data, dataList.count)
@@ -189,9 +198,9 @@ onMounted(() => {
gutter: 20 gutter: 20
}); });
routeQuery.data = route.currentRoute.value.query routeQuery.data = route.currentRoute.value.query
if (routeQuery.data.keyword && routeQuery.data.keyword.replace(/\s/g, "")&&routeQuery.data.houseingPageType!=6) { if (routeQuery.data.keyword && routeQuery.data.keyword.replace(/\s/g, "") && routeQuery.data.houseingPageType != 6) {
inputModuleInfo.value.searchInit(routeQuery.data.keyword)//调用搜索组件的搜索功能 inputModuleInfo.value.searchInit(routeQuery.data.keyword)//调用搜索组件的搜索功能
route.currentRoute.value.query.keyword = '' route.currentRoute.value.query.keyword = ''
} else { } else {
console.log(seachSelectData.data) console.log(seachSelectData.data)
inputModuleInfo.value.checkPageType() inputModuleInfo.value.checkPageType()