diff --git a/src/components/seachModule/seachModule.vue b/src/components/seachModule/seachModule.vue index cc32ba3..cba4e77 100644 --- a/src/components/seachModule/seachModule.vue +++ b/src/components/seachModule/seachModule.vue @@ -12,7 +12,7 @@
-
@@ -24,7 +24,7 @@
历史搜索
-
+
{{ item }}
@@ -74,9 +74,8 @@
- - {{ counti }} + v-if="routePath === '/personHousing' || routePath === '/intermediaryHousing' || routePath === '/needHousing'"> +
@@ -92,16 +91,18 @@ import { useRoute } from 'vue-router'; import store from '../../store/index'; import api from "../../utils/api"; -const props=defineProps({ - count:{ - type:Number, - default:0 +const props = defineProps({ + getDataList: { + type: Function } }) -let counti = ref(0) + +//数据包 +let configData = store.state.indexData.config + +let getDataList = props.getDataList //搜索框 -let seachValue = ref('') let historyShow = ref(false); let setHistoryShow = () => { historyShow.value = !historyShow.value @@ -112,6 +113,12 @@ let allHireType = {};//合租 let seachArea = {};//区域找房 let historyArr = reactive({ data: [] })//历史查找记录 let hotArr = reactive({ data: [] }) +let seachAllType = reactive({ + seachValue: '', + location: [], + types: '' +}) + //获取区域下列数据 let getLocationData = (data) => { @@ -138,7 +145,6 @@ 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) hotArr.data = store.state.indexData.hotSearcheWords - counti.value=props.count }) //获取历史搜索记录 @@ -146,14 +152,39 @@ historyArr.data = JSON.parse(localStorage.getItem('historyArr')) || [] //搜索数据 let seachList = () => { - + console.log() + let data = { + searchid: seachAllType.seachValue, + types: '' + } localStorage.setItem('historyArr', JSON.stringify(historyArr.data)); + getDataList(data) +} + +//设置搜索数据 +let setSeachConditions = (type, data) => { + if (type === 'rent') { + seachAllType['rent_min'] = data.min + seachAllType['rent_max'] = data.max + } else if(type!==''){ + seachAllType[type] = data + }else if(type===''){ + data.indexOf('isverified')!==-1?seachAllType['isverified']=1:seachAllType['isverified']=0 + data.indexOf('iselevator')!==-1?seachAllType['iselevator']=1:seachAllType['iselevator']=0 + data.indexOf('issunshinearea')!==-1?seachAllType['issunshinearea']=1:seachAllType['issunshinearea']=0 + } + console.log(seachAllType) +} + +//点击历史搜索记录 +let setSeachVal = (item) => { + seachAllType.seachValue = item + seachList() } defineExpose({ - historyShow, - seachValue + historyShow })