搜索页新增求房源判断

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -160,22 +160,29 @@ historyArr.data = JSON.parse(localStorage.getItem('historyArr')) || []
//
let seachList = (item) => {
// console.log(123)
let string=seachAllType.keyword
let string = seachAllType.keyword
if (!string.replace(/\s/g, "")) return
if (historyArr.data.indexOf(seachAllType.keyword) === -1) {
historyArr.data.push(seachAllType.keyword)
}
localStorage.setItem('historyArr', JSON.stringify(historyArr.data));
if (routePath.value === '/') {
route.push({
path: '/seachPage',
query: {
keyword: seachAllType.keyword
}
})
}else{
setSeachConditions()
}
route.push({
path: '/seachPage',
query: {
keyword: seachAllType.keyword,
isNeedHousing:routePath.value === '/needHousing'
}
})
// if (routePath.value === '/') {
// route.push({
// path: '/seachPage',
// query: {
// keyword: seachAllType.keyword
// }
// })
// }else{
// setSeachConditions()
// }
// getDataList(seachAllType)
}
@ -418,6 +425,7 @@ defineExpose({
border-radius: 0 8px 8px 0;
line-height: 48px;
cursor: pointer;
transform: translateX(-3px);
}
.img {

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
}

View File

@ -242,6 +242,25 @@ import store from '../../store/index';
//
let configData = reactive({ data: {} })
//
let setStoreSelectData=(obj,data,type)=>{
console.log(store.state.seachSelect)
// otherCheck['list']
// releaseObj.id
// gender.id
// hireDate.id
// hireDate.title
// hireTypeObj.id
// hireTypeObj.title
// hireTypeObj.hireId
// selectTabCheck.id
// selectTabCheck.title
// selectTabCheck.data
// selectData.data
// schoolSelectObj.id
// schoolSelectObj.title
}
//
const route = useRouter()
let routePath = ref('')
@ -362,15 +381,6 @@ let nextSchoolData = () => {
//
let setSelectPosition = (type) => {
selectPosition.value = type
// if (type === 'school') {
// selectTabCheck.id = '';
// selectTabCheck.title = ''
// selectTabCheck.data = [];
// selectData.data = []
// } else {
// schoolSelectObj.id = ''
// schoolSelectObj.title = ''
// }
}
///
@ -533,6 +543,7 @@ let otherCheck = reactive({ list: [] })
//
let setOtherCheck = (data) => {
// setStoreSelectData('otherCheck',data)
setSeachCondition('', data)
}

View File

@ -41,6 +41,7 @@ import Axios from '@/utils/axios';
api.index().then(res => {
if (res.code === 200) {
console.log(123)
store.state.seachTypeData = res.data.combination
store.state.indexData = res.data
store.state.ListSelectBtn = res.data.recommendedTab

View File

@ -9,7 +9,6 @@ export default createStore({
wechat: {}, // 微信号 二维码等数据
nav: [], // 顶部的导航数据
apartment: {}, // 公寓筛选的字段
// <<<<<<< HEAD
routeList:{
index:{
path:'/',
@ -20,9 +19,8 @@ export default createStore({
title:'',
}
},//导航路由列表
// =======
seachSelect:{},//保存筛选条件
showloginmodal: false, // 是否需要登录状态
// >>>>>>> 542e853 (提交)
},
getters: {

View File

@ -44,8 +44,11 @@
</div>
</div>
</div>
<div>
<div class="image-box">
<div class="dis-f al-item">
</div>
<div></div>
</div>
</div>
<div>
@ -185,6 +188,31 @@ img {
}
}
}
.image-box {
margin-top: 35px;
.img-video {
width: 26px;
height: 26px;
}
.img-icon {
width: 22px;
height: 22px;
}
.num-box {
width: 20px;
height: 20px;
border-radius: 50%;
color: #333333;
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
}
}
}
</style>

View File

@ -181,7 +181,7 @@ onMounted(() => {
routeQuery.data = route.currentRoute.value.query
console.log(routeQuery)
if(routeQuery.data.keyword){
inputModuleInfo.value.searchInit(routeQuery.data.keyword)
inputModuleInfo.value.searchInit(routeQuery.data.keyword)//
route.currentRoute.value.query={}
}else{
getDataList()