详情顶部导航跳转
This commit is contained in:
parent
44d99b26ce
commit
77b5e5e6aa
@ -146,9 +146,9 @@ let loadFinish = () => {
|
||||
}
|
||||
|
||||
//监听路由
|
||||
const route = useRoute()
|
||||
const route = useRouter()
|
||||
let routePath = ref('')
|
||||
routePath.value = route.path
|
||||
routePath.value = route.currentRoute.value.meta.path
|
||||
//地区数据
|
||||
let location = reactive({ data: {} })
|
||||
location.data = store.state.indexData && store.state.indexData.config && store.state.indexData.config.location
|
||||
|
@ -133,8 +133,8 @@ let openInfo = (data) => {
|
||||
//监听路由
|
||||
const route = useRoute()
|
||||
let routePath = ref('')
|
||||
routePath.value = route.path
|
||||
tabBtnType.value = route.path
|
||||
routePath.value = route.meta.path
|
||||
tabBtnType.value = route.meta.path
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
|
@ -142,8 +142,7 @@ let getLocationData = (data) => {
|
||||
//监听路由
|
||||
const route = useRouter()
|
||||
let routePath = ref('')
|
||||
routePath.value = route.currentRoute.value.path
|
||||
// console.log(route)
|
||||
routePath.value = route.currentRoute.value.meta.path
|
||||
|
||||
watchEffect(() => {
|
||||
seachSchoolBtn.data = store.state.seachTypeData[0] ? store.state.seachTypeData[0].where : []
|
||||
@ -174,18 +173,6 @@ let seachList = (item) => {
|
||||
houseingPageType:routePath.value === '/needHousing'?6:routePath.value === '/intermediaryHousing'?1:routePath.value === '/personHousing'?0:0
|
||||
}
|
||||
})
|
||||
// if (routePath.value === '/') {
|
||||
// route.push({
|
||||
// path: '/seachPage',
|
||||
// query: {
|
||||
// keyword: seachAllType.keyword
|
||||
// }
|
||||
// })
|
||||
// }else{
|
||||
// setSeachConditions()
|
||||
// }
|
||||
|
||||
// getDataList(seachAllType)
|
||||
}
|
||||
|
||||
//设置搜索数据
|
||||
@ -227,7 +214,7 @@ let setHotSeach = (item) => {
|
||||
|
||||
//点击选项
|
||||
let checkBtn = (data, type, areaItem) => {
|
||||
console.log(data, type, areaItem)
|
||||
// console.log(data, type, areaItem)
|
||||
getDataList(type, data, areaItem)
|
||||
}
|
||||
|
||||
|
@ -265,10 +265,10 @@ let configData = reactive({ data: {} })
|
||||
const route = useRouter()
|
||||
let routePath = ref('')
|
||||
let routeQuery = reactive({ data: {} })
|
||||
routePath.value = route.currentRoute.value.path
|
||||
if(route.currentRoute.value.params.type){
|
||||
routePath.value = route.currentRoute.value.meta.path
|
||||
if (route.currentRoute.value.params.type) {
|
||||
routeQuery.data = route.currentRoute.value.params
|
||||
}else{
|
||||
} else {
|
||||
routeQuery.data = route.currentRoute.value.query
|
||||
}
|
||||
const { proxy } = getCurrentInstance()
|
||||
@ -575,6 +575,7 @@ let cleanSelect = () => {
|
||||
//根据路由设置参数
|
||||
let setRouterQuerySet = ref(true)
|
||||
let routerQuerySet = () => {
|
||||
console.log(123, routeQuery)
|
||||
if (!setRouterQuerySet.value) return
|
||||
//路由参数设置
|
||||
if ((routeQuery.data && routeQuery.data.houseingPageType === '1') || (routePath.value === '/intermediaryHousing')) {
|
||||
@ -595,11 +596,20 @@ let routerQuerySet = () => {
|
||||
hireTypeObj.title = data.name
|
||||
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
|
||||
} else if (routeQuery.data.type === 'location') {
|
||||
let areaItem = JSON.parse(routeQuery.data.areaItem)
|
||||
selectTabCheck.id = areaItem.id;
|
||||
let areaItem = routeQuery.data.areaItem?JSON.parse(routeQuery.data.areaItem):''
|
||||
selectTabCheck.id = areaItem.id * 1;
|
||||
selectTabCheck.title = areaItem.name
|
||||
selectTabCheck.data = list[areaItem.id].data;
|
||||
selectData.data = seachAreaId(data)
|
||||
console.log(selectData.data.length)
|
||||
if (routeQuery.data.types) {
|
||||
let types = JSON.parse(routeQuery.data.types)
|
||||
let {data} = types
|
||||
let type = data.id.toString().substring(0, 1)
|
||||
hireTypeObj.id = selectData.data.length==0?'':data.id
|
||||
hireTypeObj.title =selectData.data.length==0?'':data.name
|
||||
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
|
||||
}
|
||||
setCheckBoxData(data)//设置地区选项
|
||||
}
|
||||
}
|
||||
@ -612,7 +622,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)
|
||||
console.log('route', route)
|
||||
if (setRouterQuerySet.value) {
|
||||
setRegionList()//设置地区数据
|
||||
setSchoolData()//设置学校数据
|
||||
|
@ -9,7 +9,8 @@ const routes = [
|
||||
name: 'home',
|
||||
component: HomeView,
|
||||
meta: {
|
||||
title: "首页"
|
||||
title: "首页",
|
||||
path:'/'
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -46,38 +47,43 @@ const routes = [
|
||||
}
|
||||
},
|
||||
{//个人房源
|
||||
path: '/personHousing/:type?/:data?/:areaItem?',
|
||||
path: '/personHousing/:type?/:data?/:areaItem?/:types?',
|
||||
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/person.vue'),
|
||||
meta: {
|
||||
title: '个人房源'
|
||||
title: '个人房源',
|
||||
path:'/personHousing'
|
||||
}
|
||||
},
|
||||
{//中介房源
|
||||
path: '/intermediaryHousing',
|
||||
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/intermediary.vue'),
|
||||
meta: {
|
||||
title: '中介房源'
|
||||
title: '中介房源',
|
||||
path:'/intermediaryHousing'
|
||||
}
|
||||
},
|
||||
{//求房源
|
||||
path: '/needHousing',
|
||||
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/needHousing.vue'),
|
||||
meta: {
|
||||
title: '求房源'
|
||||
title: '求房源',
|
||||
path:'/needHousing'
|
||||
}
|
||||
},
|
||||
{//搜索
|
||||
path: '/seachPage',
|
||||
component: () => import(/* webpackChunkName: "seachPage" */ '@/views/seachIndex.vue'),
|
||||
meta: {
|
||||
title: '搜索'
|
||||
title: '搜索',
|
||||
path:'/seachPage'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/apartment",
|
||||
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/apartment.vue'),
|
||||
meta: {
|
||||
title: "品牌公寓"
|
||||
title: "品牌公寓",
|
||||
path:'/apartment'
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -104,10 +110,7 @@ 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==='/needHousing'?'/needHousing':
|
||||
from.path==='/intermediaryHousing'?'/intermediaryHousing':
|
||||
from.path==='/personHousing'?'/personHousing':
|
||||
from.path==='/seachPage'?'/seachPage':''
|
||||
store.state.routeList.secondaryIndex.path = from.meta.path
|
||||
}
|
||||
next()
|
||||
let meta = to['meta'] || {}
|
||||
|
@ -1107,14 +1107,14 @@ let setNavigation = () => {
|
||||
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}/location/${housingInfo['data']['info'].location.substring(0, 1)}`)
|
||||
console.log(`${store.state.routeList['secondaryIndex'].path}/location/${JSON.stringify([housingInfo['data']['info'].location.substring(0, 1)])}`)
|
||||
store.state.routeList['thirdIndex'] = {
|
||||
path: `${store.state.routeList['secondaryIndex'].path}/location/${housingInfo['data']['info'].location.substring(0, 1)}`,
|
||||
path: `${store.state.routeList['secondaryIndex'].path}/location/${JSON.stringify([housingInfo['data']['info'].location.substring(0, 1)])}/${JSON.stringify({id:housingInfo['data']['info'].location.substring(0, 1),name:location[housingInfo['data']['info'].location.substring(0, 1)]})}/${JSON.stringify({type:'types',data:{name:type[housingInfo['data']['info'].type.substring(0, 1)],id:housingInfo['data']['info'].type}})}`,
|
||||
title: `${location[housingInfo['data']['info'].location.substring(0, 1)]}${type[housingInfo['data']['info'].type.substring(0, 1)]}房源`
|
||||
}
|
||||
if (housingInfo['data']['info'].location.length > 0)
|
||||
store.state.routeList['fourthIndex'] = {
|
||||
path: "",
|
||||
path: `${store.state.routeList['secondaryIndex'].path}/location/${JSON.stringify([housingInfo['data']['info'].location.substring(0, 3)])}/${JSON.stringify({id:housingInfo['data']['info'].location.substring(0, 1),name:location[housingInfo['data']['info'].location.substring(0, 1)]})}/${JSON.stringify({type:'types',data:{name:type[housingInfo['data']['info'].type.substring(0, 3)],id:housingInfo['data']['info'].type}})}`,
|
||||
title: `${location[housingInfo['data']['info'].location]}${type[housingInfo['data']['info'].type]}`
|
||||
}
|
||||
}
|
||||
|
@ -143,20 +143,17 @@ let downLoadMore = () => {
|
||||
|
||||
//listImg
|
||||
onMounted(() => {
|
||||
console.log(123)
|
||||
let type=null,data=null
|
||||
console.log(router.currentRoute.value.params)
|
||||
if (router.currentRoute.value.params.type) {
|
||||
let { type, data } = router.currentRoute.value.params
|
||||
type=type
|
||||
data=data
|
||||
type=router.currentRoute.value.params.type
|
||||
data=router.currentRoute.value.params.data
|
||||
} else {
|
||||
let { type, data } = router.currentRoute.value.query
|
||||
type=type
|
||||
data=data
|
||||
type=router.currentRoute.value.query.type
|
||||
data=router.currentRoute.value.query.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 }
|
||||
|
Loading…
x
Reference in New Issue
Block a user