feat: 完善专家支持中心和项目库单元导航功能

- 添加真实的文旅产业Q&A数据到专家支持中心
- 实现项目库到课程直播间的单元导航
- 新增CourseList组件的expandUnitByName方法
- 优化项目详情模态框的单元显示和交互

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
KQL
2025-09-12 19:52:36 +08:00
parent 0e7f98d3fc
commit 4738a8545c
11 changed files with 938 additions and 144 deletions

View File

@@ -27,6 +27,60 @@ const CourseList = forwardRef(({ className = "", onCourseClick }, ref) => {
// 暴露方法给父组件调用
useImperativeHandle(ref, () => ({
// 新增:通过单元名称展开对应的折叠面板
expandUnitByName: (unitName) => {
console.log('CourseList - expandUnitByName called:', unitName);
// 在两个列表中查找单元
const allLists = [
{ list: compoundCourseList, type: 'compound' },
{ list: verticalCourseList, type: 'vertical' }
];
for (const { list, type } of allLists) {
for (let i = 0; i < list.length; i++) {
const unit = list[i];
console.log(`Checking ${type} unit:`, unit.unitName);
if (unit.unitName === unitName) {
console.log('Found matching unit:', unit.unitName);
// 计算正确的 activeKey
let activeKey;
if (type === 'compound') {
activeKey = String(i + 1);
} else {
// 垂直课程使用特定的前缀
activeKey = `vertical-${i + 1}`;
}
// 展开对应的单元
setActiveKeys(prevKeys => {
if (!prevKeys.includes(activeKey)) {
console.log('Adding activeKey:', activeKey, 'to existing keys:', prevKeys);
return [...prevKeys, activeKey];
}
return prevKeys;
});
// 滚动到对应的单元位置
setTimeout(() => {
const collapseItems = document.querySelectorAll('.course-list-item');
if (collapseItems[type === 'compound' ? i : i + compoundCourseList.length]) {
collapseItems[type === 'compound' ? i : i + compoundCourseList.length].scrollIntoView({
behavior: 'smooth',
block: 'center'
});
}
}, 300);
return; // 找到后退出
}
}
}
console.log('Unit not found:', unitName);
},
selectCourse: (courseId, courseName) => {
console.log('CourseList - selectCourse called:', courseId, courseName);
console.log('CourseList - compoundCourseList:', compoundCourseList);