搜索页

This commit is contained in:
2023-07-19 18:23:56 +08:00
parent ea4b66db95
commit 9900a77f14
9 changed files with 675 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="dis-f s-w-100" style="border-bottom:1px solid #ebebeb;">
<div class="dis-f s-w-100" :style="[routePath === '/seachPage'?'':'border-bottom:1px solid #ebebeb;']">
<div class="select-box s-w-50 bor-r">
<div class="dis-f bor-b-das" :class="{ 'al-item housing-pd': routePath === '/needHousing' }">
<div class="tab-title">{{ routePath === '/needHousing' ? '目标区域' : '地理位置' }}</div>
@@ -127,7 +127,7 @@
</div>
</div>
<div class="dis-f al-item" style="padding:30px 0;">
<div class="tab-title">{{ routePath === '/needHousing' ? '租金预算' : '租金' }}</div>
<div class="tab-title" >{{ routePath === '/needHousing' ? '租金预算' : '租金' }}</div>
<div class="dis-f al-item rent-box jus-bet">
<div class="dis-f al-item">
<input type="text" class="input" v-model="rentObj.min" @blur="setRent">
@@ -191,9 +191,13 @@
</div>
</div>
</div>
<div class="btm-list">
<div class="btm-list" v-if="routePath !== '/seachPage'">
<div class="dis-f al-item">
<span class="count">{{ count || 0 }}</span>个人房源 <span v-show="selectTabCheck.title && selectTabCheck.id">
<span class="count">{{ count || 0 }}</span>
{{routePath === '/personHousing'?
'个人房源':routePath === '/intermediaryHousing'?
'中介房源':routePath === '/needHousing'?
'求房源':''}} <span v-show="selectTabCheck.title && selectTabCheck.id">
&nbsp
|
&nbsp</span>
@@ -228,7 +232,7 @@
</template>
<script setup>
import { reactive, ref, getCurrentInstance, defineProps, watchEffect, inject, shallowReactive } from 'vue';
import { reactive, ref, getCurrentInstance, defineProps, watchEffect, inject, shallowReactive,defineExpose } from 'vue';
import { useRoute } from 'vue-router';
import checkBoxGroup from "../../components/checkGroup/checkBoxGroup.vue";
import store from '../../store/index';
@@ -237,6 +241,11 @@ import store from '../../store/index';
//数据包
let configData = reactive({ data: {} })
//监听路由
const route = useRoute()
let routePath = ref('')
routePath.value = route.path
const { proxy } = getCurrentInstance()
const props = defineProps({
@@ -250,17 +259,18 @@ let setSeachCondition = props.setSeachCondition
//最新发布选项
let listSort = shallowReactive({
type: [
{ title: '最新发布', type: 'new' },
{ title: '热门', type: 'hot' },
{ title: '价格从低到高', type: 'sort' },
{ title: '加个从高到低' }
{ title: '最新发布', type: 'timestamp' },
{ title: '热门', type: 'hotnum' },
{ title: '价格从低到高', type: 'rentasc' },
{ title: '价格从高到低',type:'rentdesc'}
],
checkType: 'new',
checkType: 'timestamp',
check: '最新发布'
})
//列表总数
const count = inject('count')
const count=inject('count')
let list = shallowReactive([{
name: '不限',
@@ -276,7 +286,7 @@ let list = shallowReactive([{
}])
//设置区域数据
let setRegionList = () => {
let arr = store.state.seachTypeData[1] ? store.state.seachTypeData[1].where : []
let arr = store.state.seachTypeData[1] ? JSON.parse(JSON.stringify(store.state.seachTypeData[1].where)) : []
arr.map((res, i) => {
list[i] = res
})
@@ -284,6 +294,7 @@ let setRegionList = () => {
name: '不限',
id: ''
})
console.log(store.state.seachTypeData)
}
//按区域/学校选择的地区
@@ -402,12 +413,6 @@ let selectSeach = (data = []) => {
setSeachCondition('location', data)
}
//监听路由
const route = useRoute()
let routePath = ref('')
routePath.value = route.path
//底部删除按钮
let deleteSelect = (id) => {
selectData.data.splice(id, 1)
@@ -514,6 +519,25 @@ let setOtherCheck = (data) => {
setSeachCondition('', data)
}
//清除筛选
let cleanSelect=()=>{
cleanRent()
otherCheck['list']=[]
releaseObj.id=0
gender.id=0
hireDate.id=0
hireDate.title=''
hireTypeObj.id=0
hireTypeObj.title=''
hireTypeObj.hireId='不限'
selectTabCheck.id = '';
selectTabCheck.title = '不限'
selectTabCheck.data = [];
selectData.data = []
schoolSelectObj.id = ''
schoolSelectObj.title = '不限'
}
watchEffect(() => {
configData.data = store.state.indexData.config
if (configData.data) {
@@ -528,6 +552,10 @@ watchEffect(() => {
// seachArea.data = store.state.seachTypeData[1] ? store.state.seachTypeData[1].where : []
}
})
defineExpose({
cleanSelect
})
</script>
<script>
export default {