瀏覽代碼

fix:房屋bug

qiao 2 月之前
父節點
當前提交
a1a56e7edb

+ 4 - 3
src/pages/house/components/filters.vue

@@ -406,9 +406,10 @@ function onConfirmArea(value) {
         console.log('citieIds:',citieIds)
         citieIds.map(item=>ids.push(item.id))
     }else{
-        selectedOptions.map(item => {
-            if (item.id) ids.push(item.id)
-        })
+        // selectedOptions.map(item => {
+        //     if (item.id) ids.push(item.id)
+        // })
+        ids.push(cityId)
     }
     
     areaIds.value = ids.join(',')

+ 1 - 1
src/pages/house/newHouse/[id].vue

@@ -15,7 +15,7 @@
             <div class="text-[#434343] text-[18px] font-bold mb-3">{{ detailData?.houseTitle }}</div>
 
             <!-- 标题下方的标签 -->
-            <div class="flex flex-wrap text-[12px] mt-[14px]">
+            <div v-if="tags.length" class="flex flex-wrap text-[12px] mt-[14px]">
 
                 <div v-for="(item,index) in tags" :key="index" class="px-6 py-2 border border-[#666] text-[#666] rounded-full mr-8">{{ item }}</div>
                 

+ 4 - 5
src/pages/house/oldHouse/[id].vue

@@ -8,15 +8,15 @@
                         <img :src="img" class="w-full h-full object-cover" />
                     </SwiperSlide>
                 </Swiper>
-                <div v-if="detailData?.housingAtlasLst.length"
+                <div v-if="detailData?.housingAtlasLst?.length"
                     class="absolute rounded-full top-3 left-3 bg-black/50 text-white px-4 py-2 text-sm z-10">
-                    {{ currentIndex }}/{{ detailData?.housingAtlasLst.length }}
+                    {{ currentIndex }}/{{ detailData?.housingAtlasLst?.length }}
                 </div>
             </div>
             <div class="text-[#434343] text-[18px] font-bold mt-[14px]">{{ detailData?.tourHouseSaleInfoVo?.houseTitle }}
             </div>
 
-            <div class="flex flex-wrap text-[12px] mt-[14px]">
+            <div v-if="tags?.length" class="flex flex-wrap text-[12px] mt-[14px]">
                 <div v-for="(item, index) in tags" :key="index"
                     class="px-6 py-2 border border-[#666] text-[#666] rounded-full mr-8">{{ item }}</div>
             </div>
@@ -102,8 +102,7 @@
                 </div>
                 <div class="flex text-[#666] text-[14px] mt-[14px]">
                     <div class="w-[80px] font-bold shrink-0">发布日期</div>
-                    <span
-                        class="flex-1">{{ dayjs(detailData?.tourHouseSaleInfoVo?.releaseDate).format('YYYY-MM-DD') }}</span>
+                    <span v-if="detailData?.tourHouseSaleInfoVo?.releaseDate" class="flex-1">{{ dayjs(detailData?.tourHouseSaleInfoVo?.releaseDate).format('YYYY-MM-DD') }}</span>
                 </div>
                 <div class="flex text-[#666] text-[14px] mt-[14px]">
                     <div class="w-[80px] font-bold shrink-0">物业类型</div>

+ 63 - 28
src/pages/travel-notes/index.vue

@@ -94,7 +94,8 @@
 </template>
 
 <script setup>
-const router = useRoute()
+const route = useRoute()
+const router = useRouter()
 
 // 推荐项目
 const { data } = await useMyFetch(
@@ -126,22 +127,12 @@ async function getFilters() {
   const { data } = await request(`/website/tourism/projectTravelNotes/travelNotesDirectoryList`).finally(() => { closeToast() })
 
   if (!Array.isArray(data)) return getList()
-  const routerAreaId = null
+  let country = null;
   data.map((item, index) => {
     data[index].id = item.areaId
     data[index].text = item.areaName
-
-    // 处理地址栏带area参数的情况
-    if (router.query.area == item.areaId) {
-      curFilter.value.areaId = router.query.area
-      document.title = item.areaName
-      areaIndex.value = index + 1
-      curFilter.value.id = item.areaId + ',all'
-      areaFilterTitle.value = item.areaName
-    }
-
     if (Array.isArray(item.children)) {
-      data[index].children.unshift({ countryName: '全部', countryId: item.areaId + ',all' })
+      data[index].children.unshift({ countryName: '全部', countryId: item.areaId+',all' })
       item.children.map((item2, index2) => {
         data[index].children[index2].id = item2.countryId
         data[index].children[index2].text = item2.countryName
@@ -149,11 +140,43 @@ async function getFilters() {
         data[index].children[index2].areaName = item.areaName
       })
     }
+    
+    if(route.query.area && item.areaId == route.query.area){
+      curFilter.value.areaId = route.query.area
+      document.title = item.areaName
+      areaIndex.value = index + 1
+      areaFilterTitle.value = item.areaName
+    }
+
+    if(route.query.country){
+      const con = item.children.filter(c=>c.countryId == route.query.country)[0]
+      if(con){
+        country = con
+      }
+    }
   })
-  if (routerAreaId) {
+  if(country){
+    curFilter.value.countryId = route.query.country
+    curFilter.value.id = route.query.country
+    areaFilterTitle.value = country.areaName +'-'+country.countryName
+  }else{
+    if(curFilter.value.areaId){
+      curFilter.value.countryId = curFilter.value.areaId + ',all'
+      curFilter.value.id = curFilter.value.areaId + ',all'
+    }
+  }
+  if(route.query.country && !route.query.area){
+    data.map((item,index)=>{
+      item.children.map(subItem=>{
+        if(subItem.id == route.query.country){
+          areaIndex.value = index + 1
+        }
+      })
+    })
   }
   filterList.value = [{ id: 0, text: '全部', children: [{ id: 0, text: '全部' }] }, ...data]
   getList()
+  getRecommend()
 }
 
 // 监听地域筛选框收起
@@ -222,20 +245,32 @@ function handleAreaClick(index) {
 // 选择国家
 function handleFilterClick(item) {
   curFilter.value = item
-  if (!item.id) {
-    areaFilterTitle.value = AREA_TEXT
-  } else {
-    const areaText = filterList.value[areaIndex.value].text || ''
-    const cityText = item.text || ''
-    activeIndex.value = areaIndex.value
-    areaFilterTitle.value = areaText + '-' + cityText
+  // if (!item.id) {
+  //   areaFilterTitle.value = AREA_TEXT
+  // } else {
+  //   const areaText = filterList.value[areaIndex.value].text || ''
+  //   const cityText = item.text || ''
+  //   activeIndex.value = areaIndex.value
+  //   areaFilterTitle.value = areaText + '-' + cityText
+  // }
+  // pageNum.value = 1
+  // dataList.value = []
+  // getList()
+  // getRecommend()
+  // dropDownMenuRef.value && dropDownMenuRef.value.close()
+  // document.title = `${item.id ? '游记-' + item.areaName + '-' + item.text : '旅游笔记'}`
+  
+  let search =''
+  if(item.areaId) search+='area='+item.areaId
+  if(item.id) {
+    const i = item.countryId.split(',')
+    if(!i[1]){
+      search+=`${item.areaId?'&':''}country=${item.id}`
+    }
+    
   }
-  pageNum.value = 1
-  dataList.value = []
-  getList()
-  getRecommend()
-  dropDownMenuRef.value && dropDownMenuRef.value.close()
-  document.title = `${item.id ? '游记-' + item.areaName + '-' + item.text : '旅游笔记'}`
+  location.search=`${search}`
+  
 }
 
 function transferCount(num = 0) {
@@ -272,7 +307,7 @@ async function getRecommend(){
 }
 onMounted(async () => {
   getFilters()
-  getRecommend()
+  
 })
 
 useSeoMeta({