搜索页新增求房源判断
This commit is contained in:
parent
1559002cd5
commit
e0f1eddfe0
BIN
src/assets/img/detail/imageIcon.png
Normal file
BIN
src/assets/img/detail/imageIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/img/detail/videoIcon.png
Normal file
BIN
src/assets/img/detail/videoIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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: {
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user