diff --git a/src/components/common/preview/DocumentPreview.vue b/src/components/common/preview/DocumentPreview.vue index f6e7f44..fb2f910 100644 --- a/src/components/common/preview/DocumentPreview.vue +++ b/src/components/common/preview/DocumentPreview.vue @@ -7,7 +7,7 @@
-

{{ detailData.name || '文档标题' }}

+

{{ detailData.name}}.{{ detailData.fileUrl.split('.').pop() }}

@@ -65,7 +65,7 @@
-

{{ detailData.name }}

+

{{ detailData.name }}.{{ detailData.fileUrl.split('.').pop() }}

{{ detailData.description }}

@@ -73,7 +73,7 @@
- + diff --git a/src/components/common/preview/HomeworkPreview.vue b/src/components/common/preview/HomeworkPreview.vue index 55cb8ad..8cd8f20 100644 --- a/src/components/common/preview/HomeworkPreview.vue +++ b/src/components/common/preview/HomeworkPreview.vue @@ -59,8 +59,7 @@
作业描述
-
- {{ detailData.description || '暂无作业要求说明' }} +
diff --git a/src/components/common/preview/VideoPreview.vue b/src/components/common/preview/VideoPreview.vue index 6503dd8..6e3dd33 100644 --- a/src/components/common/preview/VideoPreview.vue +++ b/src/components/common/preview/VideoPreview.vue @@ -12,7 +12,9 @@ 视频 @@ -40,24 +42,6 @@
- - -
- - 画质: - - - {{ quality.name }} - - - -
@@ -99,11 +83,9 @@ import { NIcon, NSpin, NResult, - NButton, NDivider, NDescriptions, NDescriptionsItem, - NButtonGroup, useMessage } from 'naive-ui' import { PlayCircleOutline } from '@vicons/ionicons5' @@ -178,10 +160,10 @@ const getQualityNameFromUrl = (url: string, index: number): string => { } // 获取画质名称 - 根据链接内容判断画质 -const getQualityName = (index: number) => { - const quality = videoQualities.value[index] - return quality?.name || `画质${index + 1}` -} +// const getQualityName = (index: number) => { +// const quality = videoQualities.value[index] +// return quality?.name || `画质${index + 1}` +// } // 获取当前播放的视频源 const currentVideoSource = computed(() => { @@ -219,6 +201,7 @@ const initDPlayer = async () => { defaultQuality: currentQualityIndex.value } : {} + // 创建新的DPlayer实例 dplayer = new DPlayer({ container: dplayerContainer.value, @@ -255,25 +238,8 @@ const initDPlayer = async () => { airplay: false, chromecast: false }) + videoLoading.value = false - // 监听播放器事件 - dplayer.on('loadstart', () => { - videoLoading.value = true - }) - - dplayer.on('loadedmetadata', () => { - videoLoading.value = false - }) - - dplayer.on('canplay', () => { - videoLoading.value = false - }) - - dplayer.on('error', (info?: any) => { - videoLoading.value = false - console.error('DPlayer播放错误:', info) - emit('error', '视频播放失败,请检查视频链接是否有效') - }) } catch (error) { videoLoading.value = false @@ -282,60 +248,6 @@ const initDPlayer = async () => { } } -// 切换画质 -const switchQuality = async (index: number) => { - if (index === currentQualityIndex.value || !dplayer || videoQualities.value.length <= 1) return - - try { - // 如果DPlayer支持内置画质切换,使用switchQuality方法 - if (typeof dplayer.switchQuality === 'function') { - dplayer.switchQuality(index) - return - } - - // 否则手动切换(保存当前播放状态) - const currentTime = dplayer.video.currentTime - const isPaused = dplayer.video.paused - const currentVolume = dplayer.volume() - - currentQualityIndex.value = index - - // 重新初始化播放器 - await initDPlayer() - - // 恢复播放状态 - if (dplayer && dplayer.video) { - const waitForLoad = () => { - return new Promise((resolve) => { - const checkLoad = () => { - if (dplayer && dplayer.video.readyState >= 2) { - try { - dplayer.video.currentTime = currentTime - dplayer.volume(currentVolume) - if (!isPaused) { - dplayer.play().catch(console.error) - } - } catch (error) { - console.warn('恢复播放状态时出错:', error) - } - resolve() - } else { - setTimeout(checkLoad, 100) - } - } - checkLoad() - }) - } - - await waitForLoad() - } - - message.success(`已切换到${getQualityName(index)}`) - } catch (error) { - console.error('切换画质失败:', error) - message.error('切换画质失败') - } -} // 格式化文件大小 const formatFileSize = (bytes: number | string) => { @@ -450,57 +362,6 @@ onUnmounted(() => { z-index: 10; } -.quality-selector { - position: absolute; - top: 12px; - right: 12px; - background: rgba(0, 0, 0, 0.7); - padding: 8px 12px; - border-radius: 6px; - z-index: 5; -} - -.quality-label { - color: white; - font-size: 12px; -} - -.no-video { - padding: 40px 20px; - text-align: center; -} - -.video-description { - margin-bottom: 20px; -} - -.video-description h5 { - margin: 0 0 8px 0; - font-size: 14px; - color: #333; - font-weight: 600; -} - -.description-content { - background: #f8f9fa; - padding: 12px; - border-radius: 6px; - font-size: 14px; - line-height: 1.6; - color: #555; - white-space: pre-wrap; -} - -.video-details { - margin-top: 20px; -} - -.quality-count, -.duration, -.file-size { - white-space: nowrap; -} - /* DPlayer 样式覆盖 */ :deep(.dplayer) { border-radius: 8px; @@ -534,17 +395,5 @@ onUnmounted(() => { .dplayer-container { height: 250px; } - - .quality-selector { - position: static; - background: rgba(0, 0, 0, 0.9); - margin-top: 8px; - border-radius: 6px; - } - - .quality-label { - display: block; - margin-bottom: 4px; - } } \ No newline at end of file diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 9417728..423ac5f 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -81,12 +81,12 @@
-
+
diff --git a/src/views/teacher/course/ChapterManagement.vue b/src/views/teacher/course/ChapterManagement.vue index 531113f..041e77d 100644 --- a/src/views/teacher/course/ChapterManagement.vue +++ b/src/views/teacher/course/ChapterManagement.vue @@ -149,7 +149,7 @@ const flattenedChapters = computed(() => { if (a.sortOrder === null && b.sortOrder === null) return 0 if (a.sortOrder === null) return 1 if (b.sortOrder === null) return -1 - return (a.sortOrder || 0) - (b.sortOrder || 0) + return (b.sortOrder || 0) - (a.sortOrder || 0) }) // 为每个章节添加其子节 diff --git a/src/views/teacher/course/DiscussionManagement.vue b/src/views/teacher/course/DiscussionManagement.vue index 7d17359..adc4402 100644 --- a/src/views/teacher/course/DiscussionManagement.vue +++ b/src/views/teacher/course/DiscussionManagement.vue @@ -85,36 +85,13 @@ - - - -
- - - - - - - - - - - -
- -