更新内容: - 后端 AI 服务优化(能力分析、知识点解析等) - 前端考试和陪练界面更新 - 修复多个 prompt 和 JSON 解析问题 - 更新 Coze 语音客户端
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<h2 class="course-title">{{ courseInfo.title }}</h2>
|
||||
<span class="powered-by">
|
||||
<el-icon><Connection /></el-icon>
|
||||
由 Dify 对话流驱动
|
||||
智能对话助手
|
||||
</span>
|
||||
</div>
|
||||
<el-button link @click="clearChat">
|
||||
@@ -512,19 +512,37 @@ const scrollToBottom = async () => {
|
||||
const loadCourseInfo = async () => {
|
||||
try {
|
||||
const courseId = parseInt(courseInfo.value.id)
|
||||
if (isNaN(courseId)) {
|
||||
if (isNaN(courseId) || courseId <= 0) {
|
||||
console.warn('无效的课程ID:', courseInfo.value.id)
|
||||
courseInfo.value.title = '未知课程'
|
||||
return
|
||||
}
|
||||
const res: any = await getCourseDetail(courseId)
|
||||
// API 返回格式是 { code: 200, data: { name: "...", ... } }
|
||||
if (res.code === 200 && res.data) {
|
||||
courseInfo.value.title = res.data.title || res.data.name || '未命名课程'
|
||||
console.log('课程详情API响应:', res)
|
||||
|
||||
// 兼容不同的响应格式
|
||||
// 格式1: { code: 200, data: { name: "...", ... } }
|
||||
// 格式2: 直接返回课程对象 { name: "...", ... }
|
||||
let courseData = res
|
||||
if (res.code !== undefined && res.data) {
|
||||
// 标准响应格式
|
||||
if (res.code === 200) {
|
||||
courseData = res.data
|
||||
} else {
|
||||
console.warn('获取课程详情失败:', res.message || '未知错误')
|
||||
courseInfo.value.title = '未知课程'
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 从课程数据中提取名称
|
||||
const courseName = courseData?.title || courseData?.name
|
||||
if (courseName) {
|
||||
courseInfo.value.title = courseName
|
||||
console.log('课程详情已加载:', courseInfo.value.title)
|
||||
} else {
|
||||
console.warn('获取课程详情失败:', res.message || '未知错误')
|
||||
courseInfo.value.title = '未知课程'
|
||||
console.warn('课程数据中缺少名称字段:', courseData)
|
||||
courseInfo.value.title = '未命名课程'
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('加载课程详情失败:', error)
|
||||
|
||||
@@ -321,8 +321,7 @@ const pdfScaleStyle = computed(() => {
|
||||
const scale = 1 / pdfRenderScale.value
|
||||
return {
|
||||
transform: `scale(${scale})`,
|
||||
transformOrigin: 'top left',
|
||||
width: `${100 * pdfRenderScale.value}%`
|
||||
transformOrigin: 'top center'
|
||||
}
|
||||
})
|
||||
|
||||
@@ -911,6 +910,7 @@ onUnmounted(() => {
|
||||
padding: 10px 20px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
flex-shrink: 0;
|
||||
|
||||
.page-controls,
|
||||
.zoom-controls {
|
||||
@@ -933,10 +933,12 @@ onUnmounted(() => {
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
|
||||
// 高清渲染缩放容器
|
||||
.pdf-scale-wrapper {
|
||||
display: inline-block;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
:deep(.vue-pdf-embed) {
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
<div class="header-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="loadingRecommendations"
|
||||
:loading="analyzing"
|
||||
@click="refreshRecommendations"
|
||||
class="refresh-btn"
|
||||
>
|
||||
@@ -405,7 +405,6 @@ const abilityFeedback = ref<AbilityFeedback[]>([])
|
||||
|
||||
// AI 分析和推荐相关
|
||||
const analyzing = ref(false)
|
||||
const loadingRecommendations = ref(false)
|
||||
const selectedPriority = ref('all')
|
||||
|
||||
// 计算属性:过滤后的课程
|
||||
@@ -723,81 +722,11 @@ const analyzeSmartBadgeData = async () => {
|
||||
|
||||
/**
|
||||
* 刷新AI推荐课程
|
||||
* 重新调用AI分析接口,获取最新的课程推荐
|
||||
*/
|
||||
const refreshRecommendations = async () => {
|
||||
loadingRecommendations.value = true
|
||||
|
||||
try {
|
||||
// 模拟AI推荐算法
|
||||
await new Promise(resolve => setTimeout(resolve, 1500))
|
||||
|
||||
// 根据能力评估结果生成推荐
|
||||
const weakPoints = abilityData.value
|
||||
.filter(item => item.value < 85)
|
||||
.sort((a, b) => a.value - b.value)
|
||||
.slice(0, 3)
|
||||
|
||||
// 更新推荐课程(基于薄弱环节)
|
||||
const newRecommendations = []
|
||||
|
||||
if (weakPoints.some(p => p.name === '沟通技巧')) {
|
||||
newRecommendations.push({
|
||||
id: 1,
|
||||
name: '美容咨询与沟通技巧',
|
||||
description: '提升与客户的沟通能力,学习专业的美容咨询技巧',
|
||||
duration: 8,
|
||||
difficulty: 'medium',
|
||||
learnerCount: 156,
|
||||
priority: 'high',
|
||||
targetWeakPoints: ['沟通技巧'],
|
||||
expectedImprovement: 12,
|
||||
matchScore: 95,
|
||||
progress: 85,
|
||||
examPassed: false
|
||||
})
|
||||
}
|
||||
|
||||
if (weakPoints.some(p => p.name === '应变能力')) {
|
||||
newRecommendations.push({
|
||||
id: 2,
|
||||
name: '皮肤问题识别与处理',
|
||||
description: '学习识别常见皮肤问题,掌握针对性的护理和治疗方案',
|
||||
duration: 12,
|
||||
difficulty: 'hard',
|
||||
learnerCount: 89,
|
||||
priority: 'medium',
|
||||
targetWeakPoints: ['应变能力'],
|
||||
expectedImprovement: 15,
|
||||
matchScore: 88,
|
||||
progress: 95,
|
||||
examPassed: true
|
||||
})
|
||||
}
|
||||
|
||||
if (weakPoints.some(p => p.name === '安全意识')) {
|
||||
newRecommendations.push({
|
||||
id: 3,
|
||||
name: '轻医美项目与效果管理',
|
||||
description: '深入了解各种轻医美项目,掌握效果评估和管理方法',
|
||||
duration: 16,
|
||||
difficulty: 'hard',
|
||||
learnerCount: 234,
|
||||
priority: 'medium',
|
||||
targetWeakPoints: ['安全意识'],
|
||||
expectedImprovement: 10,
|
||||
matchScore: 82,
|
||||
progress: 60,
|
||||
examPassed: false
|
||||
})
|
||||
}
|
||||
|
||||
recommendedCourses.value = newRecommendations
|
||||
|
||||
} catch (error) {
|
||||
ElMessage.error('获取推荐课程失败')
|
||||
} finally {
|
||||
loadingRecommendations.value = false
|
||||
}
|
||||
// 直接调用AI分析智能工牌数据的方法,复用已有逻辑
|
||||
await analyzeSmartBadgeData()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user