|
|
@@ -15,7 +15,7 @@
|
|
|
<div class="course-items-container">
|
|
|
<el-card v-for="item in getCoursesSlice(0, 5)" :key="item.courseId" class="course-item active" @click="handleClick(item.courseId)">
|
|
|
<div style="width: 200px; height: 120px">
|
|
|
- <img :src="convertImageUrl(item.courseImages[0], item.courseName)" :alt="item.courseName" class="course-item-img">
|
|
|
+ <img :src="convertImageUrl(item.courseImages == null ? null : item.courseImages[0], item.courseName)" :alt="item.courseName" class="course-item-img">
|
|
|
</div>
|
|
|
<div class="course-item-content">
|
|
|
<div style="font-weight: bold; font-size: 16px; margin: 5px 0">{{item.courseName}}</div>
|
|
|
@@ -33,7 +33,7 @@
|
|
|
<div class="course-items-container">
|
|
|
<el-card v-for="item in getCoursesSlice(5, 10)" :key="item.courseId" class="course-item active" @click="handleClick(item.courseId)">
|
|
|
<div style="width: 200px; height: 120px">
|
|
|
- <img :src="convertImageUrl(item.courseImages[0], item.courseName)" :alt="item.courseName" class="course-item-img">
|
|
|
+ <img :src="convertImageUrl(item.courseImages == null ? null : item.courseImages[0], item.courseName)" :alt="item.courseName" class="course-item-img">
|
|
|
</div>
|
|
|
<div class="course-item-content">
|
|
|
<div style="font-weight: bold; font-size: 16px; margin: 5px 0">{{item.courseName}}</div>
|
|
|
@@ -93,11 +93,6 @@ let pageInfo = reactive({
|
|
|
courseData: []
|
|
|
})
|
|
|
|
|
|
-let pageInfo2Show = reactive({
|
|
|
- total: 0,
|
|
|
- courseData: []
|
|
|
-})
|
|
|
-
|
|
|
const query = reactive<CourseQuery>({} as CourseQuery)
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
@@ -105,6 +100,7 @@ const handleSearch = () => {
|
|
|
Object.assign(query, {
|
|
|
courseId:null,
|
|
|
teacherId:null,
|
|
|
+ teacherPid:null,
|
|
|
studentId:null,
|
|
|
courseName:courseName.value,
|
|
|
semester:null,
|
|
|
@@ -115,6 +111,7 @@ const handleSearch = () => {
|
|
|
Object.assign(query, {
|
|
|
courseId:null,
|
|
|
teacherId:null,
|
|
|
+ teacherPid:null,
|
|
|
studentId:store.user.id,
|
|
|
courseName:courseName.value,
|
|
|
semester:null,
|
|
|
@@ -124,6 +121,7 @@ const handleSearch = () => {
|
|
|
Object.assign(query, {
|
|
|
courseId:null,
|
|
|
teacherId:store.user.id,
|
|
|
+ teacherPid:store.user.pid,
|
|
|
studentId:null,
|
|
|
courseName:courseName.value,
|
|
|
semester:null,
|
|
|
@@ -133,19 +131,6 @@ const handleSearch = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const courseNameFilter = () => {
|
|
|
- Object.assign(pageInfo2Show, {
|
|
|
- total: 0,
|
|
|
- courseData: []
|
|
|
- })
|
|
|
- for(let i = 0; i < pageInfo.total; i++){
|
|
|
- if(pageInfo.courseData[i].courseName.includes(courseName.value)){
|
|
|
- pageInfo2Show.courseData.push(pageInfo.courseData[i])
|
|
|
- pageInfo2Show.total++;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// 处理课程卡片的点击事件
|
|
|
const handleClick = (value:number) => {
|
|
|
router.push(`/home/courseDetail/${value}`)
|
|
|
@@ -173,7 +158,6 @@ const fetchAllCourse = () => {
|
|
|
console.log(res)
|
|
|
pageInfo.courseData = res.data.data.records
|
|
|
pageInfo.total = res.data.data.total
|
|
|
- Object.assign(pageInfo2Show, pageInfo)
|
|
|
})
|
|
|
.catch((err: any) => {
|
|
|
console.error("错误信息",err);
|
|
|
@@ -188,7 +172,6 @@ const fetchCourseByUserId = () => {
|
|
|
console.log(res)
|
|
|
pageInfo.courseData = res.data.data.records
|
|
|
pageInfo.total = res.data.data.total
|
|
|
- Object.assign(pageInfo2Show, pageInfo)
|
|
|
})
|
|
|
.catch((err: any) => {
|
|
|
console.error(err);
|
|
|
@@ -200,7 +183,6 @@ const fetchCourseByUserId = () => {
|
|
|
console.log(res.data.data)
|
|
|
pageInfo.courseData = res.data.data.records
|
|
|
pageInfo.total = res.data.data.total
|
|
|
- Object.assign(pageInfo2Show, pageInfo)
|
|
|
})
|
|
|
.catch((err: any) => {
|
|
|
console.error(err);
|
|
|
@@ -211,7 +193,8 @@ const fetchCourseByUserId = () => {
|
|
|
|
|
|
//只获取前五个课程
|
|
|
const getCoursesSlice = (start:number, end:number) => {
|
|
|
- return pageInfo2Show.courseData.slice(start, end)
|
|
|
+ console.log(pageInfo.courseData.slice(start, end))
|
|
|
+ return pageInfo.courseData.slice(start, end)
|
|
|
}
|
|
|
|
|
|
onMounted(()=>{
|