fix:旧方法,mock数据删除

This commit is contained in:
小张 2025-08-26 19:07:48 +08:00
parent 829660dbda
commit a5a802c4a6
2 changed files with 109 additions and 109 deletions

View File

@ -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 = () => {

View File

@ -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 = () => {