搜索页搜索数量同步

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

@@ -3,7 +3,7 @@
<div class="body-maxWidth"> <div class="body-maxWidth">
<div class="s-w-100 seach-box-bg"> <div class="s-w-100 seach-box-bg">
<div class="seach-box"> <div class="seach-box">
<div class="top-seach dis-f al-item"> <div class="top-seach dis-f al-item" v-if="props.seachPage">
<div style="position: absolute;left: -8px;top: 20px;"> <div style="position: absolute;left: -8px;top: 20px;">
<div class="location-box dis-f jus-x al-item"> <div class="location-box dis-f jus-x al-item">
<img src="../../assets/homeImage/addressImg.png" class="img" alt=""> <img src="../../assets/homeImage/addressImg.png" class="img" alt="">
@@ -160,7 +160,7 @@
收起筛选条件<img class="icon" src="@/assets/img/publicImage/triangle-black.svg" /> 收起筛选条件<img class="icon" src="@/assets/img/publicImage/triangle-black.svg" />
</div> </div>
<div class="screen-footer flexacenter"> <div class="screen-footer flexacenter" v-if="props.seachPage">
<div class="quantity flexacenter"> <div class="quantity flexacenter">
<b class="b">{{ count }}</b> 个品牌公寓 <b class="b">{{ count }}</b> 个品牌公寓
</div> </div>
@@ -185,6 +185,10 @@ const props = defineProps({
count: { count: {
type: Number, type: Number,
default: 0 default: 0
},
seachPage: {
type: Boolean,
default: true
} }
}) })

View File

View File

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

View File

@@ -549,7 +549,7 @@ let setOtherCheck = (data) => {
//清除筛选 //清除筛选
let cleanSelect = () => { let cleanSelect = () => {
cleanRent() // cleanRent()
otherCheck['list'] = [] otherCheck['list'] = []
releaseObj.id = 0 releaseObj.id = 0
gender.id = 0 gender.id = 0
@@ -564,6 +564,8 @@ let cleanSelect = () => {
selectData.data = [] selectData.data = []
schoolSelectObj.id = '' schoolSelectObj.id = ''
schoolSelectObj.title = '不限' schoolSelectObj.title = '不限'
rentObj.min = ''
rentObj.max = ''
// setCheckData([]) // setCheckData([])
} }

View File

@@ -46,7 +46,10 @@
</div> </div>
<div class="image-box"> <div class="image-box">
<div class="dis-f al-item"> <div class="dis-f al-item">
<img src="../assets/img/detail/videoIcon.png" class="img-video" alt="">
<div class="num-box">1</div>
<img src="../assets/img/detail/imageIcon.png" class="img-icon" alt="">
<div class="num-box">2</div>
</div> </div>
<div></div> <div></div>
</div> </div>
@@ -195,17 +198,22 @@ img {
.img-video { .img-video {
width: 26px; width: 26px;
height: 26px; height: 26px;
margin-right:5px;
} }
.img-icon { .img-icon {
width: 22px; width: 22px;
height: 22px; height: 22px;
margin:0 5px 0 10px
} }
.num-box { .num-box {
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 50%; border-radius: 50%;
background:#fdda55;
line-height:20px;
text-align:center;
color: #333333; color: #333333;
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
font-weight: 400; font-weight: 400;

View File

@@ -15,7 +15,7 @@
listId="2"></biserialItem> listId="2"></biserialItem>
</div> </div>
</div> </div>
<div v-show="seachSelectData.data.intermediary === ''" ref="gridContainer"> <div v-show="seachSelectData.data.intermediary === ''&&dataList.data && dataList.data.length > 0" ref="gridContainer">
<apartment-item v-for="item in listApartment" :item="item"></apartment-item> <apartment-item v-for="item in listApartment" :item="item"></apartment-item>
</div> </div>
<div class="dis-f jus-x no-list-box al-item" v-show="dataList.data && dataList.data.length === 0"> <div class="dis-f jus-x no-list-box al-item" v-show="dataList.data && dataList.data.length === 0">
@@ -102,6 +102,7 @@ let getDataList = (data) => {
seachApi.then(res => { seachApi.then(res => {
if (res.code === 200) { if (res.code === 200) {
console.log(res.data) console.log(res.data)
// console.log(seachSelectData.data)
dataList.data = res.data.data dataList.data = res.data.data
if (seachSelectData.data.tabType !== 'apartment') { if (seachSelectData.data.tabType !== 'apartment') {
if (pages.value === 1) { if (pages.value === 1) {
@@ -116,13 +117,14 @@ let getDataList = (data) => {
}) })
} else { } else {
let data = res.data let data = res.data
dataList.count = res.data.count
listApartment.value = listApartment.value.concat(data.data) listApartment.value = listApartment.value.concat(data.data)
nextTick(() => { nextTick(() => {
masonryInstance.reloadItems(); masonryInstance.reloadItems();
masonryInstance.layout(); masonryInstance.layout();
}) })
} }
inputModuleInfo.value.setListCount(seachSelectData.data,dataList.count)
} else { } else {
ElMessage({ ElMessage({