mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 23:47:54 +08:00
fix setFilterCondition related logic in start chat since website upgrade
This commit is contained in:
@@ -264,7 +264,7 @@ async function setFilterCondition (selectedFilters) {
|
|||||||
const placeholderText = placeholderTexts[i]
|
const placeholderText = placeholderTexts[i]
|
||||||
const filterDropdownProxy = await (async () => {
|
const filterDropdownProxy = await (async () => {
|
||||||
const jsHandle = (await page.evaluateHandle((placeholderText) => {
|
const jsHandle = (await page.evaluateHandle((placeholderText) => {
|
||||||
const filterBar = document.querySelector('.job-recommend-main .job-recommend-search')
|
const filterBar = document.querySelector('.page-jobs-main .filter-condition-inner')
|
||||||
const dropdownEntry = filterBar.__vue__.$children.find(it => it.placeholder === placeholderText)
|
const dropdownEntry = filterBar.__vue__.$children.find(it => it.placeholder === placeholderText)
|
||||||
return dropdownEntry.$el
|
return dropdownEntry.$el
|
||||||
}, placeholderText)).asElement();
|
}, placeholderText)).asElement();
|
||||||
@@ -289,18 +289,18 @@ async function setFilterCondition (selectedFilters) {
|
|||||||
const optionKaPrefix = optionKaPrefixes[i]
|
const optionKaPrefix = optionKaPrefixes[i]
|
||||||
if (!currentFilterConditions.length) {
|
if (!currentFilterConditions.length) {
|
||||||
if (placeholderText === '公司行业') {
|
if (placeholderText === '公司行业') {
|
||||||
const activeOptionElAtCurrentFilterProxyList = await page.$$(`.job-recommend-main .recommend-search-more .active[ka^="${optionKaPrefix}"]`)
|
const activeOptionElAtCurrentFilterProxyList = await page.$$(`.page-jobs-main .filter-condition-inner .active[ka^="${optionKaPrefix}"]`)
|
||||||
for (const it of activeOptionElAtCurrentFilterProxyList) {
|
for (const it of activeOptionElAtCurrentFilterProxyList) {
|
||||||
await it.click()
|
await it.click()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// select 不限 immediately
|
// select 不限 immediately
|
||||||
const buxianOptionElProxy = await page.$(`.job-recommend-main .recommend-search-more [ka="${optionKaPrefix}${0}"]`)
|
const buxianOptionElProxy = await page.$(`.page-jobs-main .filter-condition-inner [ka="${optionKaPrefix}${0}"]`)
|
||||||
await buxianOptionElProxy.click()
|
await buxianOptionElProxy.click()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//#region uncheck options perviously checked but not existed in current filter.
|
//#region uncheck options perviously checked but not existed in current filter.
|
||||||
const activeOptionElAtCurrentFilterProxyList = await page.$$(`.job-recommend-main .recommend-search-more .active[ka^="${optionKaPrefix}"]`)
|
const activeOptionElAtCurrentFilterProxyList = await page.$$(`.page-jobs-main .filter-condition-inner .active[ka^="${optionKaPrefix}"]`)
|
||||||
const activeOptionValues = (await Promise.all(
|
const activeOptionValues = (await Promise.all(
|
||||||
activeOptionElAtCurrentFilterProxyList.map(elProxy => {
|
activeOptionElAtCurrentFilterProxyList.map(elProxy => {
|
||||||
return elProxy.evaluate((el) => {
|
return elProxy.evaluate((el) => {
|
||||||
@@ -339,7 +339,7 @@ async function setFilterCondition (selectedFilters) {
|
|||||||
optionValue = conditionToCheck[j]
|
optionValue = conditionToCheck[j]
|
||||||
}
|
}
|
||||||
await sleepWithRandomDelay(500)
|
await sleepWithRandomDelay(500)
|
||||||
const optionElProxy = await page.$(`.job-recommend-main .recommend-search-more [ka="${optionKaPrefix}${optionValue}"]`)
|
const optionElProxy = await page.$(`.page-jobs-main .filter-condition-inner [ka="${optionKaPrefix}${optionValue}"]`)
|
||||||
if (!optionElProxy) {
|
if (!optionElProxy) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -520,7 +520,7 @@ async function toRecommendPage (hooks) {
|
|||||||
) {
|
) {
|
||||||
scrolledHeight += increase
|
scrolledHeight += increase
|
||||||
await page.mouse.wheel({deltaY: increase});
|
await page.mouse.wheel({deltaY: increase});
|
||||||
await sleep(1)
|
await sleep(100)
|
||||||
await requestNextPagePromiseWithResolver?.promise
|
await requestNextPagePromiseWithResolver?.promise
|
||||||
hasReachLastPage = await page.evaluate(`
|
hasReachLastPage = await page.evaluate(`
|
||||||
!(document.querySelector('.page-jobs-main')?.__vue__?.hasMore)
|
!(document.querySelector('.page-jobs-main')?.__vue__?.hasMore)
|
||||||
@@ -531,7 +531,7 @@ async function toRecommendPage (hooks) {
|
|||||||
}
|
}
|
||||||
requestNextPagePromiseWithResolver = null
|
requestNextPagePromiseWithResolver = null
|
||||||
|
|
||||||
await sleep(3000)
|
await sleep(5000)
|
||||||
jobListData = await page.evaluate(
|
jobListData = await page.evaluate(
|
||||||
`
|
`
|
||||||
document.querySelector('.page-jobs-main')?.__vue__?.jobList
|
document.querySelector('.page-jobs-main')?.__vue__?.jobList
|
||||||
@@ -747,7 +747,7 @@ async function toRecommendPage (hooks) {
|
|||||||
}
|
}
|
||||||
// for of reach terminal
|
// for of reach terminal
|
||||||
if (
|
if (
|
||||||
currentExceptJobIndex + 1 > expectJobList.length
|
currentExceptJobIndex + 1 >= expectJobList.length
|
||||||
) {
|
) {
|
||||||
hooks.noPositionFoundForCurrentJob?.call()
|
hooks.noPositionFoundForCurrentJob?.call()
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|||||||
Reference in New Issue
Block a user