From e62574320551b9204e8d6c7cd6d8c06a66829874 Mon Sep 17 00:00:00 2001 From: luJianJun <2587063613@qq.com> Date: Wed, 19 Jul 2023 19:24:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=B7=B3=E8=BD=AC=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E6=88=BF=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexSeachInfo/indexSeachInfo.vue | 14 ++++- src/components/seachModule/seachModule.vue | 14 +++-- src/components/seachPage/input.vue | 4 +- src/views/HomeView.vue | 55 ++++++++++++------- src/views/detail.vue | 4 +- src/views/housingView/intermediary.vue | 9 ++- src/views/housingView/needHousing.vue | 9 ++- src/views/housingView/person.vue | 25 +++++++-- src/views/seachIndex.vue | 7 ++- 9 files changed, 99 insertions(+), 42 deletions(-) diff --git a/src/components/indexSeachInfo/indexSeachInfo.vue b/src/components/indexSeachInfo/indexSeachInfo.vue index 2d21089..e515c50 100644 --- a/src/components/indexSeachInfo/indexSeachInfo.vue +++ b/src/components/indexSeachInfo/indexSeachInfo.vue @@ -8,7 +8,7 @@
-
- + - - + -
@@ -197,6 +197,12 @@ let setHotSeach=(item)=>{ getDataList(seachAllType) } +//点击选项 +let checkBtn=(data,type)=>{ + console.log(data,type) + getDataList(type,data) +} + defineExpose({ historyShow diff --git a/src/components/seachPage/input.vue b/src/components/seachPage/input.vue index 04d515a..90c7a04 100644 --- a/src/components/seachPage/input.vue +++ b/src/components/seachPage/input.vue @@ -148,7 +148,7 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/housingView/intermediary.vue b/src/views/housingView/intermediary.vue index 20a46a0..d602e9f 100644 --- a/src/views/housingView/intermediary.vue +++ b/src/views/housingView/intermediary.vue @@ -62,6 +62,8 @@ let setInitial = () => { //获取搜索数据 let getDataList = (data) => { + if(!loading.value)return + loading.value = false let postData = { page: pages.value, intermediary:1, @@ -94,7 +96,10 @@ let getDataList = (data) => { //添加数据 let addListData = () => { let num = null - if (pageList.tab >= 18) return + if (pageList.tab >= 18){ + loading.value = true + return + } pageList.tab++ if (pageList.height1 > pageList.height2) { num = 2 @@ -113,7 +118,7 @@ let watchImgLoad = (id, listId, height) => { //加载更多 let downLoadMore = () => { tool.loadMore(() => { - if (!loading.value) return + if (!loading.value||dataList.data.length===0) return pages.value++ getDataList(seachSelectData.data) }) diff --git a/src/views/housingView/needHousing.vue b/src/views/housingView/needHousing.vue index 34743ad..0f87a08 100644 --- a/src/views/housingView/needHousing.vue +++ b/src/views/housingView/needHousing.vue @@ -68,6 +68,8 @@ let setInitial = () => { //获取搜索数据 let getDataList = (data) => { + if(!loading.value)return + loading.value = false let postData = { page: pages.value, intermediary:0, @@ -100,7 +102,10 @@ let getDataList = (data) => { //添加数据 let addListData = () => { let num = null - if (pageList.tab >= 18) return + if (pageList.tab >= 18){ + loading.value = true + return + } pageList.tab++ if (pageList.height1 > pageList.height2) { num = 2 @@ -119,7 +124,7 @@ let watchImgLoad = (id, listId, height) => { //加载更多 let downLoadMore = () => { tool.loadMore(() => { - if (!loading.value) return + if (!loading.value||dataList.data.length===0) return pages.value++ getDataList(seachSelectData.data) }) diff --git a/src/views/housingView/person.vue b/src/views/housingView/person.vue index 4e4f5c8..3d40c0b 100644 --- a/src/views/housingView/person.vue +++ b/src/views/housingView/person.vue @@ -32,6 +32,11 @@ import listBtmPrompt from "../../components/public/have-questions.vue"; import noList from "../../components/public/empty-duck.vue"; import api from "../../utils/api"; import tool from '../../toolJs/downLoadMore' +import { useRouter } from 'vue-router' + +//路由 +const router = useRouter() + //获取数据 let pages = ref(1) @@ -39,7 +44,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) //保存搜索设置 @@ -63,6 +68,8 @@ let setInitial = () => { //获取搜索数据 let getDataList = (data) => { + if(!loading.value)return + loading.value = false let postData = { page: pages.value, intermediary:0, @@ -70,7 +77,6 @@ let getDataList = (data) => { } api.getLists(postData).then(res => { if (res.code === 200) { - loading.value = true dataList.data = res.data.data if (res.data.data.length === 0) { loading.value = false @@ -95,7 +101,10 @@ let getDataList = (data) => { //添加数据 let addListData = () => { let num = null - if (pageList.tab >= 18) return + if (pageList.tab >= 18){ + loading.value = true + return + } pageList.tab++ if (pageList.height1 > pageList.height2) { num = 2 @@ -114,7 +123,8 @@ let watchImgLoad = (id, listId, height) => { //加载更多 let downLoadMore = () => { tool.loadMore(() => { - if (!loading.value) return + + if (!loading.value||dataList.data.length==0) return pages.value++ getDataList(seachSelectData.data) }) @@ -122,7 +132,12 @@ let downLoadMore = () => { //listImg onMounted(() => { - getDataList() + console.log(router.params) + console.log(router.currentRoute.value.query) + if(Object.keys(router.currentRoute.value.query).length>0){ + seachSelectData.data={...router.currentRoute.value.query} + } + getDataList(seachSelectData.data) window.addEventListener('scroll', downLoadMore, true); }) diff --git a/src/views/seachIndex.vue b/src/views/seachIndex.vue index 223d5c0..7215d41 100644 --- a/src/views/seachIndex.vue +++ b/src/views/seachIndex.vue @@ -127,7 +127,10 @@ let getDataList = (data) => { //添加数据 let addListData = () => { let num = null - if (pageList.tab >= 18) return + if (pageList.tab >= 18){ + loading.value = true + return + } pageList.tab++ if (pageList.height1 > pageList.height2) { num = 2 @@ -146,7 +149,7 @@ let watchImgLoad = (id, listId, height) => { //加载更多 let downLoadMore = () => { tool.loadMore(() => { - if (!loading.value) return + if (!loading.value||dataList.data.length==0) return pages.value++ getDataList(seachSelectData.data) })