mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 00:47:15 +08:00
add listener for common-job-condition-config-updated; enhance common config show in ghosting reminder ui
This commit is contained in:
-1
@@ -9,5 +9,4 @@
|
|||||||
"expectSalaryCalculateWay": 1,
|
"expectSalaryCalculateWay": 1,
|
||||||
"expectSalaryLow": null,
|
"expectSalaryLow": null,
|
||||||
"expectSalaryHigh": null
|
"expectSalaryHigh": null
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { ipcMain } from 'electron'
|
||||||
|
import { createCommonJobConditionConfigWindow } from '../window/commonJobConditionConfigWindow'
|
||||||
|
import { mainWindow } from '../window/mainWindow'
|
||||||
|
import { readConfigFile } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||||
|
|
||||||
|
let commonJobConditionConfigWindow = null
|
||||||
|
export async function waitForCommonJobConditionDone() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
commonJobConditionConfigWindow = createCommonJobConditionConfigWindow({
|
||||||
|
parent: mainWindow!,
|
||||||
|
modal: true,
|
||||||
|
show: true
|
||||||
|
})
|
||||||
|
let processDone = false
|
||||||
|
function handler() {
|
||||||
|
processDone = true
|
||||||
|
commonJobConditionConfigWindow.close()
|
||||||
|
}
|
||||||
|
ipcMain.once('common-job-condition-config-done', handler)
|
||||||
|
commonJobConditionConfigWindow.on('closed', async () => {
|
||||||
|
ipcMain.off('common-job-condition-config-done', handler)
|
||||||
|
if (processDone) {
|
||||||
|
mainWindow?.webContents.send('common-job-condition-config-updated', {
|
||||||
|
config: await readConfigFile('common-job-condition-config.json')
|
||||||
|
})
|
||||||
|
resolve(true)
|
||||||
|
} else {
|
||||||
|
reject(new Error('USER_CANCELLED'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -2,8 +2,6 @@ import { ipcMain, shell, app, dialog, BrowserWindow } from 'electron'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import * as childProcess from 'node:child_process'
|
import * as childProcess from 'node:child_process'
|
||||||
import {
|
import {
|
||||||
ensureConfigFileExist,
|
|
||||||
configFileNameList,
|
|
||||||
readConfigFile,
|
readConfigFile,
|
||||||
writeConfigFile,
|
writeConfigFile,
|
||||||
readStorageFile,
|
readStorageFile,
|
||||||
@@ -58,24 +56,10 @@ import {
|
|||||||
waitForUserApproveAgreement
|
waitForUserApproveAgreement
|
||||||
} from '../../../features/first-launch-notice-window'
|
} from '../../../features/first-launch-notice-window'
|
||||||
import { getLastUsedAndAvailableBrowser } from '../../DOWNLOAD_DEPENDENCIES/utils/browser-history'
|
import { getLastUsedAndAvailableBrowser } from '../../DOWNLOAD_DEPENDENCIES/utils/browser-history'
|
||||||
import { createCommonJobConditionConfigWindow } from '../../../window/commonJobConditionConfigWindow'
|
import { waitForCommonJobConditionDone } from '../../../features/common-job-condition'
|
||||||
|
import { ensureConfigFileExist } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||||
|
|
||||||
export default function initIpc() {
|
export default function initIpc() {
|
||||||
ipcMain.handle('fetch-config-file-content', async () => {
|
|
||||||
const configFileContentList = configFileNameList.map((fileName) => {
|
|
||||||
return readConfigFile(fileName)
|
|
||||||
})
|
|
||||||
const result = {
|
|
||||||
config: {}
|
|
||||||
}
|
|
||||||
|
|
||||||
configFileNameList.forEach((fileName, index) => {
|
|
||||||
result.config[fileName] = configFileContentList[index]
|
|
||||||
})
|
|
||||||
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
|
|
||||||
ipcMain.handle('save-config-file-from-ui', async (ev, payload) => {
|
ipcMain.handle('save-config-file-from-ui', async (ev, payload) => {
|
||||||
payload = JSON.parse(payload)
|
payload = JSON.parse(payload)
|
||||||
ensureConfigFileExist()
|
ensureConfigFileExist()
|
||||||
@@ -612,11 +596,7 @@ export default function initIpc() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
ipcMain.handle('common-job-condition-config', async () => {
|
ipcMain.handle('common-job-condition-config', async () => {
|
||||||
createCommonJobConditionConfigWindow({
|
await waitForCommonJobConditionDone()
|
||||||
parent: mainWindow!,
|
|
||||||
modal: true,
|
|
||||||
show: true
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('exit-app-immediately', () => {
|
ipcMain.handle('exit-app-immediately', () => {
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import os from 'node:os'
|
|||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
import {
|
import {
|
||||||
ensureStorageFileExist,
|
ensureStorageFileExist,
|
||||||
readStorageFile,
|
writeStorageFile,
|
||||||
writeStorageFile
|
configFileNameList,
|
||||||
|
readConfigFile,
|
||||||
|
readStorageFile
|
||||||
} from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
} from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||||
|
|
||||||
export default function initPublicIpc() {
|
export default function initPublicIpc() {
|
||||||
@@ -110,4 +112,19 @@ export default function initPublicIpc() {
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.handle('fetch-config-file-content', async () => {
|
||||||
|
const configFileContentList = configFileNameList.map((fileName) => {
|
||||||
|
return readConfigFile(fileName)
|
||||||
|
})
|
||||||
|
const result = {
|
||||||
|
config: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
configFileNameList.forEach((fileName, index) => {
|
||||||
|
result.config[fileName] = configFileContentList[index]
|
||||||
|
})
|
||||||
|
|
||||||
|
return result
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { BrowserWindow } from 'electron'
|
import { BrowserWindow, ipcMain } from 'electron'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { writeConfigFile } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
|
||||||
|
|
||||||
export let commonJobConditionConfigWindow: BrowserWindow | null = null
|
export let commonJobConditionConfigWindow: BrowserWindow | null = null
|
||||||
export function createCommonJobConditionConfigWindow(
|
export function createCommonJobConditionConfigWindow(
|
||||||
@@ -42,5 +43,13 @@ export function createCommonJobConditionConfigWindow(
|
|||||||
commonJobConditionConfigWindow = null
|
commonJobConditionConfigWindow = null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.handle('save-common-job-condition-config', async (_ev, payload) => {
|
||||||
|
await writeConfigFile('common-job-condition-config.json', payload)
|
||||||
|
commonJobConditionConfigWindow!.close()
|
||||||
|
})
|
||||||
|
commonJobConditionConfigWindow!.once('closed', () => {
|
||||||
|
ipcMain.removeHandler('save-common-job-condition-config')
|
||||||
|
})
|
||||||
|
|
||||||
return commonJobConditionConfigWindow!
|
return commonJobConditionConfigWindow!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -596,7 +596,7 @@
|
|||||||
|
|
||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||||
import { SalaryCalculateWay } from '@geekgeekrun/sqlite-plugin/src/enums'
|
import { JobDetailRegExpMatchLogic, SalaryCalculateWay } from '@geekgeekrun/sqlite-plugin/src/enums'
|
||||||
import CityChooser from '../MainLayout/GeekAutoStartChatWithBoss/components/CityChooser.vue'
|
import CityChooser from '../MainLayout/GeekAutoStartChatWithBoss/components/CityChooser.vue'
|
||||||
import { QuestionFilled, ArrowDown } from '@element-plus/icons-vue'
|
import { QuestionFilled, ArrowDown } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
@@ -618,18 +618,19 @@ import {
|
|||||||
normalizeCommaSplittedStr
|
normalizeCommaSplittedStr
|
||||||
} from '../MainLayout/GeekAutoStartChatWithBoss/common'
|
} from '../MainLayout/GeekAutoStartChatWithBoss/common'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
|
||||||
import expectJobFilterTemplateList from '../MainLayout/GeekAutoStartChatWithBoss/expectJobFilterTemplateList'
|
import expectJobFilterTemplateList from '../MainLayout/GeekAutoStartChatWithBoss/expectJobFilterTemplateList'
|
||||||
|
const { ipcRenderer } = window.electron
|
||||||
const gtagRenderer = (name, params?: object) => {
|
const gtagRenderer = (name, params?: object) => {
|
||||||
return baseGtagRenderer(name, {
|
return baseGtagRenderer(name, {
|
||||||
scene: 'cjc_config',
|
scene: 'cjc_config',
|
||||||
...params
|
...params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
const formContent = ref({
|
const formContent = ref({
|
||||||
|
expectCompanies: '',
|
||||||
|
expectCityList: [],
|
||||||
|
jobDetailRegExpMatchLogic: JobDetailRegExpMatchLogic.EVERY,
|
||||||
expectJobNameRegExpStr: '',
|
expectJobNameRegExpStr: '',
|
||||||
expectJobTypeRegExpStr: '',
|
expectJobTypeRegExpStr: '',
|
||||||
expectJobDescRegExpStr: '',
|
expectJobDescRegExpStr: '',
|
||||||
@@ -697,8 +698,32 @@ function handleCancel() {
|
|||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
async function handleSave() {
|
async function handleSave() {
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate()
|
||||||
//
|
await ipcRenderer.invoke(
|
||||||
|
'save-common-job-condition-config',
|
||||||
|
JSON.parse(
|
||||||
|
JSON.stringify({
|
||||||
|
...formContent.value,
|
||||||
|
expectCompanies: formContent.value.expectCompanies
|
||||||
|
? formContent.value.expectCompanies.split(',').map((s) => s.trim())
|
||||||
|
: []
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
ipcRenderer.send('common-job-condition-config-done')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
||||||
|
const commonJobConditionConfig = res.config?.['common-job-condition-config.json'] ?? {}
|
||||||
|
Object.keys(formContent.value).forEach((key) => {
|
||||||
|
if (key in commonJobConditionConfig) {
|
||||||
|
if (key === 'expectCompanies') {
|
||||||
|
formContent.value[key] = (commonJobConditionConfig[key] ?? []).join(',')
|
||||||
|
} else {
|
||||||
|
formContent.value[key] = commonJobConditionConfig[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -2340,9 +2340,12 @@ const handleBlockCompanyNameRegExpTemplateClicked =
|
|||||||
|
|
||||||
const commonJobConditionConfig = ref({})
|
const commonJobConditionConfig = ref({})
|
||||||
const unListenCommonJobConditionConfig = ipcRenderer.on(
|
const unListenCommonJobConditionConfig = ipcRenderer.on(
|
||||||
'common-job-condition-config-changed',
|
'common-job-condition-config-updated',
|
||||||
(_, config) => {
|
(_, { config }) => {
|
||||||
commonJobConditionConfig.value = config
|
commonJobConditionConfig.value = {
|
||||||
|
...config,
|
||||||
|
expectCompanies: config?.expectCompanies?.map((it) => it.trim())?.join(',') ?? ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
>
|
>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div>
|
<div>
|
||||||
<el-checkbox v-if="!expectJobTypeRegExpStr?.trim()" :model-value="false" disabled>
|
<el-checkbox
|
||||||
|
v-if="!expectJobTypeRegExpStrForRender?.trim()"
|
||||||
|
:model-value="false"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
发送提醒消息前,先按照“自动开聊-职位类型正则”校验正在与BOSS沟通的岗位是否满足期望,校验通过后再提醒
|
发送提醒消息前,先按照“自动开聊-职位类型正则”校验正在与BOSS沟通的岗位是否满足期望,校验通过后再提醒
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@@ -17,7 +21,7 @@
|
|||||||
发送提醒消息前,先按照“自动开聊-职位类型正则”校验正在与BOSS沟通的岗位是否满足期望,校验通过后再提醒
|
发送提醒消息前,先按照“自动开聊-职位类型正则”校验正在与BOSS沟通的岗位是否满足期望,校验通过后再提醒
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<div ml1.5em color-gray>
|
<div ml1.5em color-gray>
|
||||||
<div>当前职位类型正则:{{ expectJobTypeRegExpStr?.trim() }}</div>
|
<div>当前职位类型正则:{{ expectJobTypeRegExpStrForRender?.trim() }}</div>
|
||||||
<template
|
<template
|
||||||
v-if="
|
v-if="
|
||||||
formContent.autoReminder.rechatContentSource ===
|
formContent.autoReminder.rechatContentSource ===
|
||||||
@@ -33,7 +37,11 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div>
|
<div>
|
||||||
<el-checkbox v-if="!blockCompanyNameRegExpStr?.trim()" :model-value="false" disabled>
|
<el-checkbox
|
||||||
|
v-if="!blockCompanyNameRegExpStrForRender?.trim()"
|
||||||
|
:model-value="false"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
发送提醒消息前,先按照“自动开聊-不期望投递公司正则”校验正在与BOSS沟通的岗位是否归属于不期望投递的公司,如果是,则不提醒
|
发送提醒消息前,先按照“自动开聊-不期望投递公司正则”校验正在与BOSS沟通的岗位是否归属于不期望投递的公司,如果是,则不提醒
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@@ -41,7 +49,7 @@
|
|||||||
发送提醒消息前,先按照“自动开聊-不期望投递公司正则”校验正在与BOSS沟通的岗位是否归属于不期望投递的公司,如果是,则不提醒
|
发送提醒消息前,先按照“自动开聊-不期望投递公司正则”校验正在与BOSS沟通的岗位是否归属于不期望投递的公司,如果是,则不提醒
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<div ml1.5em color-gray>
|
<div ml1.5em color-gray>
|
||||||
<div>当前不期望投递公司正则:{{ blockCompanyNameRegExpStr?.trim() }}</div>
|
<div>当前不期望投递公司正则:{{ blockCompanyNameRegExpStrForRender?.trim() }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -313,10 +321,13 @@ electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
|||||||
|
|
||||||
const expectJobTypeRegExpStr = ref('')
|
const expectJobTypeRegExpStr = ref('')
|
||||||
const blockCompanyNameRegExpStr = ref('')
|
const blockCompanyNameRegExpStr = ref('')
|
||||||
|
const fieldsForUseCommonConfig = ref({})
|
||||||
async function fetchAutoStartChatConfig() {
|
async function fetchAutoStartChatConfig() {
|
||||||
await electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
await electron.ipcRenderer.invoke('fetch-config-file-content').then((res) => {
|
||||||
expectJobTypeRegExpStr.value = res.config['boss.json']?.expectJobTypeRegExpStr
|
expectJobTypeRegExpStr.value = res.config['boss.json']?.expectJobTypeRegExpStr
|
||||||
blockCompanyNameRegExpStr.value = res.config['boss.json']?.blockCompanyNameRegExpStr
|
blockCompanyNameRegExpStr.value = res.config['boss.json']?.blockCompanyNameRegExpStr
|
||||||
|
fieldsForUseCommonConfig.value = res.config['boss.json']?.fieldsForUseCommonConfig ?? {}
|
||||||
|
commonJobConditionConfig.value = res.config['common-job-condition-config.json']
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fetchAutoStartChatConfig()
|
fetchAutoStartChatConfig()
|
||||||
@@ -324,6 +335,30 @@ mittBus.on('auto-start-chat-with-boss-config-saved', fetchAutoStartChatConfig)
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
mittBus.off('auto-start-chat-with-boss-config-saved', fetchAutoStartChatConfig)
|
mittBus.off('auto-start-chat-with-boss-config-saved', fetchAutoStartChatConfig)
|
||||||
})
|
})
|
||||||
|
const commonJobConditionConfig = ref({})
|
||||||
|
const unListenCommonJobConditionConfig = electron.ipcRenderer.on(
|
||||||
|
'common-job-condition-config-updated',
|
||||||
|
(_, { config }) => {
|
||||||
|
commonJobConditionConfig.value = {
|
||||||
|
...config,
|
||||||
|
expectCompanies: config?.expectCompanies?.map((it) => it.trim())?.join(',') ?? ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
onUnmounted(() => {
|
||||||
|
unListenCommonJobConditionConfig()
|
||||||
|
})
|
||||||
|
|
||||||
|
const expectJobTypeRegExpStrForRender = computed(() => {
|
||||||
|
return !fieldsForUseCommonConfig.value.jobDetail
|
||||||
|
? expectJobTypeRegExpStr.value
|
||||||
|
: commonJobConditionConfig.value.expectJobTypeRegExpStr
|
||||||
|
})
|
||||||
|
const blockCompanyNameRegExpStrForRender = computed(() => {
|
||||||
|
return !fieldsForUseCommonConfig.value.blockCompanyNameRegExpStr
|
||||||
|
? blockCompanyNameRegExpStr.value
|
||||||
|
: commonJobConditionConfig.value.blockCompanyNameRegExpStr
|
||||||
|
})
|
||||||
|
|
||||||
const resumeContent = ref(null)
|
const resumeContent = ref(null)
|
||||||
async function fetchResumeContent() {
|
async function fetchResumeContent() {
|
||||||
|
|||||||
Reference in New Issue
Block a user