|
@@ -1,105 +1,104 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div id="course-page-body">
|
|
|
|
|
- <div id="course-back-button" @click="toPortal">
|
|
|
|
|
- <svg data-v-ba633cb8="" viewBox="0 0 1024 1024" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
- <path d="M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64z" fill="currentColor"></path>
|
|
|
|
|
- <path d="m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312L237.248 512z" fill="currentColor"></path>
|
|
|
|
|
- </svg>
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-tabs v-model="activeTab">
|
|
|
|
|
- <el-tab-pane class="course-page-main" label="全部课程" name="first">
|
|
|
|
|
- <CourseCard v-for="course in courses_show" :key="course.id" :courseVO="course"/>
|
|
|
|
|
- </el-tab-pane>
|
|
|
|
|
- <el-tab-pane label="我的课程" name="second">
|
|
|
|
|
- <div v-if="courses_my.length!==0" class="course-page-main">
|
|
|
|
|
- <CourseCard v-for="course in courses_my" :key="course.id" :courseVO="course"/>
|
|
|
|
|
|
|
+ <el-row id="course-page-body">
|
|
|
|
|
+ <el-col :span="3">
|
|
|
|
|
+ <el-menu background-color="#f8f9fb" default-active="1" @select="handleSelect">
|
|
|
|
|
+ <el-menu-item index="0">
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Back/>
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <span style="padding-left: 20px">返回首页</span>
|
|
|
|
|
+ </el-menu-item>
|
|
|
|
|
+ <el-menu-item index="1">
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <Document/>
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <span style="padding-left: 20px">全部课程</span>
|
|
|
|
|
+ </el-menu-item>
|
|
|
|
|
+ <el-menu-item index="2">
|
|
|
|
|
+ <el-icon>
|
|
|
|
|
+ <DocumentChecked/>
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ <span style="padding-left: 20px">我的课程</span>
|
|
|
|
|
+ </el-menu-item>
|
|
|
|
|
+ </el-menu>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="1"/>
|
|
|
|
|
+ <el-col :span="18">
|
|
|
|
|
+ <el-card>
|
|
|
|
|
+ <template #header>
|
|
|
|
|
+ <span style="font-weight: bold; font-size: larger">
|
|
|
|
|
+ {{ activeName }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <div v-if="this.activeIndex === '1'" class="course-page-main">
|
|
|
|
|
+ <CourseCard v-for="course in courses_all" :key="course.id" :courseVO="course"/>
|
|
|
</div>
|
|
</div>
|
|
|
- <div v-else class="course-page-main" style="display: flex; flex-direction: column; justify-content: center;align-items: center;margin-top: 16vh">
|
|
|
|
|
- <svg class="icon" height="128" viewBox="0 0 1024 1024" width="128" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
- <path
|
|
|
|
|
- d="M909.016 820.828H841a30 30 0 0 1 0-60h38.016a20 20 0 0 0 20-20V145.185a20 20 0 0 0-20-20H352a20 20 0 0 0-20 20v28h370.016a50 50 0 0 1 50 50v223.36a29.989 29.989 0 1 1-59.507 5.283h-0.493V253.185a20
|
|
|
|
|
- 20 0 0 0-20-20H145a20 20 0 0 0-20 20v625.643a20 20 0 0 0 20 20h337a30 30 0 0 1 0 60H115a50 50 0 0 1-50-50V223.185a50 50 0 0 1 50-50h157v-58a50 50 0 0 1 50-50h587.016a50 50 0 0 1 50 50v655.643a50 50 0 0 1-50 50z m-663.037-484H572.74a29.979 29.979 0 1 1 0
|
|
|
|
|
- 59.957H245.979a29.979 29.979 0 1 1 0-59.957z m0 290.043h74.912a29.979 29.979 0 0 1 29.979 29.978 29.979 29.979 0 0 1-29.979
|
|
|
|
|
- 29.979h-74.912A29.979 29.979 0 0 1 216 656.849a29.979 29.979 0 0 1 29.979-29.978zM216 511.807a29.979 29.979 0 0 1 29.979-29.979h140.935a29.979 29.979 0 0 1 29.979 29.979v0.042a29.979 29.979 0 0 1-29.979 29.979H245.979A29.979 29.979 0 0 1 216 511.849v-0.042z m163 177.521c0-107.419
|
|
|
|
|
- 87.081-194.5 194.5-194.5S768 581.909 768 689.328a193.618 193.618 0 0 1-37.9 115.356l84.115 84.115a30 30 0 1 1-42.425 42.429l-84.3-84.3a193.6 193.6 0 0 1-113.99 36.9c-107.419 0-194.5-87.081-194.5-194.5z m194.5 134.5a134.5 134.5 0 1 0-134.5-134.5 134.5 134.5 0 0 0 134.5 134.5z"
|
|
|
|
|
- fill="#bfbfbf"></path>
|
|
|
|
|
- </svg>
|
|
|
|
|
- <div>
|
|
|
|
|
- 暂无数据
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div v-else class="course-page-main">
|
|
|
|
|
+ <CourseCard v-for="course in courses_my" :key="course.id" :courseVO="course"/>
|
|
|
</div>
|
|
</div>
|
|
|
- </el-tab-pane>
|
|
|
|
|
- </el-tabs>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
<GlobalFooter/>
|
|
<GlobalFooter/>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import GlobalFooter from "@/components/GlobalFooter";
|
|
import GlobalFooter from "@/components/GlobalFooter";
|
|
|
|
|
+import { Back, Document, DocumentChecked } from "@element-plus/icons-vue";
|
|
|
import CourseCard from "@/components/CourseCard";
|
|
import CourseCard from "@/components/CourseCard";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "CoursePage",
|
|
name: "CoursePage",
|
|
|
- components: { CourseCard, GlobalFooter },
|
|
|
|
|
|
|
+ components: { Back, CourseCard, Document, DocumentChecked, GlobalFooter },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- activeTab: "first",
|
|
|
|
|
|
|
+ activeIndex: "1",
|
|
|
courses_all: [],
|
|
courses_all: [],
|
|
|
courses_my: [],
|
|
courses_my: [],
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
- courses_show() {
|
|
|
|
|
- return this.courses_all;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ activeName() {
|
|
|
|
|
+ if (this.activeIndex === "1") {
|
|
|
|
|
+ return "全部课程";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return "我的课程";
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- // await this.$apis.getAllCourses().then(res => {
|
|
|
|
|
- // this.courseList = res.data.data;
|
|
|
|
|
- // });
|
|
|
|
|
- this.courses_all = this.$apis.getAllCourses().data.data;
|
|
|
|
|
- for (let i = 3 - this.courses_all.length % 3; i !== 0; i--) {
|
|
|
|
|
- this.courses_all.push(this.courses_all[0]);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.$apis.getAllCourses().then(res => {
|
|
|
|
|
+ this.courses_all = res.data.data;
|
|
|
|
|
+ });
|
|
|
if (this.$store.state.user.token) {
|
|
if (this.$store.state.user.token) {
|
|
|
- this.courses_my = this.$apis.getStudentCourses(this.$store.state.user.id).then(res => {
|
|
|
|
|
|
|
+ this.courses_my = this.$apis.getStudentCourses({ studentId: this.$store.state.user.id }).then(res => {
|
|
|
this.courses_my = res.data.data;
|
|
this.courses_my = res.data.data;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
- toPortal() {
|
|
|
|
|
- this.$router.push("/portal");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ handleSelect(index) {
|
|
|
|
|
+ if (index === "0") {
|
|
|
|
|
+ this.$router.push("portal");
|
|
|
|
|
+ }
|
|
|
|
|
+ this.activeIndex = index;
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
#course-page-body {
|
|
#course-page-body {
|
|
|
- margin: 40px 180px 80px 180px;
|
|
|
|
|
|
|
+ margin: 40px 60px 80px 60px;
|
|
|
min-height: calc(100vh - 340px);
|
|
min-height: calc(100vh - 340px);
|
|
|
position: relative;
|
|
position: relative;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#course-back-button {
|
|
|
|
|
- position: absolute;
|
|
|
|
|
- padding: 10px;
|
|
|
|
|
- top: 0;
|
|
|
|
|
- left: -70px;
|
|
|
|
|
- font-size: 14px;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-#course-back-button:hover {
|
|
|
|
|
- cursor: pointer;
|
|
|
|
|
- color: #409eff;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
.course-page-main {
|
|
.course-page-main {
|
|
|
display: grid;
|
|
display: grid;
|
|
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
|
- grid-gap: 20px 20px;
|
|
|
|
|
|
|
+ grid-gap: 20px;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|