搜索页搜索数量同步

This commit is contained in:
2023-07-21 15:00:17 +08:00
parent fb81238823
commit 179d846bae
6 changed files with 52 additions and 21 deletions

View File

@@ -157,7 +157,7 @@
<script setup>
import { reactive, ref, shallowReactive, defineProps, watchEffect, defineExpose } from 'vue'
import selectTabBox from "../selectTabBox/selectTabBox.vue";
import apartmentSelect from '../apartment/seach.vue'
import apartmentSelect from '../apartment/seachModule.vue'
import store from '../../store/index';
import api from '@/utils/api';
import { useRouter } from 'vue-router';
@@ -184,19 +184,18 @@ let selectPage = (type) => {
if (type === 'apartment') {
selectTabBoxInfo.value.cleanSelect()//清空筛选数据
} else {
apartmentSelectInfo.value.cleanSelect()
apartmentSelectInfo.value.cleanSelect&&apartmentSelectInfo.value.cleanSelect()
}
//清空数据
if (type === 'apartment')
seachAllType = reactive({
keyword: '',
keyword: seachAllType['keyword'],
location: [],
searchid: '',
intermediary: 0
intermediary: ''
})
tabType.value = type
seachAllType['tabType'] = type
seachAllType['searchid'] = setPageKey()
if (type === 'person') {
seachAllType['intermediary'] = 0
} else if (type === 'intermediary') {
@@ -240,11 +239,13 @@ let checkPageType = () => {
//搜索key
let seachKey = reactive({ key: {
personal:{},
intermediary:{},
studentapartment:{}
} })
let seachKey = reactive({
key: {
personal: {},
intermediary: {},
studentapartment: {}
}
})
//搜索数据
let seachAllType = reactive({
@@ -311,10 +312,10 @@ let seachList = (item) => {
if (!seachVal.value) {
return
}
if(seachAllType['intermediary']===6){
seachAllType['keyword']=seachVal.value
if (seachAllType['intermediary'] === 6) {
seachAllType['keyword'] = seachVal.value
getDataList(seachAllType)
}else{
} else {
searchInit(seachVal.value)
}
}
@@ -365,6 +366,19 @@ let getLocationData = (data) => {
}
}
//更新当前数据数量
let setListCount=(item,num)=>{
console.log(item,num)
console.log(seachKey.key)
if(item.tabType==="intermediary"){
seachKey.key['intermediary']['count']=num
}else if(item.tabType==="person"){
seachKey.key['personal']['count']=num
}else if(item.tabType==="apartment"){
seachKey.key['studentapartment']['count']=num
}
}
//调用判断页面
checkPageType()
@@ -373,7 +387,8 @@ watchEffect(() => {
if (seachArea.data.length > 0 && !seachArea.data[0].data) getLocationData(store.state.indexData.config.location)
})
defineExpose({
searchInit
searchInit,
setListCount
})
</script>