fix:旧方法,mock数据删除
This commit is contained in:
parent
829660dbda
commit
a5a802c4a6
@ -726,7 +726,7 @@ const { loginModalVisible, registerModalVisible, handleAuthSuccess, showLoginMod
|
|||||||
// enrollCourse 暂时未使用,后续需要时再启用
|
// enrollCourse 暂时未使用,后续需要时再启用
|
||||||
|
|
||||||
// 当前选中的章节
|
// 当前选中的章节
|
||||||
const currentSection = ref<CourseSection | null>(null)
|
// const currentSection = ref<CourseSection | null>(null)
|
||||||
|
|
||||||
// 课程数据相关状态
|
// 课程数据相关状态
|
||||||
const course = ref<Course | null>(null)
|
const course = ref<Course | null>(null)
|
||||||
@ -767,14 +767,14 @@ const examProgress = ref(0)
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 计算用户是否已报名
|
// 计算用户是否已报名
|
||||||
const isUserEnrolled = computed(() => {
|
// const isUserEnrolled = computed(() => {
|
||||||
// 必须同时满足:用户已登录 AND 已报名该课程
|
// // 必须同时满足:用户已登录 AND 已报名该课程
|
||||||
return userStore.isLoggedIn && isEnrolled.value
|
// return userStore.isLoggedIn && isEnrolled.value
|
||||||
|
|
||||||
// 临时测试不同状态:
|
// // 临时测试不同状态:
|
||||||
// return false // 强制显示未报名状态(灰色不可点击)
|
// // return false // 强制显示未报名状态(灰色不可点击)
|
||||||
// return true // 强制显示已报名状态(彩色可点击)
|
// // return true // 强制显示已报名状态(彩色可点击)
|
||||||
})
|
// })
|
||||||
|
|
||||||
// 报名确认弹窗
|
// 报名确认弹窗
|
||||||
const enrollConfirmVisible = ref(false)
|
const enrollConfirmVisible = ref(false)
|
||||||
@ -1358,86 +1358,86 @@ const getLessonTypeBadgeClass = (section: CourseSection) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理下载操作
|
// 处理下载操作
|
||||||
const handleDownload = (section: CourseSection) => {
|
// const handleDownload = (section: CourseSection) => {
|
||||||
console.log('下载资料:', section)
|
// console.log('下载资料:', section)
|
||||||
// 这里可以实现下载逻辑
|
// // 这里可以实现下载逻辑
|
||||||
alert(`下载资料: ${section.name}`)
|
// alert(`下载资料: ${section.name}`)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 处理作业操作
|
// 处理作业操作
|
||||||
const handleHomework = (section: CourseSection) => {
|
// const handleHomework = (section: CourseSection) => {
|
||||||
console.log('打开作业:', section)
|
// console.log('打开作业:', section)
|
||||||
|
|
||||||
// 跳转到练习页面
|
// // 跳转到练习页面
|
||||||
router.push({
|
// router.push({
|
||||||
name: 'Practice',
|
// name: 'Practice',
|
||||||
params: {
|
// params: {
|
||||||
courseId: courseId.value,
|
// courseId: courseId.value,
|
||||||
sectionId: section.id
|
// sectionId: section.id
|
||||||
},
|
// },
|
||||||
query: {
|
// query: {
|
||||||
courseName: course.value?.title || '课程名称',
|
// courseName: course.value?.title || '课程名称',
|
||||||
practiceName: section.name
|
// practiceName: section.name
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 处理考试操作
|
// 处理考试操作
|
||||||
const handleExam = (section: CourseSection) => {
|
// const handleExam = (section: CourseSection) => {
|
||||||
console.log('开始考试:', section)
|
// console.log('开始考试:', section)
|
||||||
|
|
||||||
// 跳转到考前须知页面
|
// // 跳转到考前须知页面
|
||||||
router.push({
|
// router.push({
|
||||||
name: 'ExamNotice',
|
// name: 'ExamNotice',
|
||||||
params: {
|
// params: {
|
||||||
courseId: courseId.value,
|
// courseId: courseId.value,
|
||||||
sectionId: section.id
|
// sectionId: section.id
|
||||||
},
|
// },
|
||||||
query: {
|
// query: {
|
||||||
courseName: course.value?.title || '课程名称',
|
// courseName: course.value?.title || '课程名称',
|
||||||
examName: section.name
|
// examName: section.name
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 点击课程章节标题
|
// 点击课程章节标题
|
||||||
const handleSectionClick = (section: CourseSection) => {
|
// const handleSectionClick = (section: CourseSection) => {
|
||||||
console.log('点击课程章节:', section)
|
// console.log('点击课程章节:', section)
|
||||||
|
|
||||||
// 设置当前选中的章节
|
// // 设置当前选中的章节
|
||||||
currentSection.value = section
|
// currentSection.value = section
|
||||||
|
|
||||||
// 检查是否有视频链接
|
// // 检查是否有视频链接
|
||||||
if (section.outline && section.outline.includes('.m3u8')) {
|
// if (section.outline && section.outline.includes('.m3u8')) {
|
||||||
console.log('获取到视频链接:', section.outline)
|
// console.log('获取到视频链接:', section.outline)
|
||||||
|
|
||||||
// 跳转到已报名区域并播放视频
|
// // 跳转到已报名区域并播放视频
|
||||||
navigateToEnrolledArea(section.outline, section.name)
|
// navigateToEnrolledArea(section.outline, section.name)
|
||||||
} else {
|
// } else {
|
||||||
// 如果不是视频,显示预览
|
// // 如果不是视频,显示预览
|
||||||
previewSection(section)
|
// previewSection(section)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 跳转到已报名区域
|
// 跳转到已报名区域
|
||||||
const navigateToEnrolledArea = (videoUrl: string, sectionName: string) => {
|
// const navigateToEnrolledArea = (videoUrl: string, sectionName: string) => {
|
||||||
console.log('跳转到已报名区域,播放视频:', videoUrl)
|
// console.log('跳转到已报名区域,播放视频:', videoUrl)
|
||||||
console.log('章节名称:', sectionName)
|
// console.log('章节名称:', sectionName)
|
||||||
console.log('当前章节:', currentSection.value)
|
// console.log('当前章节:', currentSection.value)
|
||||||
|
|
||||||
// 使用路由跳转到学习页面
|
// // 使用路由跳转到学习页面
|
||||||
router.push({
|
// router.push({
|
||||||
name: 'CourseStudy',
|
// name: 'CourseStudy',
|
||||||
params: { id: courseId.value },
|
// params: { id: courseId.value },
|
||||||
query: {
|
// query: {
|
||||||
videoUrl: encodeURIComponent(videoUrl),
|
// videoUrl: encodeURIComponent(videoUrl),
|
||||||
sectionName: encodeURIComponent(sectionName),
|
// sectionName: encodeURIComponent(sectionName),
|
||||||
sectionId: currentSection.value?.id
|
// sectionId: currentSection.value?.id
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 更新视频播放器(备用方案)
|
// 更新视频播放器(备用方案)
|
||||||
// const updateVideoPlayer = (videoUrl: string, sectionName: string) => {
|
// const updateVideoPlayer = (videoUrl: string, sectionName: string) => {
|
||||||
@ -1454,14 +1454,14 @@ const navigateToEnrolledArea = (videoUrl: string, sectionName: string) => {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 预览章节(非视频内容)
|
// 预览章节(非视频内容)
|
||||||
const previewSection = (section: CourseSection) => {
|
// const previewSection = (section: CourseSection) => {
|
||||||
console.log('预览章节:', section)
|
// console.log('预览章节:', section)
|
||||||
|
|
||||||
previewModalTitle.value = section.name
|
// previewModalTitle.value = section.name
|
||||||
previewModalContent.value = `章节ID: ${section.id}\n章节名称: ${section.name}\n内容类型: ${getLessonTypeText(section)}`
|
// previewModalContent.value = `章节ID: ${section.id}\n章节名称: ${section.name}\n内容类型: ${getLessonTypeText(section)}`
|
||||||
previewModalType.value = 'section'
|
// previewModalType.value = 'section'
|
||||||
previewModalVisible.value = true
|
// previewModalVisible.value = true
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 关闭预览模态框
|
// 关闭预览模态框
|
||||||
const closePreviewModal = () => {
|
const closePreviewModal = () => {
|
||||||
|
@ -955,7 +955,7 @@ import { ref, computed, onMounted, onActivated } from 'vue'
|
|||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { useMessage } from 'naive-ui'
|
import { useMessage } from 'naive-ui'
|
||||||
// import { useAuth } from '@/composables/useAuth'
|
// import { useAuth } from '@/composables/useAuth'
|
||||||
import { useUserStore } from '@/stores/user'
|
// import { useUserStore } from '@/stores/user'
|
||||||
import { CourseApi } from '@/api/modules/course'
|
import { CourseApi } from '@/api/modules/course'
|
||||||
import type { Course, CourseSection } from '@/api/types'
|
import type { Course, CourseSection } from '@/api/types'
|
||||||
import QuillEditor from '@/components/common/QuillEditor.vue'
|
import QuillEditor from '@/components/common/QuillEditor.vue'
|
||||||
@ -967,7 +967,7 @@ import DPlayerVideo from '@/components/course/DPlayerVideo.vue'
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const userStore = useUserStore()
|
// const userStore = useUserStore()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const courseId = ref(String(route.params.id))
|
const courseId = ref(String(route.params.id))
|
||||||
// const { loginModalVisible, registerModalVisible, handleAuthSuccess, showLoginModal } = useAuth()
|
// const { loginModalVisible, registerModalVisible, handleAuthSuccess, showLoginModal } = useAuth()
|
||||||
@ -1015,14 +1015,14 @@ const examProgress = ref(0)
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 计算用户是否已报名
|
// 计算用户是否已报名
|
||||||
const isUserEnrolled = computed(() => {
|
// const isUserEnrolled = computed(() => {
|
||||||
// 必须同时满足:用户已登录 AND 已报名该课程
|
// // 必须同时满足:用户已登录 AND 已报名该课程
|
||||||
return userStore.isLoggedIn && isEnrolled.value
|
// return userStore.isLoggedIn && isEnrolled.value
|
||||||
|
|
||||||
// 临时测试不同状态:
|
// // 临时测试不同状态:
|
||||||
// return false // 强制显示未报名状态(灰色不可点击)
|
// // return false // 强制显示未报名状态(灰色不可点击)
|
||||||
// return true // 强制显示已报名状态(彩色可点击)
|
// // return true // 强制显示已报名状态(彩色可点击)
|
||||||
})
|
// })
|
||||||
|
|
||||||
// 报名确认弹窗
|
// 报名确认弹窗
|
||||||
const enrollConfirmVisible = ref(false)
|
const enrollConfirmVisible = ref(false)
|
||||||
@ -1135,22 +1135,22 @@ const previewModalContent = ref('')
|
|||||||
const previewModalType = ref('')
|
const previewModalType = ref('')
|
||||||
|
|
||||||
// 视频播放相关
|
// 视频播放相关
|
||||||
const VIDEO_CONFIG = {
|
// const VIDEO_CONFIG = {
|
||||||
// 本地视频(当前使用)
|
// // 本地视频(当前使用)
|
||||||
LOCAL: '/video/first.mp4',
|
// LOCAL: '/video/first.mp4',
|
||||||
// HLS流(服务器准备好后使用)
|
// // HLS流(服务器准备好后使用)
|
||||||
HLS: 'http://110.42.96.65:55513/learn/index.m3u8'
|
// HLS: 'http://110.42.96.65:55513/learn/index.m3u8'
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 获取视频URL的函数
|
// 获取视频URL的函数
|
||||||
const getVideoUrl = (section?: CourseSection) => {
|
// const getVideoUrl = (section?: CourseSection) => {
|
||||||
const outline = section?.outline?.trim()
|
// const outline = section?.outline?.trim()
|
||||||
if (outline && (outline.endsWith('.mp4') || outline.endsWith('.m3u8'))) {
|
// if (outline && (outline.endsWith('.mp4') || outline.endsWith('.m3u8'))) {
|
||||||
return outline
|
// return outline
|
||||||
}
|
// }
|
||||||
// 当前使用本地视频,将来可以通过环境变量或配置切换
|
// // 当前使用本地视频,将来可以通过环境变量或配置切换
|
||||||
return VIDEO_CONFIG.LOCAL
|
// return VIDEO_CONFIG.LOCAL
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 视频播放相关状态
|
// 视频播放相关状态
|
||||||
const currentVideoUrl = ref<string>('')
|
const currentVideoUrl = ref<string>('')
|
||||||
@ -1762,14 +1762,14 @@ const handleSectionClick = (section: CourseSection) => {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 预览章节(非视频内容)
|
// 预览章节(非视频内容)
|
||||||
const previewSection = (section: CourseSection) => {
|
// const previewSection = (section: CourseSection) => {
|
||||||
console.log('预览章节:', section)
|
// console.log('预览章节:', section)
|
||||||
|
|
||||||
previewModalTitle.value = section.name
|
// previewModalTitle.value = section.name
|
||||||
previewModalContent.value = `章节ID: ${section.id}\n章节名称: ${section.name}\n内容类型: ${getLessonTypeText(section)}`
|
// previewModalContent.value = `章节ID: ${section.id}\n章节名称: ${section.name}\n内容类型: ${getLessonTypeText(section)}`
|
||||||
previewModalType.value = 'section'
|
// previewModalType.value = 'section'
|
||||||
previewModalVisible.value = true
|
// previewModalVisible.value = true
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 关闭预览模态框
|
// 关闭预览模态框
|
||||||
const closePreviewModal = () => {
|
const closePreviewModal = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user