add episode side

This commit is contained in:
AceDataCloud committed 2022-02-20 16:49:36 +08:00
1 parent 36a338b631
commit fdae3fa1c2
6 files changed
+143 -140

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
<template>
<el-row v-for="(episode, episodeIndex) in episodes" class="item">
<el-col :span="6" class="left">
<span class="index">
{{ episodeIndex }}
</span>
</el-col>
<el-col :span="18" class="right">
<p class="title">
{{ episode?.title }}
</p>
<p class="info">
<span class="duration">
<el-icon class="icon">
<clock />
</el-icon>
{{ episode.duration }}
</span>
</p>
</el-col>
</el-row>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { IEpisode, IEpisodeDetailResponse, IEpisodeListResponse } from '@/services/episode/types';
import { Clock } from '@element-plus/icons-vue';
export default defineComponent({
name: 'EpisodeSideList',
components: {
Clock
},
props: {
episodes: {
type: Array as () => IEpisode[],
default() {
return [];
}
}
},
mounted() {},
methods: {}
});
</script>
<style lang="scss">
.item {
height: 60px;
padding-top: 10px;
color: white;
.left {
width: 30px;
color: inherit;
.index {
display: block;
width: 30px;
height: 30px;
text-align: center;
margin: auto;
border-radius: 50%;
font-size: 0.6em;
line-height: 30px;
background-image: linear-gradient(rgb(244, 72, 129), rgb(236, 69, 79));
}
}
.right {
width: calc(100% - 30px);
.title {
color: white;
font-size: 0.8em;
text-align: left;
}
.info {
.duration {
font-size: 0.6em;
.icon {
display: inline-block;
}
}
}
}
}
</style>
-3
View File
@@ -1,8 +1,5 @@
<template>
<el-container>
<el-header>
<top-header />
</el-header>
<el-container>
<el-main> <router-view /> </el-main>
</el-container>
+25 -121
View File
@@ -1,82 +1,42 @@
<template>
<el-row>
<el-col :span="24">
<div class="wrapper">
<div class="container">
<el-row v-if="episode">
<el-col :span="6"
><div class="thumbnail">
<img :src="episode.thumbnail" />
</div>
</el-col>
<el-col :span="18">
<div class="title mb-5">
<p>{{ episode.title }}</p>
</div>
<div class="introduction mb-5">
<p>{{ episode.introduction }}</p>
</div>
</el-col>
</el-row>
</div>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="banner"></div>
</el-col>
</el-row>
<el-row class="episodes">
<el-col :span="14" :offset="5">
<el-card shadow="hover" v-for="(episode, episodeIndex) in episodes" class="episode">
<el-row>
<el-col :span="3"> {{ episodeIndex + 1 }}</el-col>
<el-col :span="21">
<div class="title">
<p>{{ episode.title }}</p>
</div>
<div class="introduction">
<p>{{ episode.introduction }}</p>
</div>
<div class="introduction">
<router-link
:to="{
name: 'eposide-detail',
params: {
episodeId: episode?.id,
id: episode.id
}
}"
>
<el-button>{{ $t('common.button.watch') }}</el-button>
</router-link>
</div>
</el-col>
</el-row>
</el-card>
<el-col :span="6">
<el-row class="side">
<el-col :span="24">
<episode-side-list :episodes="episodes"></episode-side-list>
</el-col>
</el-row>
</el-col>
<el-col :span="18"> </el-col>
</el-row>
</template>
<script lang="ts">
import { episodeService } from '@/services/episode/service';
import { IEpisode, IEpisodeDetailResponse } from '@/services/episode/types';
import { IEpisode, IEpisodeDetailResponse, IEpisodeListResponse } from '@/services/episode/types';
import { defineComponent } from 'vue';
import EpisodeSideList from '@/components/episode/SideList.vue';
interface IData {
episode: IEpisode | undefined;
episodes: IEpisode[];
loading: boolean;
id: number;
courseId: number;
}
export default defineComponent({
name: 'EpisodeDetail',
components: {
EpisodeSideList
},
data(): IData {
return {
id: parseInt(this.$route.params.id.toString()),
courseId: parseInt(this.$route.params.courseId.toString()),
episode: undefined,
loading: false
loading: false,
episodes: []
};
},
async mounted() {
@@ -85,74 +45,18 @@ export default defineComponent({
this.loading = false;
this.episode = data;
});
episodeService.getAllForCourse(this.courseId).then(({ data: data }: { data: IEpisodeListResponse }) => {
this.episodes = data.items;
});
}
});
</script>
<style lang="scss" scoped>
.wrapper {
width: 100%;
height: 400px;
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;
}
.episodes {
.episode {
margin-top: 2rem;
height: 160px;
border-radius: 0.934rem !important;
.title {
p {
font-size: 1.5rem;
font-weight: bold;
}
}
.introduction {
p {
font-size: 0.8rem;
color: rgb(161, 161, 161);
}
}
}
.side {
background-color: #0d131d;
height: 100vh;
overflow-y: scroll;
width: 300px;
}
</style>
+1 -1
View File
@@ -12,7 +12,7 @@ const store = createStore({
state(): IState {
return {
accessToken:
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjQ0MjczMTExLCJqdGkiOiJiZDZjZWFlYTAwMDA0NDU2YmIwMWQ1MmYzYTI0YTA2NiIsInVzZXJfaWQiOjMsInBlcm1pc3Npb25zIjpbInZpZXdfYWNhZGVteV9jb3Vyc2UiXSwiaXNfc3VwZXJ1c2VyIjpmYWxzZX0.Eq_tlW9y4fJp_zNfBaCPUlUfEY96pvMHYVrcfSDPsk8',
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjQ1MzcyNDgzLCJqdGkiOiIyYWFiNDRiOTdjMGE0NDg3OWZiYzI3MTZiYWM2YWY2YyIsInVzZXJfaWQiOjMsInBlcm1pc3Npb25zIjpbInZpZXdfYWNhZGVteV9jb3Vyc2UiXSwiaXNfc3VwZXJ1c2VyIjpmYWxzZX0.LWCZPAHB7Ask-FU_aZUTpCazN08KxBsbTLOsHakhpAY',
refreshToken: undefined,
user: undefined
};