ai助手投递偏好设置修复
This commit is contained in:
+169
-38
@@ -814,6 +814,14 @@ async function handleStartApply() {
|
||||
if (isApplying.value) return
|
||||
isApplying.value = true
|
||||
|
||||
// 刷新最新配置(确保优化开关状态准确)
|
||||
try {
|
||||
const configRes = await fetchAgentConfig()
|
||||
if (configRes.code === '0' && configRes.data) {
|
||||
agentConfig.value = configRes.data
|
||||
}
|
||||
} catch { /* 静默 */ }
|
||||
|
||||
await loadApplyList()
|
||||
|
||||
if (applyJobList.value.length === 0) {
|
||||
@@ -825,22 +833,60 @@ async function handleStartApply() {
|
||||
// 取第一个岗位
|
||||
const targetJob = applyJobList.value[0]
|
||||
|
||||
// 创建进度条目
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 1,
|
||||
stepPhase: 'loading',
|
||||
resumeName: '岗位专属简历',
|
||||
// 判断是否开启简历针对性优化(从配置中读取)
|
||||
const isOptimizeEnabled = agentConfig.value?.autoOptimizeResume === 1
|
||||
// 判断是否开启深度人岗匹配分析
|
||||
const isMatchEnabled = agentConfig.value?.acceptDeptTransfer === '是'
|
||||
|
||||
if (isOptimizeEnabled) {
|
||||
// 开启优化:从第1步开始
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 1,
|
||||
stepPhase: 'loading',
|
||||
resumeName: '岗位专属简历',
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
|
||||
// 开始第1步:优化简历
|
||||
await startResumeOptimization(targetJob)
|
||||
} else if (isMatchEnabled) {
|
||||
// 关闭优化但开启匹配分析:跳过第1步,直接进入第2步
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 2,
|
||||
stepPhase: 'loading',
|
||||
resumeName: '默认简历',
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
|
||||
// 直接进入第2步:匹配分析(使用默认简历ID)
|
||||
await startMatchAnalysisWithResumeId()
|
||||
} else {
|
||||
// 优化和匹配分析都关闭:跳过第1、2步,直接进入第3步
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 3,
|
||||
stepPhase: 'ready',
|
||||
resumeName: '默认简历',
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
|
||||
// 开始第1步:优化简历
|
||||
await startResumeOptimization(targetJob)
|
||||
}
|
||||
|
||||
/** 执行简历优化(第1步) */
|
||||
@@ -916,22 +962,33 @@ async function handleViewResumeStep() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 第1步完成:确认简历 → 自动进入第2步匹配分析 */
|
||||
/** 第1步完成:确认简历 → 自动进入第2步匹配分析(或跳过) */
|
||||
async function handleConfirmResumeStep() {
|
||||
const progressItem = applyProgressList.value[0]
|
||||
if (!progressItem) return
|
||||
|
||||
// 进入第2步
|
||||
progressItem.step = 2
|
||||
progressItem.stepPhase = 'loading'
|
||||
applyProgressList.value = [...applyProgressList.value]
|
||||
saveProgressToStorage()
|
||||
|
||||
// 关闭简历预览抽屉
|
||||
showResumeDrawer.value = false
|
||||
|
||||
// 调用匹配分析流程
|
||||
await startMatchAnalysis()
|
||||
// 判断是否开启深度人岗匹配分析
|
||||
const isMatchEnabled = agentConfig.value?.acceptDeptTransfer === '是'
|
||||
|
||||
if (isMatchEnabled) {
|
||||
// 进入第2步
|
||||
progressItem.step = 2
|
||||
progressItem.stepPhase = 'loading'
|
||||
applyProgressList.value = [...applyProgressList.value]
|
||||
saveProgressToStorage()
|
||||
|
||||
// 调用匹配分析流程
|
||||
await startMatchAnalysis()
|
||||
} else {
|
||||
// 匹配分析关闭:跳过第2步直接进入第3步
|
||||
progressItem.step = 3
|
||||
progressItem.stepPhase = 'ready'
|
||||
applyProgressList.value = [...applyProgressList.value]
|
||||
saveProgressToStorage()
|
||||
}
|
||||
}
|
||||
|
||||
/** 执行匹配分析(第2步) */
|
||||
@@ -984,6 +1041,42 @@ async function startMatchAnalysis() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 执行匹配分析(第2步) — 关闭优化时使用默认简历ID */
|
||||
async function startMatchAnalysisWithResumeId() {
|
||||
const progressItem = applyProgressList.value[0]
|
||||
if (!progressItem) return
|
||||
|
||||
try {
|
||||
// 使用默认简历ID调用匹配分析接口
|
||||
const scoreRes = await fetchMatchScore({
|
||||
resumeId: defaultResumeId.value,
|
||||
jobId: String(progressItem.jobInfo.id),
|
||||
})
|
||||
|
||||
if (applyCancelled.value) return
|
||||
|
||||
const score = scoreRes?.data ?? 0
|
||||
progressItem.matchScore = score
|
||||
|
||||
if (score >= 40) {
|
||||
// 匹配度 >= 40,直接进入第3步
|
||||
progressItem.step = 3
|
||||
progressItem.stepPhase = 'ready'
|
||||
} else {
|
||||
// 匹配度 < 40,显示低匹配提示
|
||||
progressItem.step = 2
|
||||
progressItem.stepPhase = 'low-match'
|
||||
}
|
||||
// 触发响应式更新
|
||||
applyProgressList.value = [...applyProgressList.value]
|
||||
saveProgressToStorage()
|
||||
} catch (e) {
|
||||
if (applyCancelled.value) return
|
||||
console.error('[Agent] 匹配分析失败(默认简历)', e)
|
||||
ElMessage.error('匹配分析失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
/** 第2步匹配度低:不投递 — 取消该岗位 */
|
||||
async function handleNotApplyStep() {
|
||||
const progressItem = applyProgressList.value[0]
|
||||
@@ -1095,21 +1188,59 @@ async function autoStartNextApply() {
|
||||
|
||||
// 取下一个岗位
|
||||
const targetJob = applyJobList.value[0]
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 1,
|
||||
stepPhase: 'loading',
|
||||
resumeName: '岗位专属简历',
|
||||
|
||||
// 判断是否开启简历针对性优化
|
||||
const isOptimizeEnabled = agentConfig.value?.autoOptimizeResume === 1
|
||||
// 判断是否开启深度人岗匹配分析
|
||||
const isMatchEnabled = agentConfig.value?.acceptDeptTransfer === '是'
|
||||
|
||||
if (isOptimizeEnabled) {
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 1,
|
||||
stepPhase: 'loading',
|
||||
resumeName: '岗位专属简历',
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
|
||||
// 开始第1步:优化简历
|
||||
await startResumeOptimization(targetJob)
|
||||
} else if (isMatchEnabled) {
|
||||
// 关闭优化但开启匹配分析:跳过第1步,直接进入第2步
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 2,
|
||||
stepPhase: 'loading',
|
||||
resumeName: '默认简历',
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
|
||||
await startMatchAnalysisWithResumeId()
|
||||
} else {
|
||||
// 优化和匹配分析都关闭:跳过第1、2步,直接进入第3步
|
||||
const progressItem: ApplyProgressItem = {
|
||||
id: Date.now(),
|
||||
jobInfo: targetJob,
|
||||
step: 3,
|
||||
stepPhase: 'ready',
|
||||
resumeName: '默认简历',
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
}
|
||||
applyProgressList.value = [progressItem]
|
||||
saveProgressToStorage()
|
||||
|
||||
await nextTick()
|
||||
scrollContentToBottom()
|
||||
|
||||
// 开始第1步:优化简历
|
||||
await startResumeOptimization(targetJob)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user