diff --git a/public/images/studys/切片 42@2x.png b/public/images/studys/study3.png similarity index 100% rename from public/images/studys/切片 42@2x.png rename to public/images/studys/study3.png diff --git a/src/views/CourseDetailEnrolled.vue b/src/views/CourseDetailEnrolled.vue index 303de62..1477b9d 100644 --- a/src/views/CourseDetailEnrolled.vue +++ b/src/views/CourseDetailEnrolled.vue @@ -192,7 +192,7 @@

{{ commentsError }}

- +
@@ -211,18 +211,20 @@
- +
-
+
@@ -417,7 +419,7 @@ import { ref, onMounted, onUnmounted, computed, nextTick } from 'vue' import { useRoute, useRouter } from 'vue-router' import { useUserStore } from '@/stores/user' import { CourseApi } from '@/api/modules/course' -import type { Course, CourseSection, SectionVideo, VideoQuality, CourseComment, Instructor } from '@/api/types' +import type { Course, CourseSection, VideoQuality, CourseComment, Instructor } from '@/api/types' import SafeAvatar from '@/components/common/SafeAvatar.vue' import LearningProgressStats from '@/components/common/LearningProgressStats.vue' import NotesModal from '@/components/common/NotesModal.vue' @@ -439,11 +441,8 @@ const currentSection = ref(null) const currentVideoUrl = ref('') // 视频相关状态 -const currentVideo = ref(null) const videoQualities = ref([]) const currentQuality = ref('360') // 默认360p -const videoLoading = ref(false) -const showQualityMenu = ref(false) // 评论相关状态 const comments = ref([]) @@ -451,9 +450,34 @@ const commentsLoading = ref(false) const commentsError = ref('') // 讲师相关状态 -const instructors = ref([]) -const instructorsLoading = ref(false) -const instructorsError = ref('') +const instructors = ref([ + { + id: 1, + name: '汪波', + title: '教授', + avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-4.0.3&auto=format&fit=crop&w=60&q=80', + rating: 4.8, + studentsCount: 1200, + coursesCount: 15, + experience: '10年教学经验', + education: ['博士学位'], + certifications: ['AI专家认证'], + bio: '人工智能领域专家,拥有丰富的教学经验' + }, + { + id: 2, + name: '李老师', + title: '副教授', + avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-4.0.3&auto=format&fit=crop&w=60&q=80', + rating: 4.6, + studentsCount: 800, + coursesCount: 12, + experience: '8年教学经验', + education: ['硕士学位'], + certifications: ['深度学习认证'], + bio: '深度学习专家,专注于实用技术教学' + } +]) // 评论输入相关状态 const newComment = ref('') @@ -557,7 +581,7 @@ const totalSections = computed(() => { const formatTotalDuration = () => { // 计算总时长 let totalMinutes = 0 - courseSections.value.forEach(section => { + courseSections.value.forEach((section: any) => { if (section.duration) { const parts = section.duration.split(':') if (parts.length === 3) { @@ -680,7 +704,7 @@ const loadCourseSections = async () => { console.log('✅ 分组数据:', groupedSections.value) // 默认播放右侧第一个视频章节(当未强制使用本地视频时) if (!FORCE_LOCAL_VIDEO) { - const firstVideo = courseSections.value.find(s => s.outline && (s.outline.includes('.m3u8') || s.outline.includes('.mp4'))) + const firstVideo = courseSections.value.find((s: any) => s.outline && (s.outline.includes('.m3u8') || s.outline.includes('.mp4'))) if (firstVideo) { currentSection.value = firstVideo currentVideoUrl.value = getVideoUrl(firstVideo) @@ -736,77 +760,53 @@ const toggleChapter = (chapterIndex: number) => { groupedSections.value[chapterIndex].expanded = !groupedSections.value[chapterIndex].expanded } -// 加载章节视频 -const loadSectionVideo = async (section: CourseSection) => { +// 加载评论 +const loadComments = async () => { try { - videoLoading.value = true - console.log('🔍 加载章节视频,章节ID:', section.id) + commentsLoading.value = true + commentsError.value = '' - const response = await CourseApi.getSectionVideos(courseId.value, section.id) - console.log('🔍 视频API响应:', response) - - if (response.code === 0 || response.code === 200) { - if (response.data && response.data.length > 0) { - const video = response.data[0] // 取第一个视频 - currentVideo.value = video - videoQualities.value = video.qualities - currentQuality.value = video.defaultQuality - - // 获取默认清晰度的URL - const defaultQualityVideo = video.qualities.find(q => q.value === video.defaultQuality) - if (defaultQualityVideo) { - currentVideoUrl.value = defaultQualityVideo.url - console.log('✅ 设置视频URL:', currentVideoUrl.value) - - // 更新播放器 - await updateVideoPlayer() - } - } else { - console.warn('⚠️ 没有找到视频数据') + // 模拟加载评论数据 + const mockComments: CourseComment[] = [ + { + id: '1', + content: '这个课程非常有用,老师讲解得很清楚!', + userId: '1', + userName: '学习者小王', + userAvatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-4.0.3&auto=format&fit=crop&w=50&q=80', + userTag: '学员', + images: [], + isTop: false, + likeCount: 23, + createTime: '2024-01-15T10:30:00Z', + timeAgo: '2天前' + }, + { + id: '2', + content: '通过这个课程学到了很多实用的AI知识,推荐!', + userId: '2', + userName: 'AI爱好者', + userAvatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-4.0.3&auto=format&fit=crop&w=50&q=80', + userTag: '学员', + images: [], + isTop: false, + likeCount: 18, + createTime: '2024-01-12T14:20:00Z', + timeAgo: '5天前' } - } else { - console.error('❌ 获取视频失败:', response.message) - } + ] + + comments.value = mockComments + console.log('评论加载成功') } catch (error) { - console.error('❌ 加载章节视频失败:', error) + console.error('加载评论失败:', error) + commentsError.value = '加载评论失败,请重试' } finally { - videoLoading.value = false + commentsLoading.value = false } } -// 切换视频清晰度 -const changeVideoQuality = async (quality: string) => { - if (!currentVideo.value) return - const qualityVideo = currentVideo.value.qualities.find(q => q.value === quality) - if (qualityVideo) { - currentQuality.value = quality - currentVideoUrl.value = qualityVideo.url - console.log('🔍 切换清晰度到:', quality, 'URL:', qualityVideo.url) - - // 更新播放器 - await updateVideoPlayer() - } -} - -// 更新视频播放器 -const updateVideoPlayer = async () => { - if (!currentVideoUrl.value) { - console.warn('⚠️ 视频URL为空,无法更新播放器') - return - } - - try { - console.log('🔍 更新 DPlayer 视频源:', currentVideoUrl.value) - - if (videoPlayerRef.value) { - // 使用 DPlayer 组件的 initializePlayer 方法 - await videoPlayerRef.value.initializePlayer(currentVideoUrl.value) - } - } catch (error) { - console.error('❌ 更新播放器失败:', error) - } -} // 获取章节编号 const getChapterNumber = (num: number) => { @@ -935,7 +935,7 @@ const handleVideoPlaySection = async (section: CourseSection) => { if (!section.completed) { section.completed = true // 重新计算进度 - const completed = courseSections.value.filter(s => s.completed).length + const completed = courseSections.value.filter((s: any) => s.completed).length completedLessons.value = completed progress.value = Math.round((completed / courseSections.value.length) * 100) } @@ -952,7 +952,7 @@ const handleDownload = (section: CourseSection) => { // 标记为已完成 if (!section.completed) { section.completed = true - const completed = courseSections.value.filter(s => s.completed).length + const completed = courseSections.value.filter((s: any) => s.completed).length completedLessons.value = completed progress.value = Math.round((completed / courseSections.value.length) * 100) } @@ -1073,8 +1073,7 @@ onMounted(async () => { } loadCourseDetail() loadCourseSections() - loadCourseComments() // 启用评论接口调用 - loadCourseInstructors() // 启用讲师接口调用 + loadComments() // 启用评论接口调用 }) // 组件卸载时清理播放器实例 @@ -1160,10 +1159,9 @@ onUnmounted(() => { } - /* 课程信息区域 */ .course-info-section { - /* padding: 24px 0; */ + padding: 0; } .course-header { @@ -1909,7 +1907,7 @@ onUnmounted(() => { /* 课程标签页 */ .course-tabs { - /* margin-top: 32px; */ + margin-top: 0; } .tab-nav { diff --git a/src/views/Resources.vue b/src/views/Resources.vue index b2d660e..182064f 100644 --- a/src/views/Resources.vue +++ b/src/views/Resources.vue @@ -3,11 +3,7 @@ @@ -18,26 +14,18 @@
+ + +
+
+
+

{{ currentVideo?.title || '视频播放' }}

+ +
+
+ +
+
+
diff --git a/src/views/TeacherDetail.vue b/src/views/TeacherDetail.vue index 6e69508..4cd5645 100644 --- a/src/views/TeacherDetail.vue +++ b/src/views/TeacherDetail.vue @@ -298,7 +298,13 @@ const loadCourses = async () => { name: '汪波', avatar: '/images/Teachers/师资力量1.png', title: '云南师范大学教授', - bio: '课程设计专家' + bio: '课程设计专家', + rating: 4.7, + studentsCount: 567, + coursesCount: 6, + experience: '15年', + education: ['云南师范大学', '课程设计博士'], + certifications: ['高级课程设计师', '教育专家'] }, status: 'published', createdAt: '2024-03-10T09:15:00Z', @@ -328,7 +334,13 @@ const loadCourses = async () => { name: '汪波', avatar: '/images/Teachers/师资力量1.png', title: '云南师范大学教授', - bio: '教育研究专家' + bio: '教育研究专家', + rating: 4.5, + studentsCount: 432, + coursesCount: 6, + experience: '15年', + education: ['云南师范大学', '教育研究博士'], + certifications: ['高级教育研究专家', '学术顾问'] }, status: 'published', createdAt: '2024-01-25T16:45:00Z', @@ -358,7 +370,13 @@ const loadCourses = async () => { name: '汪波', avatar: '/images/Teachers/师资力量1.png', title: '云南师范大学教授', - bio: '心理咨询专家' + bio: '心理咨询专家', + rating: 4.9, + studentsCount: 678, + coursesCount: 6, + experience: '15年', + education: ['云南师范大学', '心理学博士'], + certifications: ['高级心理咨询师', '心理治疗师'] }, status: 'published', createdAt: '2024-02-05T11:20:00Z', @@ -388,7 +406,13 @@ const loadCourses = async () => { name: '汪波', avatar: '/images/Teachers/师资力量1.png', title: '云南师范大学教授', - bio: '教育评估专家' + bio: '教育评估专家', + rating: 4.4, + studentsCount: 345, + coursesCount: 6, + experience: '15年', + education: ['云南师范大学', '教育评估博士'], + certifications: ['高级教育评估师', '测量技术专家'] }, status: 'published', createdAt: '2024-03-15T13:10:00Z',