提交 e526ac67 authored 作者: lhh's avatar lhh

update

上级 3c10b5c7
<script setup lang="ts"> <script setup lang="ts">
import CourseListSearch from '../components/CourseListSearch.vue'
import CourseListItem from '../components/CourseListItem.vue'
import CourseView from './CourseView.vue' import CourseView from './CourseView.vue'
import type { CourseListParamsType, CourseListItemType } from '../types' import type { CourseListParamsType, CourseListItemType } from '../types'
import { getCourseList } from '../api' import { getCourseList } from '../api'
...@@ -23,7 +21,12 @@ function fetchList() { ...@@ -23,7 +21,12 @@ function fetchList() {
elective_types: listParams.elective_types?.length ? JSON.stringify(listParams.elective_types) : '' elective_types: listParams.elective_types?.length ? JSON.stringify(listParams.elective_types) : ''
}) })
getCourseList(params).then(res => { getCourseList(params).then(res => {
courseList = res.data.data courseList = res.data.data.map((item: any, index: number) => {
item.length = res.data.data?.length
item.index = index
return item
})
console.log(courseList, 'courseList')
const [first] = courseList const [first] = courseList
// 进入第一个课程详情页 // 进入第一个课程详情页
if (first && route.path === '/course' && !mobile.value) { if (first && route.path === '/course' && !mobile.value) {
...@@ -31,11 +34,6 @@ function fetchList() { ...@@ -31,11 +34,6 @@ function fetchList() {
} }
}) })
} }
// 筛选
function handleSearch(params: CourseListParamsType) {
Object.assign(listParams, params)
fetchList()
}
onMounted(() => { onMounted(() => {
fetchList() fetchList()
}) })
......
...@@ -84,7 +84,7 @@ function handleStudy() { ...@@ -84,7 +84,7 @@ function handleStudy() {
courseViewChapterRef.value.study() courseViewChapterRef.value.study()
} }
let detailFlag = $ref(false) let detailFlag = $ref(props.data?.length > 1 && props.data?.index === 0 ? true : false)
const handleDetail = function () { const handleDetail = function () {
router.push({ router.push({
path: '/course/view', path: '/course/view',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论