|
@@ -175,8 +175,9 @@ const checkValue = (obj) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const type = ref('recommend')
|
|
const positionListData = ref([])
|
|
const positionListData = ref([])
|
|
-const query = reactive({
|
|
|
|
|
|
+const query = reactive({
|
|
pageSize: 20,
|
|
pageSize: 20,
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
hire: false,
|
|
hire: false,
|
|
@@ -192,10 +193,19 @@ const getData = async () => {
|
|
const { content, areaIds, industryIds, jobType, payScope, positionId } = query
|
|
const { content, areaIds, industryIds, jobType, payScope, positionId } = query
|
|
const hasValue = checkValue({ content, areaIds, industryIds, jobType, payScope, positionId })
|
|
const hasValue = checkValue({ content, areaIds, industryIds, jobType, payScope, positionId })
|
|
|
|
|
|
- // 带查询条件时返回到顶部
|
|
|
|
- if (hasValue) {
|
|
|
|
|
|
+ // 当前接口为推荐列表时,带查询条件需返回到列表顶部
|
|
|
|
+ if (hasValue && type.value === 'recommend') {
|
|
scrollTop.value = old.value.scrollTop
|
|
scrollTop.value = old.value.scrollTop
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
|
+ type.value = 'position'
|
|
|
|
+ scrollTop.value = 0
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 当前接口为只为列表时,清除查询条件需返回到列表顶部
|
|
|
|
+ if (!hasValue && type.value === 'position') {
|
|
|
|
+ scrollTop.value = old.value.scrollTop
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ type.value = 'recommend'
|
|
scrollTop.value = 0
|
|
scrollTop.value = 0
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -203,6 +213,7 @@ const getData = async () => {
|
|
// 带搜索条件(除分页外)用职位搜索接口,无条件则用推荐接口
|
|
// 带搜索条件(除分页外)用职位搜索接口,无条件则用推荐接口
|
|
const api = hasValue ? getJobAdvertisedSearch : getPromotedPosition
|
|
const api = hasValue ? getJobAdvertisedSearch : getPromotedPosition
|
|
const params = hasValue ? query : { pageSize: query.pageSize, pageNo: query.pageNo, hire: 0 }
|
|
const params = hasValue ? query : { pageSize: query.pageSize, pageNo: query.pageNo, hire: 0 }
|
|
|
|
+ type.value = hasValue ? 'position' : 'recommend'
|
|
try {
|
|
try {
|
|
const res = await api(params)
|
|
const res = await api(params)
|
|
const arr = res?.data?.list || []
|
|
const arr = res?.data?.list || []
|
|
@@ -253,7 +264,8 @@ const onSearch = () => {
|
|
getData()
|
|
getData()
|
|
}
|
|
}
|
|
|
|
|
|
-const loadingMore = () => { // 加载更多
|
|
|
|
|
|
+// 加载更多
|
|
|
|
+const loadingMore = () => {
|
|
more.value = 'loading'
|
|
more.value = 'loading'
|
|
query.pageNo++
|
|
query.pageNo++
|
|
getData()
|
|
getData()
|