AI润色用新加载特效

This commit is contained in:
2026-07-09 16:26:29 +08:00
parent ec6ba7ee35
commit cd64ded6ae
3 changed files with 66 additions and 17 deletions
+56 -7
View File
@@ -115,6 +115,17 @@
</div>
<!-- 全屏加载遮罩 -->
<FullscreenLoading :visible="fullLoading" :text="fullLoadingText" title="Nova 正在帮您努力处理~" />
<!-- AI润色步骤进度遮罩 -->
<StepProgressOverlay
v-if="showPolishProgress"
:title="polishProgressTitle"
:subtitle="polishProgressSubtitle"
:steps="polishProgressSteps"
:durations="polishProgressDurations"
:done="polishProgressDone"
@finished="handlePolishProgressFinished"
@close="handlePolishProgressClose"
/>
</template>
<script setup lang="ts">
@@ -122,6 +133,7 @@ import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { polishDiagnosisIssue } from '@/api/resume'
import FullscreenLoading from '@/components/FullscreenLoading.vue'
import StepProgressOverlay from '@/components/StepProgressOverlay.vue'
/** 描述段落结构 */
interface DescriptionParagraph {
@@ -195,25 +207,62 @@ async function handleAiPolish() {
return
}
aiPolishing.value = true
fullLoadingText.value = 'AI正在润色中……'
fullLoading.value = true
// 显示步骤进度遮罩
showPolishProgress.value = true
polishProgressDone.value = false
try {
const content = text.split('\n').filter(s => s.trim())
const res = await polishDiagnosisIssue(content)
if (res.code === 0 && res.data?.content) {
aiPolishResult.value = res.data.content.join('\n')
ElMessage.success('AI润色完成')
pendingPolishResult.value = res.data.content.join('\n')
polishProgressDone.value = true
} else {
showPolishProgress.value = false
aiPolishing.value = false
ElMessage.error(res.msg || '润色失败')
}
} catch {
ElMessage.error('请求失败')
} finally {
showPolishProgress.value = false
aiPolishing.value = false
fullLoading.value = false
ElMessage.error('请求失败')
}
}
// ==================== AI润色步骤进度遮罩 ====================
/** 润色步骤进度遮罩是否显示 */
const showPolishProgress = ref(false)
/** 润色接口是否已完成 */
const polishProgressDone = ref(false)
/** 大标题 */
const polishProgressTitle = 'Nova正在润色中...'
/** 副标题 */
const polishProgressSubtitle = '正在根据岗位要求润色简历,突出你的核心优势'
/** 4个步骤名称 */
const polishProgressSteps = ['提取核心关键词...', '寻找符合的语义...', '排版文字格式...', '最终生成中...']
/** 每步时长1400毫秒 */
const polishProgressDurations = [1400, 1400, 1400, 1400]
/** 缓存润色结果 */
const pendingPolishResult = ref('')
/** 润色进度走完后填充结果 */
function handlePolishProgressFinished() {
showPolishProgress.value = false
aiPolishing.value = false
if (pendingPolishResult.value) {
aiPolishResult.value = pendingPolishResult.value
ElMessage.success('AI润色完成')
}
pendingPolishResult.value = ''
}
/** 关闭润色进度遮罩 */
function handlePolishProgressClose() {
showPolishProgress.value = false
aiPolishing.value = false
pendingPolishResult.value = ''
}
/** 替换为AI润色内容 */
function handleReplaceWithAi() {
if (aiPolishResult.value) {