mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-06 07:57:06 +08:00
Merge branch 'feature/add-city-filter-condition-constraint' into feature/ui
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
{
|
export default {
|
||||||
"code": 0,
|
"code": 0,
|
||||||
"message": "Success",
|
"message": "Success",
|
||||||
"zpData": {
|
"zpData": {
|
||||||
@@ -56,10 +56,11 @@ function combineWithZero(arr, min, max) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function* combineFiltersWithConstraintsGenerator(selectedFilters) {
|
export function* combineFiltersWithConstraintsGenerator(selectedFilters) {
|
||||||
const { salaryList, experienceList, degreeList, scaleList, industryList } =
|
const { cityList, salaryList, experienceList, degreeList, scaleList, industryList } =
|
||||||
selectedFilters;
|
selectedFilters;
|
||||||
|
|
||||||
// 生成符合限制条件的组合
|
// 生成符合限制条件的组合
|
||||||
|
const cityComb = combineWithZero(cityList, 0, 1) // Salary: 0-1 个
|
||||||
const salaryComb = combineWithZero(salaryList, 0, 1) // Salary: 0-1 个
|
const salaryComb = combineWithZero(salaryList, 0, 1) // Salary: 0-1 个
|
||||||
const experienceComb = combineWithZero(experienceList, 0, experienceList.length) // Experience: 0 个或更多
|
const experienceComb = combineWithZero(experienceList, 0, experienceList.length) // Experience: 0 个或更多
|
||||||
const degreeComb = combineWithZero(degreeList, 0, degreeList.length) // Degree: 0 个或更多
|
const degreeComb = combineWithZero(degreeList, 0, degreeList.length) // Degree: 0 个或更多
|
||||||
@@ -67,17 +68,20 @@ export function* combineFiltersWithConstraintsGenerator(selectedFilters) {
|
|||||||
const industryComb = combineWithZero(industryList, 0, 3) // Industry: 0-3 个
|
const industryComb = combineWithZero(industryList, 0, 3) // Industry: 0-3 个
|
||||||
|
|
||||||
// 通过迭代生成所有组合
|
// 通过迭代生成所有组合
|
||||||
for (const salary of salaryComb) {
|
for (const city of cityComb) {
|
||||||
for (const experience of experienceComb) {
|
for (const salary of salaryComb) {
|
||||||
for (const degree of degreeComb) {
|
for (const experience of experienceComb) {
|
||||||
for (const scale of scaleComb) {
|
for (const degree of degreeComb) {
|
||||||
for (const industry of industryComb) {
|
for (const scale of scaleComb) {
|
||||||
yield {
|
for (const industry of industryComb) {
|
||||||
salaryList: salary,
|
yield {
|
||||||
experienceList: experience,
|
cityList: city,
|
||||||
degreeList: degree,
|
salaryList: salary,
|
||||||
scaleList: scale,
|
experienceList: experience,
|
||||||
industryList: industry
|
degreeList: degree,
|
||||||
|
scaleList: scale,
|
||||||
|
industryList: industry
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,6 +96,7 @@ export function* combineFiltersWithConstraintsGenerator(selectedFilters) {
|
|||||||
// 计算符合限制条件的组合数量
|
// 计算符合限制条件的组合数量
|
||||||
export function calculateTotalCombinations(selectedFilters, includeEmptyCondition) {
|
export function calculateTotalCombinations(selectedFilters, includeEmptyCondition) {
|
||||||
const {
|
const {
|
||||||
|
cityList = [],
|
||||||
salaryList = [],
|
salaryList = [],
|
||||||
experienceList = [],
|
experienceList = [],
|
||||||
degreeList = [],
|
degreeList = [],
|
||||||
@@ -100,13 +105,14 @@ export function calculateTotalCombinations(selectedFilters, includeEmptyConditio
|
|||||||
} = selectedFilters
|
} = selectedFilters
|
||||||
|
|
||||||
// 生成符合限制条件的组合
|
// 生成符合限制条件的组合
|
||||||
|
const cityComb = combineWithZero(cityList, 0, 1) // City: 0-1 个
|
||||||
const salaryComb = combineWithZero(salaryList, 0, 1) // Salary: 0-1 个
|
const salaryComb = combineWithZero(salaryList, 0, 1) // Salary: 0-1 个
|
||||||
const experienceComb = combineWithZero(experienceList, 0, experienceList.length) // Experience: 0 个或更多
|
const experienceComb = combineWithZero(experienceList, 0, experienceList.length) // Experience: 0 个或更多
|
||||||
const degreeComb = combineWithZero(degreeList, 0, degreeList.length) // Degree: 0 个或更多
|
const degreeComb = combineWithZero(degreeList, 0, degreeList.length) // Degree: 0 个或更多
|
||||||
const scaleComb = combineWithZero(scaleList, 0, scaleList.length) // Scale: 0 个或更多
|
const scaleComb = combineWithZero(scaleList, 0, scaleList.length) // Scale: 0 个或更多
|
||||||
const industryComb = combineWithZero(industryList, 0, 3) // Industry: 0-3 个
|
const industryComb = combineWithZero(industryList, 0, 3) // Industry: 0-3 个
|
||||||
|
|
||||||
let result = [salaryComb, experienceComb, degreeComb, scaleComb, industryComb].reduce((accu, cur) => {
|
let result = [cityComb, salaryComb, experienceComb, degreeComb, scaleComb, industryComb].reduce((accu, cur) => {
|
||||||
return accu * cur.length
|
return accu * cur.length
|
||||||
}, 1)
|
}, 1)
|
||||||
if (!includeEmptyCondition) {
|
if (!includeEmptyCondition) {
|
||||||
@@ -146,6 +152,7 @@ export function formatStaticCombineFilters(rawStaticCombineRecommendJobFilterCon
|
|||||||
const conditions = Array.from(map.values())
|
const conditions = Array.from(map.values())
|
||||||
const result = conditions.map((condition) => {
|
const result = conditions.map((condition) => {
|
||||||
return {
|
return {
|
||||||
|
cityList: condition.city ? [condition.city] : [],
|
||||||
salaryList: condition.salary ? [condition.salary] : [],
|
salaryList: condition.salary ? [condition.salary] : [],
|
||||||
experienceList: condition.experience ? [condition.experience] : [],
|
experienceList: condition.experience ? [condition.experience] : [],
|
||||||
degreeList: condition.degree ? [condition.degree] : [],
|
degreeList: condition.degree ? [condition.degree] : [],
|
||||||
@@ -155,6 +162,7 @@ export function formatStaticCombineFilters(rawStaticCombineRecommendJobFilterCon
|
|||||||
})
|
})
|
||||||
if (!result.length) {
|
if (!result.length) {
|
||||||
result.push({
|
result.push({
|
||||||
|
cityList: [],
|
||||||
salaryList: [],
|
salaryList: [],
|
||||||
experienceList: [],
|
experienceList: [],
|
||||||
degreeList: [],
|
degreeList: [],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"combineRecommendJobFilterType": 1,
|
"combineRecommendJobFilterType": 1,
|
||||||
"anyCombineRecommendJobFilter": {
|
"anyCombineRecommendJobFilter": {
|
||||||
|
"cityList": [],
|
||||||
"salaryList": [],
|
"salaryList": [],
|
||||||
"experienceList": [],
|
"experienceList": [],
|
||||||
"degreeList": [],
|
"degreeList": [],
|
||||||
|
|||||||
@@ -38,6 +38,18 @@ import {
|
|||||||
} from './constant.mjs'
|
} from './constant.mjs'
|
||||||
import { parseSalary } from "@geekgeekrun/sqlite-plugin/dist/utils/parser"
|
import { parseSalary } from "@geekgeekrun/sqlite-plugin/dist/utils/parser"
|
||||||
import { waitForSageTimeOrJustContinue } from './sage-time.mjs'
|
import { waitForSageTimeOrJustContinue } from './sage-time.mjs'
|
||||||
|
import cityGroupData from './cityGroup.mjs'
|
||||||
|
const flattedCityList = []
|
||||||
|
;(cityGroupData?.zpData?.cityGroup ?? []).forEach(it => {
|
||||||
|
const firstChar = it.firstChar
|
||||||
|
it.cityList.forEach(city => {
|
||||||
|
flattedCityList.push({
|
||||||
|
...city,
|
||||||
|
firstChar
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const jobFilterConditionsMapByCode = {}
|
const jobFilterConditionsMapByCode = {}
|
||||||
Object.values(jobFilterConditions).forEach(arr => {
|
Object.values(jobFilterConditions).forEach(arr => {
|
||||||
arr.forEach(option => {
|
arr.forEach(option => {
|
||||||
@@ -406,6 +418,7 @@ export function testIfJobTitleOrDescriptionSuit (jobInfo, matchLogic) {
|
|||||||
|
|
||||||
async function setFilterCondition (selectedFilters) {
|
async function setFilterCondition (selectedFilters) {
|
||||||
const {
|
const {
|
||||||
|
cityList = [],
|
||||||
salaryList = [],
|
salaryList = [],
|
||||||
experienceList = [],
|
experienceList = [],
|
||||||
degreeList = [],
|
degreeList = [],
|
||||||
@@ -413,9 +426,9 @@ async function setFilterCondition (selectedFilters) {
|
|||||||
industryList = []
|
industryList = []
|
||||||
} = selectedFilters
|
} = selectedFilters
|
||||||
|
|
||||||
const placeholderTexts = ['薪资待遇', '工作经验', '学历要求', '公司行业', '公司规模']
|
const placeholderTexts = ['城市', '薪资待遇', '工作经验', '学历要求', '公司行业', '公司规模']
|
||||||
const optionKaPrefixes = ['sel-job-rec-salary-', 'sel-job-rec-exp-', 'sel-job-rec-degree-', 'sel-industry-', 'sel-job-rec-scale-']
|
const optionKaPrefixes = ['switch_city_dialog_open', 'sel-job-rec-salary-', 'sel-job-rec-exp-', 'sel-job-rec-degree-', 'sel-industry-', 'sel-job-rec-scale-']
|
||||||
const conditionArr = [salaryList, experienceList, degreeList, industryList, scaleList]
|
const conditionArr = [cityList, salaryList, experienceList, degreeList, industryList, scaleList]
|
||||||
|
|
||||||
console.log('current filter condition----')
|
console.log('current filter condition----')
|
||||||
for (let i = 0; i < placeholderTexts.length; i++) {
|
for (let i = 0; i < placeholderTexts.length; i++) {
|
||||||
@@ -434,10 +447,15 @@ 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('.page-jobs-main .filter-condition-inner')
|
if (placeholderText === '城市') {
|
||||||
const dropdownEntry = filterBar.__vue__.$children.find(it => it.placeholder === placeholderText)
|
return document.querySelector('.page-jobs-main .filter-condition-inner [ka="switch_city_dialog_open"]')
|
||||||
return dropdownEntry.$el
|
}
|
||||||
}, placeholderText)).asElement();
|
else {
|
||||||
|
const filterBar = document.querySelector('.page-jobs-main .filter-condition-inner')
|
||||||
|
const dropdownEntry = filterBar.__vue__.$children.find(it => it.placeholder === placeholderText)
|
||||||
|
return dropdownEntry?.$el
|
||||||
|
}
|
||||||
|
}, placeholderText))?.asElement();
|
||||||
return jsHandle
|
return jsHandle
|
||||||
})()
|
})()
|
||||||
if (!filterDropdownProxy) {
|
if (!filterDropdownProxy) {
|
||||||
@@ -446,88 +464,143 @@ async function setFilterCondition (selectedFilters) {
|
|||||||
|
|
||||||
const currentFilterConditions = conditionArr[i];
|
const currentFilterConditions = conditionArr[i];
|
||||||
const filterDropdownCssList = await filterDropdownProxy.evaluate(el => Array.from(el.classList));
|
const filterDropdownCssList = await filterDropdownProxy.evaluate(el => Array.from(el.classList));
|
||||||
if (!filterDropdownCssList.includes('is-select') && !currentFilterConditions.length) {
|
if (placeholderText === '城市') {
|
||||||
continue
|
const onPageSelectedCity = filterDropdownCssList.includes('active') ? (await filterDropdownProxy.evaluate(el => el.textContent.trim())) : null
|
||||||
} else {
|
if (!onPageSelectedCity && !currentFilterConditions.length) {
|
||||||
const filterDropdownElBBox = await filterDropdownProxy.boundingBox()
|
continue
|
||||||
await page.mouse.move(
|
} else if (onPageSelectedCity === (currentFilterConditions[0] ?? null)) {
|
||||||
filterDropdownElBBox.x + filterDropdownElBBox.width / 2,
|
continue
|
||||||
filterDropdownElBBox.y + filterDropdownElBBox.height / 2,
|
} else {
|
||||||
)
|
if (!currentFilterConditions.length) {
|
||||||
await sleepWithRandomDelay(500)
|
const clearButtonHandle = await page.$(`.page-jobs-main .filter-condition-inner [ka="empty-filter"]`)
|
||||||
|
await clearButtonHandle.click()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await filterDropdownProxy?.click()
|
||||||
|
await page.waitForFunction(() => {
|
||||||
|
const dialogEl = document.querySelector('.city-select-dialog')
|
||||||
|
return dialogEl && window.getComputedStyle(dialogEl).display !== 'none'
|
||||||
|
})
|
||||||
|
const citySelectWrapperProxy = await page.waitForSelector('.city-select-wrapper')
|
||||||
|
let targetCityElJsHandle = (await page.evaluateHandle((cityName) => {
|
||||||
|
const targetCityEl = [...document.querySelectorAll('.city-select-dialog .city-select-wrapper ul.city-list-hot li')].find(it => it.textContent.trim() === cityName) ?? null
|
||||||
|
return targetCityEl
|
||||||
|
}, currentFilterConditions[0]))?.asElement()
|
||||||
|
if (!targetCityElJsHandle) {
|
||||||
|
const targetCityItem = flattedCityList.find(it => it.name === currentFilterConditions[0])
|
||||||
|
if (!targetCityItem) {
|
||||||
|
// unexpected condition
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const firstChar = targetCityItem.firstChar
|
||||||
|
const targetCityCharListEntryHandle = await page.$(`xpath///*[contains(@class, "city-select-dialog")]//*[contains(@class, "city-select-wrapper")]//ul[contains(@class, "city-char-list")]//li[contains(text(), '${firstChar.toUpperCase()}')]`)
|
||||||
|
await targetCityCharListEntryHandle.click()
|
||||||
|
targetCityElJsHandle = (await page.evaluateHandle((cityName) => {
|
||||||
|
const targetCityEl = [...document.querySelectorAll('.city-select-dialog .city-select-wrapper .list-select-list a')].find(it => it.textContent.trim() === cityName) ?? null
|
||||||
|
return targetCityEl
|
||||||
|
}, currentFilterConditions[0]))?.asElement()
|
||||||
|
}
|
||||||
|
if (!targetCityElJsHandle) {
|
||||||
|
// unexpected condition
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
await targetCityElJsHandle.click()
|
||||||
|
await sleep(1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!filterDropdownCssList.includes('is-select') && !currentFilterConditions.length) {
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
await filterDropdownProxy.scrollIntoView()
|
||||||
|
const filterDropdownElBBox = await filterDropdownProxy.boundingBox()
|
||||||
|
await page.mouse.move(
|
||||||
|
filterDropdownElBBox.x + filterDropdownElBBox.width / 2,
|
||||||
|
filterDropdownElBBox.y + filterDropdownElBBox.height / 2,
|
||||||
|
)
|
||||||
|
await sleepWithRandomDelay(500)
|
||||||
|
|
||||||
const optionKaPrefix = optionKaPrefixes[i]
|
const optionKaPrefix = optionKaPrefixes[i]
|
||||||
if (!currentFilterConditions.length) {
|
if (!currentFilterConditions.length) {
|
||||||
if (placeholderText === '公司行业') {
|
if (placeholderText === '公司行业') {
|
||||||
const activeOptionElAtCurrentFilterProxyList = await page.$$(`.page-jobs-main .filter-condition-inner .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 {
|
||||||
|
// select 不限 immediately
|
||||||
|
const buxianOptionElProxy = await page.$(`.page-jobs-main .filter-condition-inner [ka="${optionKaPrefix}${0}"]`)
|
||||||
|
await buxianOptionElProxy.click()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// select 不限 immediately
|
//#region uncheck options perviously checked but not existed in current filter.
|
||||||
const buxianOptionElProxy = await page.$(`.page-jobs-main .filter-condition-inner [ka="${optionKaPrefix}${0}"]`)
|
const activeOptionElAtCurrentFilterProxyList = await page.$$(`.page-jobs-main .filter-condition-inner .active[ka^="${optionKaPrefix}"]`)
|
||||||
await buxianOptionElProxy.click()
|
const activeOptionValues = (await Promise.all(
|
||||||
}
|
activeOptionElAtCurrentFilterProxyList.map(elProxy => {
|
||||||
} else {
|
return elProxy.evaluate((el) => {
|
||||||
//#region uncheck options perviously checked but not existed in current filter.
|
return el.getAttribute('ka')
|
||||||
const activeOptionElAtCurrentFilterProxyList = await page.$$(`.page-jobs-main .filter-condition-inner .active[ka^="${optionKaPrefix}"]`)
|
})
|
||||||
const activeOptionValues = (await Promise.all(
|
|
||||||
activeOptionElAtCurrentFilterProxyList.map(elProxy => {
|
|
||||||
return elProxy.evaluate((el) => {
|
|
||||||
return el.getAttribute('ka')
|
|
||||||
})
|
})
|
||||||
})
|
)).map(it => it.replace(optionKaPrefix, '')).map(Number)
|
||||||
)).map(it => it.replace(optionKaPrefix, '')).map(Number)
|
if (placeholderText !== '薪资待遇') {
|
||||||
if (placeholderText !== '薪资待遇') {
|
for(let i = 0; i < activeOptionValues.length; i++) {
|
||||||
for(let i = 0; i < activeOptionValues.length; i++) {
|
let activeValue
|
||||||
let activeValue
|
if (placeholderText === '公司行业') {
|
||||||
|
activeValue = industryFilterConditionsMapByIndex[activeOptionValues[i]]?.code
|
||||||
|
} else {
|
||||||
|
activeValue = activeOptionValues[i]
|
||||||
|
}
|
||||||
|
const activeOptionElProxy = activeOptionElAtCurrentFilterProxyList[i]
|
||||||
|
if (!currentFilterConditions.includes(activeValue)) {
|
||||||
|
await activeOptionElProxy.click()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
//#region only click the one which we need check, don't change already checked.
|
||||||
|
const conditionToCheck = currentFilterConditions.filter(it => {
|
||||||
if (placeholderText === '公司行业') {
|
if (placeholderText === '公司行业') {
|
||||||
activeValue = industryFilterConditionsMapByIndex[activeOptionValues[i]]?.code
|
return !activeOptionValues.map(value => industryFilterConditionsMapByIndex[value].code).includes(it);
|
||||||
} else {
|
} else {
|
||||||
activeValue = activeOptionValues[i]
|
return !activeOptionValues.includes(it)
|
||||||
}
|
}
|
||||||
const activeOptionElProxy = activeOptionElAtCurrentFilterProxyList[i]
|
})
|
||||||
if (!currentFilterConditions.includes(activeValue)) {
|
for(let j = 0; j < conditionToCheck.length; j++) {
|
||||||
await activeOptionElProxy.click()
|
let optionValue
|
||||||
|
if (placeholderText === '公司行业') {
|
||||||
|
optionValue = industryFilterConditionCodeToIndexMap[conditionToCheck[j]]
|
||||||
|
} else {
|
||||||
|
optionValue = conditionToCheck[j]
|
||||||
}
|
}
|
||||||
|
await sleepWithRandomDelay(500)
|
||||||
|
await filterDropdownProxy.scrollIntoView()
|
||||||
|
const filterDropdownElBBox = await filterDropdownProxy.boundingBox()
|
||||||
|
await page.mouse.move(
|
||||||
|
filterDropdownElBBox.x + filterDropdownElBBox.width / 2,
|
||||||
|
filterDropdownElBBox.y + filterDropdownElBBox.height / 2,
|
||||||
|
)
|
||||||
|
await sleepWithRandomDelay(500)
|
||||||
|
const optionElProxy = await page.$(`.page-jobs-main .filter-condition-inner [ka="${optionKaPrefix}${optionValue}"]`)
|
||||||
|
if (!optionElProxy) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
await optionElProxy.click()
|
||||||
}
|
}
|
||||||
|
//#endregion
|
||||||
|
//#region move out dropdown entry to make dropdown hidden
|
||||||
|
const navBarLogoElProxy = await page.$(`[ka="header-home-logo"]`)
|
||||||
|
if (navBarLogoElProxy) {
|
||||||
|
const navBarLogoElBBox = await navBarLogoElProxy.boundingBox()
|
||||||
|
await page.mouse.move(
|
||||||
|
navBarLogoElBBox.x + navBarLogoElBBox.width / 2,
|
||||||
|
navBarLogoElBBox.y + navBarLogoElBBox.height / 2,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
//#endregion
|
await sleepWithRandomDelay(500)
|
||||||
//#region only click the one which we need check, don't change already checked.
|
|
||||||
const conditionToCheck = currentFilterConditions.filter(it => {
|
|
||||||
if (placeholderText === '公司行业') {
|
|
||||||
return !activeOptionValues.map(value => industryFilterConditionsMapByIndex[value].code).includes(it);
|
|
||||||
} else {
|
|
||||||
return !activeOptionValues.includes(it)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
for(let j = 0; j < conditionToCheck.length; j++) {
|
|
||||||
let optionValue
|
|
||||||
if (placeholderText === '公司行业') {
|
|
||||||
optionValue = industryFilterConditionCodeToIndexMap[conditionToCheck[j]]
|
|
||||||
} else {
|
|
||||||
optionValue = conditionToCheck[j]
|
|
||||||
}
|
|
||||||
await sleepWithRandomDelay(500)
|
|
||||||
const optionElProxy = await page.$(`.page-jobs-main .filter-condition-inner [ka="${optionKaPrefix}${optionValue}"]`)
|
|
||||||
if (!optionElProxy) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
await optionElProxy.click()
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
//#region move out dropdown entry to make dropdown hidden
|
|
||||||
const navBarLogoElProxy = await page.$(`[ka="header-home-logo"]`)
|
|
||||||
if (navBarLogoElProxy) {
|
|
||||||
const navBarLogoElBBox = await navBarLogoElProxy.boundingBox()
|
|
||||||
await page.mouse.move(
|
|
||||||
navBarLogoElBBox.x + navBarLogoElBBox.width / 2,
|
|
||||||
navBarLogoElBBox.y + navBarLogoElBBox.height / 2,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
}
|
}
|
||||||
await sleepWithRandomDelay(500)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,9 +758,12 @@ async function toRecommendPage (hooks) {
|
|||||||
? formatStaticCombineFilters(staticCombineRecommendJobFilterConditions)
|
? formatStaticCombineFilters(staticCombineRecommendJobFilterConditions)
|
||||||
: combineFiltersWithConstraintsGenerator(anyCombineRecommendJobFilter)
|
: combineFiltersWithConstraintsGenerator(anyCombineRecommendJobFilter)
|
||||||
let expectJobList
|
let expectJobList
|
||||||
|
let filterConditionIndex = -1
|
||||||
iterateFilterCondition: for (
|
iterateFilterCondition: for (
|
||||||
const filterCondition of filterConditions
|
const filterCondition of filterConditions
|
||||||
) {
|
) {
|
||||||
|
filterConditionIndex++
|
||||||
|
console.log(`current filter condition index to apply: ${filterConditionIndex}`, JSON.stringify(filterCondition))
|
||||||
findInCurrentFilterCondition: while(true) {
|
findInCurrentFilterCondition: while(true) {
|
||||||
await sleepWithRandomDelay(2500)
|
await sleepWithRandomDelay(2500)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="job-combo-filter">
|
<div class="job-combo-filter">
|
||||||
|
<div class="filter-item">
|
||||||
|
<div font-size-12px>城市</div>
|
||||||
|
<div
|
||||||
|
style="
|
||||||
|
align-items: center;
|
||||||
|
background-color: var(--el-input-bg-color, var(--el-fill-color-blank));
|
||||||
|
background-image: none;
|
||||||
|
border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
|
||||||
|
box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
|
||||||
|
"
|
||||||
|
pl4px
|
||||||
|
pr4px
|
||||||
|
flex
|
||||||
|
justify-between
|
||||||
|
items-center
|
||||||
|
>
|
||||||
|
<city-chooser v-model="modelValue.cityList">
|
||||||
|
<template #default="{ showDialog }">
|
||||||
|
<div flex justify-between items-center>
|
||||||
|
<div font-size-12px>
|
||||||
|
<template v-if="modelValue.cityList?.length"
|
||||||
|
>已选择<span ml3px mr3px>{{ modelValue.cityList?.length }}</span
|
||||||
|
>个城市</template
|
||||||
|
>
|
||||||
|
<template v-else><i color-gray>未选择城市</i></template>
|
||||||
|
</div>
|
||||||
|
<el-button size="small" @click="showDialog" pl4px pr4px>选择</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</city-chooser>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="filter-item">
|
<div class="filter-item">
|
||||||
<div font-size-12px>薪资待遇</div>
|
<div font-size-12px>薪资待遇</div>
|
||||||
<el-select
|
<el-select
|
||||||
@@ -10,7 +42,7 @@
|
|||||||
collapse-tags-tooltip
|
collapse-tags-tooltip
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="it in conditions.salaryList.filter(it => it.code !== 0)"
|
v-for="it in conditions.salaryList.filter((it) => it.code !== 0)"
|
||||||
:key="it.code"
|
:key="it.code"
|
||||||
:value="it.code"
|
:value="it.code"
|
||||||
:label="it.name"
|
:label="it.name"
|
||||||
@@ -27,7 +59,7 @@
|
|||||||
collapse-tags-tooltip
|
collapse-tags-tooltip
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="it in conditions.experienceList.filter(it => it.code !== 0)"
|
v-for="it in conditions.experienceList.filter((it) => it.code !== 0)"
|
||||||
:key="it.code"
|
:key="it.code"
|
||||||
:value="it.code"
|
:value="it.code"
|
||||||
:label="it.name"
|
:label="it.name"
|
||||||
@@ -44,7 +76,7 @@
|
|||||||
collapse-tags-tooltip
|
collapse-tags-tooltip
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="it in conditions.degreeList.filter(it => it.code !== 0)"
|
v-for="it in conditions.degreeList.filter((it) => it.code !== 0)"
|
||||||
:key="it.code"
|
:key="it.code"
|
||||||
:value="it.code"
|
:value="it.code"
|
||||||
:label="it.name"
|
:label="it.name"
|
||||||
@@ -84,7 +116,7 @@
|
|||||||
collapse-tags-tooltip
|
collapse-tags-tooltip
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="it in conditions.scaleList.filter(it => it.code !== 0)"
|
v-for="it in conditions.scaleList.filter((it) => it.code !== 0)"
|
||||||
:key="it.code"
|
:key="it.code"
|
||||||
:value="it.code"
|
:value="it.code"
|
||||||
:label="it.name"
|
:label="it.name"
|
||||||
@@ -97,6 +129,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import conditions from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-conditions-20241002.json'
|
import conditions from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-conditions-20241002.json'
|
||||||
import industryFilterExemption from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-industry-filter-exemption-20241002.json'
|
import industryFilterExemption from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-industry-filter-exemption-20241002.json'
|
||||||
|
import CityChooser from '@renderer/page/MainLayout/GeekAutoStartChatWithBoss/components/CityChooser.vue'
|
||||||
import { PropType } from 'vue'
|
import { PropType } from 'vue'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
|
|||||||
@@ -71,6 +71,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column :resizable="false" label="城市" prop="city">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<city-chooser v-model="row.city" :multiple="false">
|
||||||
|
<template #default="{ showDialog }">
|
||||||
|
<div flex justify-between items-center>
|
||||||
|
<div font-size-12px lh-1.2em>
|
||||||
|
<template v-if="row.city">{{ row.city }}</template>
|
||||||
|
<template v-else><i color-gray>未选择城市</i></template>
|
||||||
|
</div>
|
||||||
|
<el-button size="small" @click="showDialog" pl4px pr4px>选择</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</city-chooser>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column :resizable="false" label="薪资待遇" prop="salary">
|
<el-table-column :resizable="false" label="薪资待遇" prop="salary">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select
|
<el-select
|
||||||
@@ -183,6 +198,7 @@ import conditions from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-con
|
|||||||
import industryFilterExemption from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-industry-filter-exemption-20241002.json'
|
import industryFilterExemption from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-industry-filter-exemption-20241002.json'
|
||||||
import { ArrowUp, ArrowDown, Delete, Plus } from '@element-plus/icons-vue'
|
import { ArrowUp, ArrowDown, Delete, Plus } from '@element-plus/icons-vue'
|
||||||
import { computed, PropType } from 'vue'
|
import { computed, PropType } from 'vue'
|
||||||
|
import CityChooser from '@renderer/page/MainLayout/GeekAutoStartChatWithBoss/components/CityChooser.vue'
|
||||||
|
|
||||||
import { getStaticCombineFilterKey } from '@geekgeekrun/geek-auto-start-chat-with-boss/combineCalculator.mjs'
|
import { getStaticCombineFilterKey } from '@geekgeekrun/geek-auto-start-chat-with-boss/combineCalculator.mjs'
|
||||||
|
|
||||||
|
|||||||
+63
-50
@@ -1,46 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div w-full>
|
||||||
<div v-if="modelValue?.length">
|
<slot
|
||||||
<div>当前已选择城市:</div>
|
:model-value="modelValue"
|
||||||
<div flex flex-wrap gap-10px>
|
:show-dialog="() => (isDialogVisible = true)"
|
||||||
<el-tag v-for="it in modelValue" :key="it">
|
:clear-value="handleClearSelectedCitiesInModelValue"
|
||||||
{{ it }}
|
></slot>
|
||||||
</el-tag>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<div>当前未选择任何期望城市,将不会按照城市进行筛选</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
line-height-1
|
|
||||||
:style="{
|
|
||||||
marginTop: modelValue?.length ? '10px' : ''
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<el-button
|
|
||||||
size="small"
|
|
||||||
type="primary"
|
|
||||||
@click="
|
|
||||||
() => {
|
|
||||||
isDialogVisible = true
|
|
||||||
gtagRenderer('choose_city_entry_button_clicked')
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>选择城市</el-button
|
|
||||||
>
|
|
||||||
<el-button
|
|
||||||
v-if="modelValue?.length"
|
|
||||||
size="small"
|
|
||||||
type="danger"
|
|
||||||
@click="handleClearSelectedCitiesInModelValue"
|
|
||||||
>清空已选择的所有城市</el-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="isDialogVisible"
|
v-model="isDialogVisible"
|
||||||
width="1000px"
|
width="1000px"
|
||||||
title="请选择城市"
|
title="请选择城市"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
|
append-to-body
|
||||||
@open="handleDialogOpen"
|
@open="handleDialogOpen"
|
||||||
@closed="handleDialogClosed"
|
@closed="handleDialogClosed"
|
||||||
>
|
>
|
||||||
@@ -50,7 +20,7 @@
|
|||||||
label="热门城市"
|
label="热门城市"
|
||||||
name="热门城市"
|
name="热门城市"
|
||||||
>
|
>
|
||||||
<el-checkbox-group v-model="selectedCities">
|
<el-checkbox-group v-if="multiple" v-model="selectedCities">
|
||||||
<div
|
<div
|
||||||
:style="{
|
:style="{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
@@ -66,6 +36,23 @@
|
|||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
|
<el-radio-group v-else v-model="selectedCities" w-full>
|
||||||
|
<div
|
||||||
|
w-full
|
||||||
|
:style="{
|
||||||
|
display: 'grid',
|
||||||
|
gridTemplateColumns: '1fr 1fr 1fr 1fr'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<el-radio
|
||||||
|
v-for="op in hotCityList.filter((it) => it.code !== 100010000)"
|
||||||
|
:key="op.code"
|
||||||
|
:label="op.name"
|
||||||
|
>
|
||||||
|
{{ op.name }}
|
||||||
|
</el-radio>
|
||||||
|
</div>
|
||||||
|
</el-radio-group>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="it in cityGroupsByAlphabetMap.keys()"
|
v-for="it in cityGroupsByAlphabetMap.keys()"
|
||||||
@@ -75,8 +62,8 @@
|
|||||||
:value="it"
|
:value="it"
|
||||||
>
|
>
|
||||||
<div v-for="group in cityGroupsByAlphabetMap.get(it)" :key="group.firstChar">
|
<div v-for="group in cityGroupsByAlphabetMap.get(it)" :key="group.firstChar">
|
||||||
{{ group.firstChar }}
|
<div pt4px pb4px>{{ group.firstChar }}</div>
|
||||||
<el-checkbox-group v-model="selectedCities">
|
<el-checkbox-group v-if="multiple" v-model="selectedCities">
|
||||||
<div
|
<div
|
||||||
:style="{
|
:style="{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
@@ -88,6 +75,19 @@
|
|||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
|
<el-radio-group v-else v-model="selectedCities" w-full>
|
||||||
|
<div
|
||||||
|
w-full
|
||||||
|
:style="{
|
||||||
|
display: 'grid',
|
||||||
|
gridTemplateColumns: '1fr 1fr 1fr 1fr'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<el-radio v-for="op in group.cityList" :key="op.code" :label="op.name">
|
||||||
|
{{ op.name }}
|
||||||
|
</el-radio>
|
||||||
|
</div>
|
||||||
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="selectedCities.length"
|
v-if="selectedCities?.length"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleClearSelectedCitiesInDialog"
|
@click="handleClearSelectedCitiesInDialog"
|
||||||
>清空已选择的所有城市</el-button
|
>清空已选择的所有城市</el-button
|
||||||
@@ -119,12 +119,18 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { PropType, ref } from 'vue'
|
import { PropType, ref } from 'vue'
|
||||||
import cityGroupData from '../../../../../../common/constant/cityGroup.json'
|
import cityGroupData from '@geekgeekrun/geek-auto-start-chat-with-boss/cityGroup.mjs'
|
||||||
import { gtagRenderer } from '@renderer/utils/gtag'
|
import { gtagRenderer } from '@renderer/utils/gtag'
|
||||||
|
import { ElRadioGroup } from 'element-plus'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array as PropType<string[]>
|
type: [Array, String] as PropType<string[] | string | null>,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
multiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const emits = defineEmits(['update:modelValue'])
|
const emits = defineEmits(['update:modelValue'])
|
||||||
@@ -132,7 +138,7 @@ const { hotCityList, cityGroup } = cityGroupData.zpData
|
|||||||
|
|
||||||
const activeTabName = ref('热门城市')
|
const activeTabName = ref('热门城市')
|
||||||
const isDialogVisible = ref(false)
|
const isDialogVisible = ref(false)
|
||||||
const selectedCities = ref([])
|
const selectedCities = ref(null)
|
||||||
|
|
||||||
const cityGroupsByAlphabetMap = ref(
|
const cityGroupsByAlphabetMap = ref(
|
||||||
new Map(['ABCDE', 'FGHJ', 'KLMN', 'PQRST', 'WXYZ'].map((it) => [it, []]))
|
new Map(['ABCDE', 'FGHJ', 'KLMN', 'PQRST', 'WXYZ'].map((it) => [it, []]))
|
||||||
@@ -151,7 +157,7 @@ for (const group of cityGroup) {
|
|||||||
|
|
||||||
function handleDialogOpen() {
|
function handleDialogOpen() {
|
||||||
activeTabName.value = '热门城市'
|
activeTabName.value = '热门城市'
|
||||||
selectedCities.value = [...(props.modelValue ?? [])]
|
selectedCities.value = props.multiple ? [...(props.modelValue ?? [])] : props.modelValue
|
||||||
gtagRenderer('choose_city_dialog_open')
|
gtagRenderer('choose_city_dialog_open')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,21 +166,28 @@ function handleCancelClicked() {
|
|||||||
isDialogVisible.value = false
|
isDialogVisible.value = false
|
||||||
}
|
}
|
||||||
function handleConfirmClicked() {
|
function handleConfirmClicked() {
|
||||||
gtagRenderer('choose_city_confirm_button_clicked', { value: selectedCities.value.join(',') })
|
gtagRenderer('choose_city_confirm_button_clicked', {
|
||||||
|
value: Array.isArray(selectedCities.value)
|
||||||
|
? selectedCities.value.join(',')
|
||||||
|
: selectedCities.value
|
||||||
|
})
|
||||||
isDialogVisible.value = false
|
isDialogVisible.value = false
|
||||||
emits('update:modelValue', [...(selectedCities.value ?? [])])
|
emits(
|
||||||
|
'update:modelValue',
|
||||||
|
props.multiple ? [...(selectedCities.value ?? [])] : selectedCities.value
|
||||||
|
)
|
||||||
}
|
}
|
||||||
function handleDialogClosed() {
|
function handleDialogClosed() {
|
||||||
selectedCities.value = []
|
selectedCities.value = props.multiple ? [] : null
|
||||||
gtagRenderer('choose_city_dialog_closed')
|
gtagRenderer('choose_city_dialog_closed')
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClearSelectedCitiesInModelValue() {
|
function handleClearSelectedCitiesInModelValue() {
|
||||||
emits('update:modelValue', [])
|
emits('update:modelValue', (selectedCities.value = props.multiple ? [] : null))
|
||||||
gtagRenderer('clear_selected_cities_in_mv_clicked')
|
gtagRenderer('clear_selected_cities_in_mv_clicked')
|
||||||
}
|
}
|
||||||
function handleClearSelectedCitiesInDialog() {
|
function handleClearSelectedCitiesInDialog() {
|
||||||
selectedCities.value = []
|
selectedCities.value = props.multiple ? [] : null
|
||||||
gtagRenderer('clear_selected_cities_in_dialog_clicked')
|
gtagRenderer('clear_selected_cities_in_dialog_clicked')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -314,7 +314,47 @@
|
|||||||
width: '100%'
|
width: '100%'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<city-chooser v-model="formContent.expectCityList" />
|
<city-chooser v-model="formContent.expectCityList">
|
||||||
|
<template #default="{ modelValue, showDialog, clearValue }">
|
||||||
|
<div v-if="modelValue?.length">
|
||||||
|
<div>当前已选择城市:</div>
|
||||||
|
<div flex flex-wrap gap-10px>
|
||||||
|
<el-tag v-for="it in modelValue" :key="it">
|
||||||
|
{{ it }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div>当前未选择任何期望城市,将不会按照城市进行筛选</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
line-height-1
|
||||||
|
:style="{
|
||||||
|
marginTop: modelValue?.length ? '10px' : ''
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
// isDialogVisible = true
|
||||||
|
showDialog()
|
||||||
|
gtagRenderer('choose_city_entry_button_clicked')
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>选择城市</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-if="modelValue?.length"
|
||||||
|
size="small"
|
||||||
|
type="danger"
|
||||||
|
@click="clearValue"
|
||||||
|
>清空已选择的所有城市</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</city-chooser>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user