PC租房全局化-还没

This commit is contained in:
A1300399510
2024-03-19 19:20:26 +08:00
parent be52dede90
commit 7e5d459302
8 changed files with 212 additions and 154 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div class="dis-f jus-x al-item" style="position: relative; z-index: 333;">
<div class="body-maxWidth" :class="{seachPage: !props.seachPage}">
<div class="body-maxWidth" :class="{ seachPage: !props.seachPage }">
<div class="s-w-100 seach-box-bg">
<div class="seach-box">
<div class="top-seach dis-f al-item" v-if="props.seachPage">
@@ -15,7 +15,7 @@
<div class="flexacenter seek-input">
<el-popover v-model:visible="historyShow" placement="bottom" :width="560" trigger="click" :show-arrow="false" popper-style="background: transparent;padding:0;box-shadow: none;border: none;transform: translateX(50px);">
<template #reference>
<el-input class="search-input " v-model="pitchValue['keyword']" placeholder="搜索房源或输入房源ID" @keyup.enter="handleKeyword(pitchValue['keyword'])" style="height: 40px; width: 460px;" maxlength="15"></el-input>
<el-input class="search-input" v-model="pitchValue['keyword']" placeholder="搜索房源或输入房源ID" @keyup.enter="handleKeyword(pitchValue['keyword'])" style="height: 40px; width: 460px;" maxlength="15"></el-input>
</template>
<div class="dis-f al-item pos-r">
<div class="seach-hiosory-box scrollbar">
@@ -87,13 +87,13 @@
<img class="triangle" src="@/assets/img/publicImage/triangle-black.svg" />
</div>
<div class="option-area flexflex" :class="{'option-area-unfold': state == 'unfold'}">
<div class="option-area flexflex" :class="{ 'option-area-unfold': state == 'unfold' }">
<div class="option-left">
<div class="option-item flexflex">
<div class="option-title">学校附近</div>
<div class="option-box flexflex flex1">
<div class="item flexcenter" :class="{pitch: 0 == pitchValue['school']}" @click="selectOption('nearSchool', 0)">不限</div>
<div class="item flexcenter" v-for="item in nearSchoolList" :class="{pitch: item['id'] == pitchValue['school']}" @click="selectOption('nearSchool', item.id)">{{ item["name"] }}</div>
<div class="item flexcenter" :class="{ pitch: 0 == pitchValue['school'] }" @click="selectOption('nearSchool', 0)">不限</div>
<div class="item flexcenter" v-for="item in nearSchoolList" :class="{ pitch: item['id'] == pitchValue['school'] }" @click="selectOption('nearSchool', item.id)">{{ item["name"] }}</div>
</div>
</div>
<div class="option-item flexflex">
@@ -111,8 +111,8 @@
<div class="option-item flexflex">
<div class="option-title">房型</div>
<div class="option-box flexflex flex1">
<div class="item flexcenter" :class="{pitch: 0 == pitchValue['roomtype']}" @click="selectOption('roomType', 0)">不限</div>
<div class="item flexcenter" :class="{pitch: item['id'] == pitchValue['roomtype']}" v-for="item in roomTypeList" @click="selectOption('roomType', item.id)">{{ item["name"] }}</div>
<div class="item flexcenter" :class="{ pitch: 0 == pitchValue['roomtype'] }" @click="selectOption('roomType', 0)">不限</div>
<div class="item flexcenter" :class="{ pitch: item['id'] == pitchValue['roomtype'] }" v-for="item in roomTypeList" @click="selectOption('roomType', item.id)">{{ item["name"] }}</div>
</div>
</div>
</div>
@@ -121,8 +121,8 @@
<div class="option-item flexflex">
<div class="option-title">品牌</div>
<div class="option-box flexflex flex1">
<div class="item flexcenter" :class="{pitch: 0 == pitchValue['companyid']}" @click="selectOption('brand', 0)">不限</div>
<div class="item flexcenter" :class="{pitch: item['id'] == pitchValue['companyid']}" v-for="item in brandList" @click="selectOption('brand', item.id)">
<div class="item flexcenter" :class="{ pitch: 0 == pitchValue['companyid'] }" @click="selectOption('brand', 0)">不限</div>
<div class="item flexcenter" :class="{ pitch: item['id'] == pitchValue['companyid'] }" v-for="item in brandList" @click="selectOption('brand', item.id)">
{{ item["name"] }}
</div>
</div>
@@ -130,8 +130,8 @@
<div class="option-item flexflex">
<div class="option-title">楼型</div>
<div class="option-box flexflex flex1">
<div class="item flexcenter" :class="{pitch: 0 == pitchValue['roomlistings']}" @click="selectOption('roomlistings', 0)">不限</div>
<div class="item flexcenter" :class="{pitch: item['id'] == pitchValue['roomlistings']}" v-for="item in roomlistingsList" @click="selectOption('roomlistings', item.id)">
<div class="item flexcenter" :class="{ pitch: 0 == pitchValue['roomlistings'] }" @click="selectOption('roomlistings', 0)">不限</div>
<div class="item flexcenter" :class="{ pitch: item['id'] == pitchValue['roomlistings'] }" v-for="item in roomlistingsList" @click="selectOption('roomlistings', item.id)">
{{ item["name"] }}
</div>
</div>
@@ -154,14 +154,14 @@
</template>
<script setup>
import {ref, toRefs, watchEffect, reactive, defineProps, nextTick} from "vue"
import {useStore} from "vuex"
import { ref, toRefs, computed, watchEffect, reactive, defineProps, nextTick } from "vue"
import { useStore } from "vuex"
import store from "../../store/index"
import {useRoute, useRouter} from "vue-router"
import { useRoute, useRouter } from "vue-router"
import choosingIdentity from "@/components/edit/choosingIdentity.vue"
const usestore = useStore()
const {wechat} = toRefs(usestore.state)
const { wechat } = toRefs(usestore.state)
const router = useRouter()
const route = useRoute()
@@ -175,6 +175,9 @@ const props = defineProps({
type: Boolean,
default: true,
},
initPitchValue: {
type: Object,
},
})
const emit = defineEmits(["handleTransfer"])
@@ -186,27 +189,19 @@ let historyShow = ref(false)
let setHistoryShow = () => (historyShow.value = historyShow.value) // 修改历史记录框的显示状态 通过input的 焦点状态判断的
let historyArr = ref([]) //历史查找记录
let hotArr = reactive({data: []})
let hotArr = reactive({ data: [] })
//获取历史搜索记录
historyArr.value = JSON.parse(localStorage.getItem("historyArr")) || []
let nearSchoolList = reactive([{name: "不限", id: 0}]) //学校附近
let nearSchoolList = reactive([{ name: "不限", id: 0 }]) //学校附近
let roomTypeList = reactive([]) // 房型
let roomlistingsList = reactive([]) // 楼型
let brandList = reactive([]) // 品牌数据
watchEffect(() => {
nearSchoolList = store.state.apartment.school || []
roomTypeList = store.state.apartment.roomtype || []
roomlistingsList = store.state.apartment.roomlistings || []
brandList = store.state.apartment.brand || []
hotArr.data = store.state.indexData.hotSearcheWords
})
// 筛选条件
let pitchValue = ref({
companyid: 0,
roomtype: 0,
@@ -217,6 +212,15 @@ let pitchValue = ref({
keyword: "",
})
watchEffect(() => {
nearSchoolList = store.state.apartment.school || []
roomTypeList = store.state.apartment.roomtype || []
roomlistingsList = store.state.apartment.roomlistings || []
brandList = store.state.apartment.brand || []
hotArr.data = store.state.indexData.hotSearcheWords
pitchValue.value = { ...pitchValue.value, ...props.initPitchValue }
})
if (route.query["companyid"]) {
pitchValue.value["companyid"] = route.query["companyid"]
state.value = "unfold"