|
@@ -3,13 +3,13 @@
|
|
<div class="default-width">
|
|
<div class="default-width">
|
|
<div class="py-3" style="z-index: 998; background-color: #fff">
|
|
<div class="py-3" style="z-index: 998; background-color: #fff">
|
|
<div class="stickyBox">
|
|
<div class="stickyBox">
|
|
- <headSearch
|
|
|
|
- @handleJobClick="val => dealParams(val, 'positionId')"
|
|
|
|
|
|
+ <headSearch
|
|
|
|
+ text="中国"
|
|
@handleSearch="val => dealParams(val, 'content')"
|
|
@handleSearch="val => dealParams(val, 'content')"
|
|
></headSearch>
|
|
></headSearch>
|
|
</div>
|
|
</div>
|
|
- <cityFilter class="mx-5 mb-3" ref="cityFilterRef" @updateCheckedInput="handleMounted"></cityFilter>
|
|
|
|
- <conditionFilter class="mx-5 mb-3" ref="conditionFilterRef" @conditionFilterChange="handleMounted"></conditionFilter>
|
|
|
|
|
|
+ <cityFilter class="mx-5 mb-3" ref="cityFilterRef" @change="handleMounted"></cityFilter>
|
|
|
|
+ <conditionFilter class="mx-5 mb-3" ref="conditionFilterRef" @change="handleMounted"></conditionFilter>
|
|
</div>
|
|
</div>
|
|
<div class="d-flex mt-3">
|
|
<div class="d-flex mt-3">
|
|
<div class="mr-3" style="min-width: 884px;">
|
|
<div class="mr-3" style="min-width: 884px;">
|
|
@@ -49,6 +49,7 @@ const pageInfo = { pageNo: 1, pageSize: 20}
|
|
const items = ref([])
|
|
const items = ref([])
|
|
const total = ref(0)
|
|
const total = ref(0)
|
|
const routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
|
|
const routeQuery = (route?.query && route.query && Object.keys(route?.query).length) ? route.query : null
|
|
|
|
+const testQuery = (route?.query && route.query && Object.keys(route?.query).length) ? reactive(route.query) : reactive({})
|
|
provide('routeQuery', routeQuery)
|
|
provide('routeQuery', routeQuery)
|
|
|
|
|
|
let pageReqVO = reactive({
|
|
let pageReqVO = reactive({
|
|
@@ -66,53 +67,69 @@ const getPositionList = async () => {
|
|
total.value = number
|
|
total.value = number
|
|
}
|
|
}
|
|
|
|
|
|
-const removeEmptyStringsAndReturnNew = (obj) => {
|
|
|
|
- const result = {}
|
|
|
|
- Object.keys(obj).forEach(function(key) {
|
|
|
|
- if (obj[key]) {
|
|
|
|
- result[key] = obj[key]
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return result
|
|
|
|
-}
|
|
|
|
-const updateRouteQuery = (val, key) => {
|
|
|
|
- const queryObj = { cityFilter: {}, conditionFilter: {} }
|
|
|
|
- if (cityFilterRef.value?.getQuery) {
|
|
|
|
- queryObj.cityFilter = removeEmptyStringsAndReturnNew(cityFilterRef.value?.getQuery())
|
|
|
|
- }
|
|
|
|
- if (conditionFilterRef.value?.getQuery) {
|
|
|
|
- const objData = conditionFilterRef.value?.getQuery()
|
|
|
|
- if (val && key) objData[key] = val
|
|
|
|
- queryObj.conditionFilter = removeEmptyStringsAndReturnNew(objData)
|
|
|
|
- }
|
|
|
|
- let queryArr = []
|
|
|
|
- if (queryObj) {
|
|
|
|
- Object.keys(queryObj)?.forEach(_k => {
|
|
|
|
- const newObj = queryObj[_k]
|
|
|
|
- if (newObj) {
|
|
|
|
- const arr = Object.keys(newObj).map(itemKey => {
|
|
|
|
- return `${itemKey}=${newObj[itemKey]}`
|
|
|
|
- })
|
|
|
|
- if (arr?.length) queryArr = [ ...queryArr, ...arr]
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- const str = queryArr?.join('&')
|
|
|
|
- if (str) router.push(`${route.path}?${str}`)
|
|
|
|
- handleSearchPosition(val, key)
|
|
|
|
|
|
+// const removeEmptyStringsAndReturnNew = (obj) => {
|
|
|
|
+// const result = {}
|
|
|
|
+// Object.keys(obj).forEach(function(key) {
|
|
|
|
+// if (obj[key]) {
|
|
|
|
+// result[key] = obj[key]
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// return result
|
|
|
|
+// }
|
|
|
|
+// const updateRouteQuery = (val, key) => {
|
|
|
|
+// const queryObj = { cityFilter: {}, conditionFilter: {} }
|
|
|
|
+// if (cityFilterRef.value?.getQuery) {
|
|
|
|
+// queryObj.cityFilter = removeEmptyStringsAndReturnNew(cityFilterRef.value?.getQuery())
|
|
|
|
+// }
|
|
|
|
+// if (conditionFilterRef.value?.getQuery) {
|
|
|
|
+// const objData = conditionFilterRef.value?.getQuery()
|
|
|
|
+// if (val && key) objData[key] = val
|
|
|
|
+// queryObj.conditionFilter = removeEmptyStringsAndReturnNew(objData)
|
|
|
|
+// }
|
|
|
|
+// let queryArr = []
|
|
|
|
+// if (queryObj) {
|
|
|
|
+// Object.keys(queryObj)?.forEach(_k => {
|
|
|
|
+// const newObj = queryObj[_k]
|
|
|
|
+// if (newObj) {
|
|
|
|
+// const arr = Object.keys(newObj).map(itemKey => {
|
|
|
|
+// return `${itemKey}=${newObj[itemKey]}`
|
|
|
|
+// })
|
|
|
|
+// if (arr?.length) queryArr = [ ...queryArr, ...arr]
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// }
|
|
|
|
+// const str = queryArr?.join('&')
|
|
|
|
+// if (str) router.push(`${route.path}?${str}`)
|
|
|
|
+// handleSearchPosition(val, key)
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// 刷新路由
|
|
|
|
+const updateRouter = () => {
|
|
|
|
+ const str = Object.keys(testQuery).length ? Object.keys(testQuery).reduce((res, _key) => {
|
|
|
|
+ res += `${res ? '&' : ''}${_key}=${testQuery[_key]}`
|
|
|
|
+ return res
|
|
|
|
+ }, '') : ''
|
|
|
|
+ console.log('{route.path}?${str}->str', str)
|
|
|
|
+ router.push(`${route.path}?${str}`)
|
|
|
|
+ handleSearchPosition()
|
|
}
|
|
}
|
|
|
|
|
|
-const handleMounted = (key, val) => {
|
|
|
|
|
|
+const handleMounted = (key, val) => { // val为字符串
|
|
|
|
+ testQuery[key] = val
|
|
|
|
+ // console.log('testQuery', key, val)
|
|
|
|
+ updateRouter()
|
|
|
|
+ //
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
- updateRouteQuery(key, val)
|
|
|
|
|
|
+ // updateRouteQuery(val, key)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
// 职位搜索
|
|
// 职位搜索
|
|
const handleSearchPosition = () => {
|
|
const handleSearchPosition = () => {
|
|
- const conditionParams = conditionFilterRef.value?.params
|
|
|
|
- const cityParams = cityFilterRef.value?.getQuery
|
|
|
|
- pageReqVO = { ...pageReqVO, ...conditionParams, ...cityParams, content: pageReqVO.content }
|
|
|
|
|
|
+ // const conditionParams = conditionFilterRef.value?.params
|
|
|
|
+ // const cityParams = cityFilterRef.value?.getQuery
|
|
|
|
+ // pageReqVO = { ...pageReqVO, ...conditionParams, ...cityParams, content: pageReqVO.content }
|
|
|
|
+ pageReqVO = { ...pageReqVO }
|
|
getPositionList()
|
|
getPositionList()
|
|
}
|
|
}
|
|
|
|
|