重写筛选组件
This commit is contained in:
@@ -153,7 +153,6 @@ onMounted(() => {
|
|||||||
// seachAllType = {...seachAllType, ...pitchValue}
|
// seachAllType = {...seachAllType, ...pitchValue}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
//获取区域下列数据
|
//获取区域下列数据
|
||||||
let getLocationData = data => {
|
let getLocationData = data => {
|
||||||
for (let item in data) {
|
for (let item in data) {
|
||||||
@@ -212,13 +211,15 @@ let setLocation = (type, data, isupdate = true) => {
|
|||||||
|
|
||||||
//设置搜索数据 type: 类型 data: 数据 second: 二级数据
|
//设置搜索数据 type: 类型 data: 数据 second: 二级数据
|
||||||
let setSeachConditions = (type, data, second = null) => {
|
let setSeachConditions = (type, data, second = null) => {
|
||||||
console.log("赋值前的数据:",seachAllType);
|
console.log("赋值前的数据:", seachAllType)
|
||||||
if (type === "rent") {
|
if (type === "rent") {
|
||||||
seachAllType["rent_min"] = data.min
|
seachAllType["rent_min"] = data.min
|
||||||
seachAllType["rent_max"] = data.max
|
seachAllType["rent_max"] = data.max
|
||||||
} else if (type !== "") { // 这里是正常的数据 直接赋值
|
} else if (type !== "") {
|
||||||
|
// 这里是正常的数据 直接赋值
|
||||||
seachAllType[type] = data
|
seachAllType[type] = data
|
||||||
} else if (type === "") { // 电梯 阳台 认证 那些是传数组的
|
} else if (type === "") {
|
||||||
|
// 电梯 阳台 认证 那些是传数组的
|
||||||
data.indexOf("isintermediary") !== -1 ? (seachAllType["isintermediary"] = 1) : (seachAllType["isintermediary"] = 0)
|
data.indexOf("isintermediary") !== -1 ? (seachAllType["isintermediary"] = 1) : (seachAllType["isintermediary"] = 0)
|
||||||
data.indexOf("isverified") !== -1 ? (seachAllType["isverified"] = 1) : (seachAllType["isverified"] = 0)
|
data.indexOf("isverified") !== -1 ? (seachAllType["isverified"] = 1) : (seachAllType["isverified"] = 0)
|
||||||
data.indexOf("iselevator") !== -1 ? (seachAllType["iselevator"] = 1) : (seachAllType["iselevator"] = 0)
|
data.indexOf("iselevator") !== -1 ? (seachAllType["iselevator"] = 1) : (seachAllType["iselevator"] = 0)
|
||||||
@@ -231,8 +232,8 @@ let setSeachConditions = (type, data, second = null) => {
|
|||||||
if (second) {
|
if (second) {
|
||||||
seachAllType[second.type] = second.id
|
seachAllType[second.type] = second.id
|
||||||
}
|
}
|
||||||
console.log(type, data, second);
|
console.log(type, data, second)
|
||||||
console.log("保存前的处理数据:", seachAllType);
|
console.log("保存前的处理数据:", seachAllType)
|
||||||
|
|
||||||
getDataList(seachAllType)
|
getDataList(seachAllType)
|
||||||
}
|
}
|
||||||
|
|||||||
1308
src/components/seachModule/seachModule1.vue
Normal file
1308
src/components/seachModule/seachModule1.vue
Normal file
File diff suppressed because it is too large
Load Diff
130
src/main.js
130
src/main.js
@@ -1,51 +1,49 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from "vue"
|
||||||
import App from './App.vue'
|
import App from "./App.vue"
|
||||||
import router from './router'
|
import router from "./router"
|
||||||
import store from './store'
|
import store from "./store"
|
||||||
// import ElementPlus from 'element-plus'
|
// import ElementPlus from 'element-plus'
|
||||||
// import { ElButton, ElInput } from 'element-plus'
|
// import { ElButton, ElInput } from 'element-plus'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ElButton,
|
ElButton,
|
||||||
ElInput,
|
ElInput,
|
||||||
ElSelect,
|
ElSelect,
|
||||||
ElOption,
|
ElOption,
|
||||||
ElLoading,
|
ElLoading,
|
||||||
ElCheckbox,
|
ElCheckbox,
|
||||||
ElCheckboxGroup,
|
ElCheckboxGroup,
|
||||||
ElCarousel,
|
ElCarousel,
|
||||||
ElCarouselItem,
|
ElCarouselItem,
|
||||||
ElBadge,
|
ElBadge,
|
||||||
ElDropdown,
|
ElDropdown,
|
||||||
ElPopover,
|
ElPopover,
|
||||||
ElDatePicker,
|
ElDatePicker,
|
||||||
ElMessage,
|
ElMessage,
|
||||||
ElSkeleton,
|
ElSkeleton,
|
||||||
ElSkeletonItem,
|
ElSkeletonItem,
|
||||||
ElBreadcrumb,
|
ElBreadcrumb,
|
||||||
ElAffix,
|
ElAffix,
|
||||||
ElConfigProvider,
|
ElConfigProvider,
|
||||||
ElProgress,
|
ElProgress,
|
||||||
ElScrollbar
|
ElScrollbar,
|
||||||
// 其他需要的组件
|
// 其他需要的组件
|
||||||
} from 'element-plus'
|
} from "element-plus"
|
||||||
|
|
||||||
import 'element-plus/theme-chalk/index.css'
|
import "element-plus/theme-chalk/index.css"
|
||||||
import 'element-plus/dist/index.css'
|
import "element-plus/dist/index.css"
|
||||||
import 'element-plus/theme-chalk/index.css'
|
import "element-plus/theme-chalk/index.css"
|
||||||
import locale from 'element-plus/lib/locale/lang/zh-cn';
|
import locale from "element-plus/lib/locale/lang/zh-cn"
|
||||||
|
|
||||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
import zhCn from "element-plus/dist/locale/zh-cn.mjs"
|
||||||
|
|
||||||
import lazyPlugin from 'vue3-lazyload'
|
|
||||||
|
|
||||||
|
import lazyPlugin from "vue3-lazyload"
|
||||||
|
|
||||||
// import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
// import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
||||||
import api from "./utils/api";
|
import api from "./utils/api"
|
||||||
|
|
||||||
//引入封装Axios请求
|
//引入封装Axios请求
|
||||||
import Axios from '@/utils/axios';
|
import Axios from "@/utils/axios"
|
||||||
|
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
@@ -62,7 +60,7 @@ app.use(ElBadge)
|
|||||||
app.use(ElDropdown)
|
app.use(ElDropdown)
|
||||||
app.use(ElPopover)
|
app.use(ElPopover)
|
||||||
app.use(ElDatePicker, {
|
app.use(ElDatePicker, {
|
||||||
locale: zhCn
|
locale: zhCn,
|
||||||
})
|
})
|
||||||
app.use(ElSkeleton)
|
app.use(ElSkeleton)
|
||||||
app.use(ElSkeletonItem)
|
app.use(ElSkeletonItem)
|
||||||
@@ -78,16 +76,46 @@ app.use(lazyPlugin)
|
|||||||
|
|
||||||
app.use(store).use(router).use(Axios)
|
app.use(store).use(router).use(Axios)
|
||||||
|
|
||||||
api.index().then(res => {
|
api.index()
|
||||||
store.state.seachTypeData = res.data.combination
|
.then(res => {
|
||||||
store.state.indexData = res.data
|
store.state.seachTypeData = res.data.combination
|
||||||
store.state.ListSelectBtn = res.data.recommendedTab
|
store.state.indexData = res.data
|
||||||
store.state.user = res.data.user
|
store.state.ListSelectBtn = res.data.recommendedTab
|
||||||
store.state.nav = res.data.nav
|
store.state.user = res.data.user
|
||||||
store.state.wechat = res.data.wechat
|
store.state.nav = res.data.nav
|
||||||
store.state.apartment = res.data.config.apartment
|
store.state.wechat = res.data.wechat
|
||||||
store.state.schoolList = res.data.schoolList
|
store.state.apartment = res.data.config.apartment
|
||||||
store.state.advData = res.data.adv
|
store.state.schoolList = res.data.schoolList
|
||||||
}).finally(() => {
|
store.state.advData = res.data.adv
|
||||||
app.mount('#app')
|
store.state.typeKey = res.data.config.type
|
||||||
})
|
|
||||||
|
// 将 location 转换为对象 好用于级联选择器
|
||||||
|
const location = res.data.config.location || {}
|
||||||
|
const type = res.data.config.type || {}
|
||||||
|
|
||||||
|
store.state.locationObj = optimalValue(location)
|
||||||
|
store.state.typeObj = optimalValue(type)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
app.mount("#app")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 优化值
|
||||||
|
const optimalValue = data => {
|
||||||
|
let obj = {}
|
||||||
|
for (const key in data) {
|
||||||
|
const [parentKey, childKey] = key.split(".")
|
||||||
|
|
||||||
|
if (!childKey) {
|
||||||
|
obj[parentKey] = {
|
||||||
|
name: data[key],
|
||||||
|
children: {},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!obj[parentKey].children) obj[parentKey].children = {}
|
||||||
|
obj[parentKey].children[key] = data[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj || {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export default createStore({
|
|||||||
apartmentPitchValue: {}, // 公寓筛选的值 全局化
|
apartmentPitchValue: {}, // 公寓筛选的值 全局化
|
||||||
needPitchValue: {}, // 求房源筛选的值 全局化
|
needPitchValue: {}, // 求房源筛选的值 全局化
|
||||||
personPitchValue: {}, // 个人筛选的值 全局化
|
personPitchValue: {}, // 个人筛选的值 全局化
|
||||||
|
locationObj: {}, // 地区数据
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, onMounted, ref, provide, onBeforeUnmount, nextTick } from "vue"
|
import { reactive, onMounted, ref, provide, onBeforeUnmount, nextTick } from "vue"
|
||||||
import pageTopBar from "../../components/pageTopBar/pageTopBar.vue"
|
import pageTopBar from "../../components/pageTopBar/pageTopBar.vue"
|
||||||
import seachModule from "../../components/seachModule/seachModule.vue"
|
import seachModule from "../../components/seachModule/seachModule1.vue"
|
||||||
import biserialItem from "../../components/biserialListItem/biserialListItem.vue"
|
import biserialItem from "../../components/biserialListItem/biserialListItem.vue"
|
||||||
import listBtmPrompt from "../../components/public/have-questions.vue"
|
import listBtmPrompt from "../../components/public/have-questions.vue"
|
||||||
import noList from "../../components/public/empty-duck.vue"
|
import noList from "../../components/public/empty-duck.vue"
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import footerTool from '@/components/footer/footer.vue'
|
|||||||
import loadMoreText from '../../components/loadMore/loadMoreText.vue'
|
import loadMoreText from '../../components/loadMore/loadMoreText.vue'
|
||||||
import backToTop from '@/components/public/backToTop.vue'
|
import backToTop from '@/components/public/backToTop.vue'
|
||||||
import Masonry from 'masonry-layout';
|
import Masonry from 'masonry-layout';
|
||||||
|
import store from "../../store/index"
|
||||||
|
|
||||||
//路由
|
//路由
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
Reference in New Issue
Block a user