中介 个人 搜索 求房源 新增底部加载提示

This commit is contained in:
2023-07-21 14:04:44 +08:00
parent c53cc10101
commit fb81238823
10 changed files with 115 additions and 49 deletions

View File

@@ -29,30 +29,25 @@
:class="{ 'select-top-btn-bg': tabType === 'person' }">
<div class="top-btn" :class="[tabType === 'person' ? 'select-top-btn' : 'first-no-select']"
v-show="tabType === 'person'">
个人房源 {{ seachKey.key&&seachKey.key.personal&&seachKey.key.personal.count }}
个人房源 {{ seachKey.key && seachKey.key.personal && seachKey.key.personal.count }}
</div>
个人房源 {{ seachKey.key&&seachKey.key.personal&&seachKey.key.personal.count }}
个人房源 {{ seachKey.key && seachKey.key.personal && seachKey.key.personal.count }}
<div class="second-select" v-show="tabType === 'intermediary'">
<div class="box">
</div>
</div>
</div>
<div class="top-btn dis-f jus-x al-item first" v-if="isNeedHousing" @click="selectPage('person')"
:class="{ 'select-top-btn-bg': tabType === 'person' }">
<div class="top-btn" :class="[tabType === 'person' ? 'select-top-btn' : 'first-no-select']"
v-show="tabType === 'person'">
求房源 {{ seachKey.key&&seachKey.key.personal&&seachKey.key.personal.count }}
</div>
求房源 {{ seachKey.key&&seachKey.key.personal&&seachKey.key.personal.count }}
<div class="second-select" v-show="tabType === 'intermediary'">
<div class="box">
</div>
<div class="top-btn dis-f jus-x al-item first" v-if="isNeedHousing"
:class="{ 'select-top-btn-bg': tabType === 'need' }">
<div class="top-btn" :class="[tabType === 'need' ? 'select-top-btn' : 'first-no-select']"
v-show="tabType === 'need'">
求房源
</div>
求房源
</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' }">
<div class="top-btn dis-f jus-x al-item second" v-if="!isNeedHousing"
@click="selectPage('intermediary')" :class="{ 'select-top-btn-bg': tabType === 'intermediary' }">
<div class="first-select" v-show="tabType === 'person'">
<div class="box">
@@ -65,9 +60,9 @@
</div>
<div class="top-btn" :class="[tabType === 'intermediary' ? 'select-top-btn' : 'first-no-select']"
v-show="tabType === 'intermediary'">
中介房源 {{ seachKey.key&&seachKey.key.intermediary&&seachKey.key.intermediary.count }}
中介房源 {{ seachKey.key && seachKey.key.intermediary && seachKey.key.intermediary.count }}
</div>
中介房源 {{ seachKey.key&&seachKey.key.intermediary&&seachKey.key.intermediary.count }}
中介房源 {{ 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">
@@ -78,9 +73,9 @@
</div>
<div class="top-btn" :class="[tabType === 'apartment' ? 'select-top-btn' : 'first-no-select']"
v-show="tabType === 'apartment'">
品牌公寓 {{ seachKey.key&&seachKey.key.studentapartment&&seachKey.key.studentapartment.count }}
品牌公寓 {{ seachKey.key && seachKey.key.studentapartment && seachKey.key.studentapartment.count }}
</div>
学生公寓 {{ seachKey.key&&seachKey.key.studentapartment&&seachKey.key.studentapartment.count }}
学生公寓 {{ seachKey.key && seachKey.key.studentapartment && seachKey.key.studentapartment.count }}
</div>
</div>
<div v-show="tabType === 'apartment'" :class="{ 'show-box-pd': !showSelectModule }">
@@ -209,20 +204,47 @@ let selectPage = (type) => {
} else {
seachAllType['intermediary'] = ''
}
getDataList(seachAllType, tabType.value)
getDataList(seachAllType)
}
let getDataList = props.getDataList
//搜索内容
let seachVal = ref('')
let isNeedHousing=ref(false)
let isNeedHousing = ref(false)
seachVal.value = route.currentRoute.value.query.keyword
//判断是否从求房源页面跳转
isNeedHousing.value = route.currentRoute.value.query.isNeedHousing==='true'
isNeedHousing.value = route.currentRoute.value.query.isNeedHousing === 'true'
//判断当前是什么页面
let houseingPageType = route.currentRoute.value.query.houseingPageType
//页面判断
let checkPageType = () => {
// houseingPageType 0个人 1中介 6求房源
let type = houseingPageType === '0' ? 'person' : houseingPageType === '1' ? 'intermediary' : houseingPageType === '6' ? 'need' : 'apartment'
tabType.value = type
seachAllType['tabType'] = type
if (type === 'person') {
seachAllType['intermediary'] = 0
} else if (type === 'intermediary') {
seachAllType['intermediary'] = 1
} else if (type === 'need') {
seachAllType['intermediary'] = 6
seachAllType['keyword'] = seachVal.value
} else {
seachAllType['intermediary'] = ''
}
}
//搜索key
let seachKey = reactive({ key: {} })
let seachKey = reactive({ key: {
personal:{},
intermediary:{},
studentapartment:{}
} })
//搜索数据
let seachAllType = reactive({
@@ -255,27 +277,26 @@ let setSeachConditions = (type, data) => {
...data
}
}
if(!seachVal.value){
seachAllType.searchid=''
if (!seachVal.value) {
seachAllType.searchid = ''
}
// console.log('seachAllType', seachAllType)
// return
getDataList(seachAllType, tabType.value)
getDataList(seachAllType)
}
//设置当前搜索key
let setPageKey = () => {
return tabType.value === 'person' ? seachKey.key.personal.searchid : tabType.value === 'intermediary' ? seachKey.key.intermediary.searchid : seachKey.key.studentapartment.searchid
return tabType.value === 'person' ? seachKey.key.personal.searchid : tabType.value === 'intermediary' ? seachKey.key.intermediary.searchid : tabType.value === 'apartment' ? seachKey.key.studentapartment.searchid : ''
}
//搜索初始化
let searchInit = (data) => {
console.log(123456)
api.search({ keyword: data }).then(res => {
if (res.code === 200) {
seachKey.key = res.data
seachAllType.searchid = setPageKey()
getDataList(seachAllType, tabType.value)
getDataList(seachAllType)
} else {
ElMessage({
message: res.message,
@@ -286,11 +307,16 @@ let searchInit = (data) => {
}
//搜索数据
let seachList = (item) => {
if(!seachVal.value.replace(/\s/g,""))return
if (!seachVal.value.replace(/\s/g, "")) return
if (!seachVal.value) {
return
}
searchInit(seachVal.value)
if(seachAllType['intermediary']===6){
seachAllType['keyword']=seachVal.value
getDataList(seachAllType)
}else{
searchInit(seachVal.value)
}
}
//筛选词条
@@ -339,6 +365,9 @@ let getLocationData = (data) => {
}
}
//调用判断页面
checkPageType()
watchEffect(() => {
seachArea.data = store.state.seachTypeData[1] ? store.state.seachTypeData[1].where : []
if (seachArea.data.length > 0 && !seachArea.data[0].data) getLocationData(store.state.indexData.config.location)