This commit is contained in:
luJianJun 2023-07-26 18:03:04 +08:00
parent 13dacfe5d3
commit dff6345e33
4 changed files with 42 additions and 23 deletions

View File

@ -266,8 +266,11 @@ const route = useRouter()
let routePath = ref('')
let routeQuery = reactive({ data: {} })
routePath.value = route.currentRoute.value.path
routeQuery.data = route.currentRoute.value.query
if(route.currentRoute.value.params.type){
routeQuery.data = route.currentRoute.value.params
}else{
routeQuery.data = route.currentRoute.value.query
}
const { proxy } = getCurrentInstance()
const props = defineProps({
@ -600,6 +603,7 @@ let routerQuerySet = () => {
setCheckBoxData(data)//
}
}
setRouterQuerySet.value = false
}
@ -608,6 +612,7 @@ watchEffect(() => {
if (configData.data) {
hireTypeArr[1].hireType = setHireTypeArr(store.state.seachTypeData[2] ? store.state.seachTypeData[2].where[0].data : [], 1)
hireTypeArr[2].hireType = setHireTypeArr(store.state.seachTypeData[2] ? store.state.seachTypeData[2].where[1].data : [], 2)
console.log('route',route)
if (setRouterQuerySet.value) {
setRegionList()//
setSchoolData()//

View File

@ -46,7 +46,7 @@ const routes = [
}
},
{//个人房源
path: '/personHousing',
path: '/personHousing/:type?/:data?/:areaItem?',
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/person.vue'),
meta: {
title: '个人房源'
@ -101,7 +101,10 @@ router.beforeEach((to, from, next) => {
//导航数据
if (/['seachPage','needHousing','intermediaryHousing','personHousing']/.test(from.path)) {
store.state.routeList.secondaryIndex.title = from.meta.title
store.state.routeList.secondaryIndex.path = from.path
store.state.routeList.secondaryIndex.path = from.path==='/needHousing'?'/needHousing':
from.path==='/intermediaryHousing'?'/intermediaryHousing':
from.path==='/personHousing'?'/personHousing':
from.path==='/seachPage'?'/seachPage':''
}
next()
let meta = to['meta'] || {}

View File

@ -1103,12 +1103,13 @@ let setNavigation = () => {
let type = store.state.indexData.config && store.state.indexData.config.type
indexData['data'] = store.state.indexData
console.log('routeLis',store.state)
console.log(location)
if (!location) return
if (pageType.value == 1 || pageType.value == 2) {
// type=location&data=["2.2"]&areaItem={"id":2,"name":""}
console.log(`${store.state.routeList['secondaryIndex'].path}?type=location&data=${housingInfo['data']['info'].location.substring(0, 1)}`)
console.log(`${store.state.routeList['secondaryIndex'].path}/location/${housingInfo['data']['info'].location.substring(0, 1)}`)
store.state.routeList['thirdIndex'] = {
path: `${store.state.routeList['secondaryIndex'].path}?type=location&data=${housingInfo['data']['info'].location.substring(0, 1)}`,
path: `${store.state.routeList['secondaryIndex'].path}/location/${housingInfo['data']['info'].location.substring(0, 1)}`,
title: `${location[housingInfo['data']['info'].location.substring(0, 1)]}${type[housingInfo['data']['info'].type.substring(0, 1)]}房源`
}
if (housingInfo['data']['info'].location.length > 0)

View File

@ -19,7 +19,7 @@
</div>
</div>
</div>
<loadMoreText :loadText="loading?'加载中....':'到底了'"></loadMoreText>
<loadMoreText :loadText="loading ? '加载中....' : '到底了'"></loadMoreText>
<listBtmPrompt></listBtmPrompt>
<footerTool></footerTool>
</div>
@ -77,7 +77,7 @@ let setInitial = () => {
//
let getDataList = (data) => {
if(!loading.value)return
if (!loading.value) return
loading.value = false
let postData = {
page: pages.value,
@ -94,8 +94,8 @@ let getDataList = (data) => {
dataList.count = res.data.count
dataCount.value = res.data.count
nextTick(() => {
if(dataList.data[0])pageList['1'].push(dataList.data[0])
if(dataList.data[1])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({
@ -109,10 +109,10 @@ let getDataList = (data) => {
//
let addListData = () => {
let num = null
if (pageList.tab > (dataList.count>20?dataList.data.length-2:dataList.count-2)) {
if(dataList.data.length>20){
if (pageList.tab > (dataList.count > 20 ? dataList.data.length - 2 : dataList.count - 2)) {
if (dataList.data.length > 20) {
loading.value = true
}else{
} else {
loading.value = false
}
return
@ -135,7 +135,7 @@ let watchImgLoad = (id, listId, height) => {
//
let downLoadMore = () => {
tool.loadMore(() => {
if (!loading.value||dataList.data.length==0) return
if (!loading.value || dataList.data.length == 0) return
pages.value++
getDataList(seachSelectData.data)
})
@ -143,15 +143,25 @@ let downLoadMore = () => {
//listImg
onMounted(() => {
let {type,data}=router.currentRoute.value.query
let typeData=null
if(data)typeData=JSON.parse(data)
if(data&&Object.keys(data).length>0){
if(type!=='location'){
seachSelectData.data={[type]:typeData.id}
}else{
seachSelectData.data={[type]:typeData}
console.log(123)
let type=null,data=null
if (router.currentRoute.value.params.type) {
let { type, data } = router.currentRoute.value.params
type=type
data=data
} else {
let { type, data } = router.currentRoute.value.query
type=type
data=data
}
let typeData = null
if (data) typeData = JSON.parse(data)
if (data && Object.keys(data).length > 0) {
if (type !== 'location') {
seachSelectData.data = { [type]: typeData.id }
} else {
seachSelectData.data = { [type]: typeData }
}
}
getDataList(seachSelectData.data)