update index and detail of course
This commit is contained in:
1 parent
bee5606474
commit
344fd73833
13 files changed
+325
-12
No files matched your search
@@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="wrapper">
|
||||
<div class="container">
|
||||
<el-row v-if="course">
|
||||
<el-col :span="6"
|
||||
><div class="thumbnail">
|
||||
<img :src="course.thumbnail" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<div class="title mb-5">
|
||||
<p>{{ course.title }}</p>
|
||||
</div>
|
||||
<div class="introduction mb-5">
|
||||
<p>{{ course.introduction }}</p>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8"> </el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<div class="banner"></div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { courseService } from '@/services/course/service';
|
||||
import { ICourse, ICourseDetailResponse } from '@/services/course/types';
|
||||
import { defineComponent } from 'vue';
|
||||
interface IData {
|
||||
course: ICourse | undefined;
|
||||
loading: boolean;
|
||||
id: number;
|
||||
}
|
||||
export default defineComponent({
|
||||
name: 'CourseList',
|
||||
data(): IData {
|
||||
return {
|
||||
id: parseInt(this.$route.params.id.toString()),
|
||||
course: undefined,
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
this.loading = true;
|
||||
courseService.get(this.id).then(({ data: data }: { data: ICourseDetailResponse }) => {
|
||||
this.loading = false;
|
||||
this.course = data;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
background-image: radial-gradient(circle at 0 2%, #283e63, #172337 99%);
|
||||
.container {
|
||||
width: 1200px;
|
||||
margin: auto;
|
||||
padding-top: 50px;
|
||||
|
||||
.title {
|
||||
p {
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
font-size: 2.4rem;
|
||||
}
|
||||
}
|
||||
.introduction {
|
||||
p {
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
.thumbnail {
|
||||
text-align: center;
|
||||
img {
|
||||
pointer-events: none;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
margin-top: 50px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.banner {
|
||||
border-bottom-left-radius: 28px;
|
||||
border-bottom-right-radius: 28px;
|
||||
background: linear-gradient(270deg, #f44881, #ec454f);
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
}
|
||||
</style>
|
||||
+115
-3
@@ -1,5 +1,117 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Course List</h1>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="20" :offset="2">
|
||||
<div class="courses">
|
||||
<el-card shadow="hover" class="course" v-for="course in courses">
|
||||
<div class="content">
|
||||
<div class="tags mb-5">
|
||||
<el-button size="small" type="danger" class="tag" v-for="tag in course.tags">{{ tag }}</el-button>
|
||||
</div>
|
||||
<div class="title mb-5">
|
||||
<p>{{ course.title }}</p>
|
||||
</div>
|
||||
<div class="introduction mb-5">
|
||||
<p>{{ course.introduction }}</p>
|
||||
</div>
|
||||
<div class="study">
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'course-detail',
|
||||
params: {
|
||||
id: course.id
|
||||
}
|
||||
}"
|
||||
>
|
||||
<el-button>
|
||||
{{ $t('course.button.startStudy') }}
|
||||
</el-button>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thumbnail">
|
||||
<img :src="course.thumbnail" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { courseService } from '@/services/course/service';
|
||||
import { ICourse, ICourseListResponse } from '@/services/course/types';
|
||||
import { defineComponent } from 'vue';
|
||||
interface IData {
|
||||
courses: ICourse[];
|
||||
loading: boolean;
|
||||
}
|
||||
export default defineComponent({
|
||||
name: 'CourseList',
|
||||
data(): IData {
|
||||
return {
|
||||
courses: [],
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
this.loading = true;
|
||||
courseService.getAll().then(({ data: data }: { data: ICourseListResponse }) => {
|
||||
this.courses = data.items;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.courses {
|
||||
.course {
|
||||
width: 1200px;
|
||||
height: 360px;
|
||||
border-radius: 0.9rem !important;
|
||||
margin: 2rem auto;
|
||||
padding: 2rem 3rem;
|
||||
position: relative;
|
||||
.content {
|
||||
max-width: 650px;
|
||||
}
|
||||
|
||||
.tags {
|
||||
.tag {
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
p {
|
||||
font-size: 1.7rem;
|
||||
}
|
||||
}
|
||||
.introduction {
|
||||
p {
|
||||
font-size: 1rem;
|
||||
color: rgb(96 111 123);
|
||||
}
|
||||
}
|
||||
.thumbnail {
|
||||
img {
|
||||
position: absolute;
|
||||
right: -165px;
|
||||
margin-top: -50px;
|
||||
max-width: 80%;
|
||||
pointer-events: none;
|
||||
top: 0;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
}
|
||||
}
|
||||
.study {
|
||||
.el-button {
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user