个人/中介 搜索 求房源 首页更新
This commit is contained in:
parent
60f0f45def
commit
4adeb65dbd
@ -119,7 +119,7 @@ let listId = props.listId
|
||||
let imgRef = null
|
||||
let loadFinish = () => {
|
||||
let height = imgRef.ctx.$refs&&imgRef.ctx.$refs.list&&imgRef.ctx.$refs.list.offsetHeight
|
||||
console.log(data.id, listId, height)
|
||||
// console.log(data.id, listId, height)
|
||||
props.imgLoad(data.id, listId, height)
|
||||
}
|
||||
|
||||
|
@ -159,16 +159,24 @@ historyArr.data = JSON.parse(localStorage.getItem('historyArr')) || []
|
||||
|
||||
//搜索数据
|
||||
let seachList = (item) => {
|
||||
console.log(123)
|
||||
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));
|
||||
route.push({
|
||||
path: '/seachPage',
|
||||
query: {
|
||||
keyword:seachAllType.keyword
|
||||
}
|
||||
})
|
||||
if (routePath.value === '/') {
|
||||
route.push({
|
||||
path: '/seachPage',
|
||||
query: {
|
||||
keyword: seachAllType.keyword
|
||||
}
|
||||
})
|
||||
}else{
|
||||
setSeachConditions()
|
||||
}
|
||||
|
||||
// getDataList(seachAllType)
|
||||
}
|
||||
|
||||
@ -450,5 +458,6 @@ defineExpose({
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
}</style>
|
||||
}
|
||||
</style>
|
||||
|
@ -238,6 +238,9 @@ let setSeachConditions = (type, data) => {
|
||||
...data
|
||||
}
|
||||
}
|
||||
if(!seachVal.value){
|
||||
seachAllType.searchid=''
|
||||
}
|
||||
// console.log('seachAllType', seachAllType)
|
||||
// return
|
||||
getDataList(seachAllType, tabType.value)
|
||||
@ -266,7 +269,7 @@ let searchInit = (data) => {
|
||||
}
|
||||
//搜索数据
|
||||
let seachList = (item) => {
|
||||
console.log(seachVal.value)
|
||||
if(seachVal.value.replace(/\s/g,""))return
|
||||
if (!seachVal.value) {
|
||||
return
|
||||
}
|
||||
|
@ -953,8 +953,14 @@ img {
|
||||
margin-right: 10px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
border:1px solid transparent;
|
||||
}
|
||||
.btn:hover{
|
||||
border:1px solid rgba(235,235,235,1)
|
||||
}
|
||||
.dropdown-btn:hover{
|
||||
border:1px solid rgba(235,235,235,1);
|
||||
}
|
||||
|
||||
.dropdown-btn {
|
||||
height: 30px;
|
||||
display: flex;
|
||||
@ -969,6 +975,7 @@ img {
|
||||
text-align: center;
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
border:1px solid transparent;
|
||||
|
||||
.mg-l-30 {
|
||||
margin-left: 30px !important;
|
||||
@ -987,7 +994,7 @@ img {
|
||||
|
||||
.btn-check {
|
||||
color: #50E3C2 !important;
|
||||
border: 1px solid #50E3C2;
|
||||
border: 1px solid #50E3C2 !important;
|
||||
background: #eefcf9;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<listBtmPrompt></listBtmPrompt>
|
||||
<footerTool></footerTool>
|
||||
</div>
|
||||
<!-- 右下角咨询 -->
|
||||
<circle-btn></circle-btn>
|
||||
@ -36,6 +37,7 @@ import circleBtn from '@/components/public/circle-btn.vue'
|
||||
import api from "../../utils/api";
|
||||
import tool from '../../toolJs/downLoadMore'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import footerTool from '@/components/footer/footer.vue'
|
||||
|
||||
//获取数据
|
||||
let pages = ref(1)
|
||||
@ -43,7 +45,7 @@ let dataList = reactive({ data: [], count: 0 })
|
||||
let dataCount = ref(0)
|
||||
let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 })
|
||||
let seachSelectData = reactive({ data: {} })
|
||||
let loading = ref(false)
|
||||
let loading = ref(true)
|
||||
provide('count', dataCount)
|
||||
|
||||
//保存搜索设置
|
||||
@ -76,11 +78,7 @@ let getDataList = (data) => {
|
||||
}
|
||||
api.getLists(postData).then(res => {
|
||||
if (res.code === 200) {
|
||||
loading.value = true
|
||||
dataList.data = res.data.data
|
||||
if(res.data.count<20){
|
||||
loading.value = false
|
||||
}
|
||||
if (pages.value === 1) {
|
||||
setInitial()
|
||||
}
|
||||
@ -88,8 +86,8 @@ let getDataList = (data) => {
|
||||
dataList.count = res.data.count
|
||||
dataCount.value = res.data.count
|
||||
nextTick(() => {
|
||||
pageList['1'].push(dataList.data[0])
|
||||
pageList['2'].push(dataList.data[1])
|
||||
if(dataList.data[0])pageList['1'].push(dataList.data[0])
|
||||
if(dataList.data[1])pageList['2'].push(dataList.data[1])
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
@ -103,9 +101,11 @@ let getDataList = (data) => {
|
||||
//添加数据
|
||||
let addListData = () => {
|
||||
let num = null
|
||||
if (pageList.tab >= (dataList.count>20?20-2:dataList.count-2)) {
|
||||
if(dataList.count>20){
|
||||
if (pageList.tab >= (dataList.count>20?dataList.data.length-2:dataList.count-2)) {
|
||||
if(dataList.data.length>=20){
|
||||
loading.value = true
|
||||
}else{
|
||||
loading.value = false
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -127,7 +127,7 @@ let watchImgLoad = (id, listId, height) => {
|
||||
//加载更多
|
||||
let downLoadMore = () => {
|
||||
tool.loadMore(() => {
|
||||
if (!loading.value||dataList.data.length===0) return
|
||||
if (!loading.value) return
|
||||
pages.value++
|
||||
getDataList(seachSelectData.data)
|
||||
})
|
||||
|
@ -20,6 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<listBtmPrompt></listBtmPrompt>
|
||||
<footerTool></footerTool>
|
||||
</div>
|
||||
|
||||
<!-- 右下角咨询 -->
|
||||
@ -37,6 +38,7 @@ import circleBtn from '@/components/public/circle-btn.vue'
|
||||
import api from "../../utils/api";
|
||||
import tool from '../../toolJs/downLoadMore'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import footerTool from '@/components/footer/footer.vue'
|
||||
|
||||
//获取数据
|
||||
let pages = ref(1)
|
||||
@ -44,22 +46,16 @@ let dataList = reactive({ data: [], count: 0 })
|
||||
let dataCount = ref(0)
|
||||
let pageList = reactive({ 1: [], 2: [], height1: 0, height2: 0, tab: 1 })
|
||||
let seachSelectData = reactive({ data: {} })
|
||||
let loading = ref(false)
|
||||
let loading = ref(true)
|
||||
provide('count', dataCount)
|
||||
|
||||
//保存搜索设置
|
||||
let setSeachSelectData = (data) => {
|
||||
pages.value = 1
|
||||
|
||||
// if(data.location.length>0){
|
||||
// data.location=JSON.stringify(data.location)
|
||||
// }
|
||||
seachSelectData.data = {
|
||||
...data
|
||||
}
|
||||
loading.value = true
|
||||
console.log('seachSelectData', seachSelectData.data)
|
||||
return
|
||||
getDataList(seachSelectData.data)
|
||||
}
|
||||
|
||||
@ -83,11 +79,7 @@ let getDataList = (data) => {
|
||||
}
|
||||
api.getLists(postData).then(res => {
|
||||
if (res.code === 200) {
|
||||
loading.value = true
|
||||
dataList.data = res.data.data
|
||||
if(res.data.count<20){
|
||||
loading.value = false
|
||||
}
|
||||
if (pages.value === 1) {
|
||||
setInitial()
|
||||
}
|
||||
@ -95,8 +87,8 @@ let getDataList = (data) => {
|
||||
dataList.count = res.data.count
|
||||
dataCount.value = res.data.count
|
||||
nextTick(() => {
|
||||
pageList['1'].push(dataList.data[0])
|
||||
pageList['2'].push(dataList.data[1])
|
||||
if(dataList.data[0])pageList['1'].push(dataList.data[0])
|
||||
if(dataList.data[1])pageList['2'].push(dataList.data[1])
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
@ -110,9 +102,12 @@ let getDataList = (data) => {
|
||||
//添加数据
|
||||
let addListData = () => {
|
||||
let num = null
|
||||
if (pageList.tab >= (dataList.count>20?20-2:dataList.count-2)) {
|
||||
if(dataList.count>20){
|
||||
if (pageList.tab >= (dataList.count>20?dataList.data.length-2:dataList.count-2)) {
|
||||
console.log(dataList.data.length,20,loading.value)
|
||||
if(dataList.data.length>=20){
|
||||
loading.value = true
|
||||
}else{
|
||||
loading.value = false
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -134,7 +129,7 @@ let watchImgLoad = (id, listId, height) => {
|
||||
//加载更多
|
||||
let downLoadMore = () => {
|
||||
tool.loadMore(() => {
|
||||
if (!loading.value||dataList.data.length===0) return
|
||||
if (!loading.value) return
|
||||
pages.value++
|
||||
getDataList(seachSelectData.data)
|
||||
})
|
||||
|
@ -20,6 +20,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<listBtmPrompt></listBtmPrompt>
|
||||
<footerTool></footerTool>
|
||||
</div>
|
||||
|
||||
<!-- 右下角咨询 -->
|
||||
@ -38,6 +39,7 @@ import api from "../../utils/api";
|
||||
import tool from '../../toolJs/downLoadMore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import footerTool from '@/components/footer/footer.vue'
|
||||
|
||||
//路由
|
||||
const router = useRouter()
|
||||
@ -83,23 +85,15 @@ let getDataList = (data) => {
|
||||
api.getLists(postData).then(res => {
|
||||
if (res.code === 200) {
|
||||
dataList.data = res.data.data
|
||||
// if (res.data.data.length === 0) {
|
||||
// loading.value = false
|
||||
// return
|
||||
// }
|
||||
if(res.data.count<20){
|
||||
loading.value = false
|
||||
}
|
||||
if (pages.value === 1) {
|
||||
setInitial()
|
||||
}
|
||||
pageList.tab = 1
|
||||
dataList.count = res.data.count
|
||||
dataCount.value = res.data.count
|
||||
|
||||
nextTick(() => {
|
||||
pageList['1'].push(dataList.data[0])
|
||||
pageList['2'].push(dataList.data[1])
|
||||
if(dataList.data[0])pageList['1'].push(dataList.data[0])
|
||||
if(dataList.data[1])pageList['2'].push(dataList.data[1])
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
@ -113,9 +107,11 @@ let getDataList = (data) => {
|
||||
//添加数据
|
||||
let addListData = () => {
|
||||
let num = null
|
||||
if (pageList.tab >= (dataList.count>20?20-2:dataList.count-2)) {
|
||||
if(dataList.count>20){
|
||||
if (pageList.tab >= (dataList.count>20?dataList.data.length-2:dataList.count-2)) {
|
||||
if(dataList.data.length>=20){
|
||||
loading.value = true
|
||||
}else{
|
||||
loading.value = false
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -150,7 +146,7 @@ onMounted(() => {
|
||||
let typeData=null
|
||||
if(data)typeData=JSON.parse(data)
|
||||
|
||||
if(Object.keys(data).length>0){
|
||||
if(data&&Object.keys(data).length>0){
|
||||
if(type!=='location'){
|
||||
seachSelectData.data={[type]:typeData.id}
|
||||
}else{
|
||||
|
@ -24,6 +24,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<listBtmPrompt></listBtmPrompt>
|
||||
<footerTool></footerTool>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -40,6 +41,7 @@ import apartmentItem from '@/components/public/apartment-item.vue';
|
||||
import Masonry from 'masonry-layout';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElMessage } from 'element-plus'
|
||||
import footerTool from '@/components/footer/footer.vue'
|
||||
|
||||
//路由
|
||||
const route = useRouter()
|
||||
@ -99,11 +101,7 @@ let getDataList = (data) => {
|
||||
seachApi.then(res => {
|
||||
if (res.code === 200) {
|
||||
console.log(res.data)
|
||||
loading.value = true
|
||||
dataList.data = res.data.data
|
||||
if (res.data.count < 20) {
|
||||
loading.value = false
|
||||
}
|
||||
if (seachSelectData.data.tabType !== 'apartment') {
|
||||
if (pages.value === 1) {
|
||||
setInitial()
|
||||
@ -112,8 +110,8 @@ let getDataList = (data) => {
|
||||
dataList.count = res.data.count
|
||||
dataCount.value = res.data.count
|
||||
nextTick(() => {
|
||||
pageList['1'].push(dataList.data[0])
|
||||
pageList['2'].push(dataList.data[1])
|
||||
if(dataList.data[0])pageList['1'].push(dataList.data[0])
|
||||
if(dataList.data[1])pageList['2'].push(dataList.data[1])
|
||||
})
|
||||
} else {
|
||||
let data = res.data
|
||||
@ -137,10 +135,11 @@ let getDataList = (data) => {
|
||||
//添加数据
|
||||
let addListData = () => {
|
||||
let num = null
|
||||
console.log(pageList.tab , dataList.count)
|
||||
if (pageList.tab >= (dataList.count>20?20-2:dataList.count-2)) {
|
||||
if(dataList.count>20){
|
||||
if (pageList.tab >= (dataList.count>20?dataList.data.length-2:dataList.count-2)) {
|
||||
if(dataList.data.length>=20){
|
||||
loading.value = true
|
||||
}else{
|
||||
loading.value = false
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user