搜索页新增求房源判断

This commit is contained in:
2023-07-21 11:49:34 +08:00
parent 1559002cd5
commit e0f1eddfe0
9 changed files with 100 additions and 37 deletions

View File

@@ -25,20 +25,33 @@
</div>
<div class="seach-info-box body-maxWidth">
<div class="top-box dis-f al-item">
<div class="top-btn dis-f jus-x al-item first" @click="selectPage('person')"
<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'">
个人房源 521
个人房源 {{ seachKey.key&&seachKey.key.personal&&seachKey.key.personal.count }}
</div>
个人房源 521
个人房源 {{ 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 second" @click="selectPage('intermediary')"
<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>
</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="first-select" v-show="tabType === 'person'">
<div class="box">
@@ -52,12 +65,12 @@
</div>
<div class="top-btn" :class="[tabType === 'intermediary' ? 'select-top-btn' : 'first-no-select']"
v-show="tabType === 'intermediary'">
中介房源 82
中介房源 {{ seachKey.key&&seachKey.key.intermediary&&seachKey.key.intermediary.count }}
</div>
中介房源 82
中介房源 {{ 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' }">
:class="{ 'select-top-btn-bg': tabType === 'apartment' }" v-if="!isNeedHousing">
<div class="second-select-third-box" v-show="tabType === 'intermediary'">
<div class="box">
@@ -65,9 +78,9 @@
</div>
<div class="top-btn" :class="[tabType === 'apartment' ? 'select-top-btn' : 'first-no-select']"
v-show="tabType === 'apartment'">
品牌公寓 6
品牌公寓 {{ seachKey.key&&seachKey.key.studentapartment&&seachKey.key.studentapartment.count }}
</div>
学生公寓 6
学生公寓 {{ seachKey.key&&seachKey.key.studentapartment&&seachKey.key.studentapartment.count }}
</div>
</div>
<div v-show="tabType === 'apartment'" :class="{ 'show-box-pd': !showSelectModule }">
@@ -203,7 +216,11 @@ let getDataList = props.getDataList
//搜索内容
let seachVal = ref('')
let isNeedHousing=ref(false)
seachVal.value = route.currentRoute.value.query.keyword
//判断是否从求房源页面跳转
isNeedHousing.value = route.currentRoute.value.query.isNeedHousing==='true'
//搜索key
let seachKey = reactive({ key: {} })
@@ -253,11 +270,11 @@ let setPageKey = () => {
//搜索初始化
let searchInit = (data) => {
console.log(123456)
api.search({ keyword: data }).then(res => {
if (res.code === 200) {
seachKey.key = res.data
seachAllType.searchid = setPageKey()
// console.log(seachAllType)
getDataList(seachAllType, tabType.value)
} else {
ElMessage({
@@ -269,7 +286,7 @@ let searchInit = (data) => {
}
//搜索数据
let seachList = (item) => {
if(seachVal.value.replace(/\s/g,""))return
if(!seachVal.value.replace(/\s/g,""))return
if (!seachVal.value) {
return
}