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

+2 -1
View File
@@ -7,10 +7,11 @@
"serve": "vite preview"
},
"dependencies": {
"@element-plus/icons-vue": "^0.2.7",
"@types/humps": "^2.0.1",
"axios": "^0.21.1",
"dayjs": "^1.10.7",
"element-plus": "^1.3.0-beta.10",
"element-plus": "^2.0.2",
"humps": "^2.0.1",
"qrcode.vue": "3.3.0",
"typescript-cookie": "^1.0.3",
+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
};
+31 -14
View File
@@ -53,6 +53,11 @@
resolved "https://registry.yarnpkg.com/@element-plus/icons-vue/-/icons-vue-0.2.6.tgz#28e48aa4abd5b02638b41c1d95a6e7f96bb23308"
integrity sha512-2gg7VCq4d2firgl7/aVym4Cx/wqKFwKybEQGJiiWJN4urW36+QdAEG1knqSD9qidbjhVp0Jnc9XdSTR1/4Whzw==
"@element-plus/icons-vue@^0.2.7":
version "0.2.7"
resolved "https://registry.yarnpkg.com/@element-plus/icons-vue/-/icons-vue-0.2.7.tgz#c0b75363098bf1fba414e18706604bfe5057ae1b"
integrity sha512-S8kDbfVaWkQvbUYQE1ui448tzaHfUvyESCep9J6uPRlViyQPXjdIfwLBhV6AmQSOfFS8rL+xehJGhvzPXLrSBg==
"@emmetio/abbreviation@^2.2.2":
version "2.2.2"
resolved "https://registry.yarnpkg.com/@emmetio/abbreviation/-/abbreviation-2.2.2.tgz#746762fd9e7a8c2ea604f580c62e3cfe250e6989"
@@ -379,18 +384,18 @@
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.29.tgz#07dac7051117236431d2f737d16932aa38bbb925"
integrity sha512-BjNpU8OK6Z0LVzGUppEk0CMYm/hKDnZfYdjSmPOs0N+TR1cLKJAkDwW8ASZUvaaSLEi6d3hVM7jnWnX+6yWnHw==
"@vueuse/core@^7.5.5":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-7.5.5.tgz#c2f2a8783de0884acfb0be25e71ec3c6d1f9c42e"
integrity sha512-RBDqmIoGfak4h3xdXa/Av+ibkb8NY044wEy6+PG2FAWNaID8/FkqmSFjbxogrbmpSX1yZ1PBHrM8DUp/FrIpbg==
"@vueuse/core@^7.6.0":
version "7.6.2"
resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-7.6.2.tgz#1b9aa92048991189fac31577ff439296efa5fb4a"
integrity sha512-bjAbXJVJO6aElMaZtDz2B70C0L6jFk/jGVqJxWZS5huffxA6dW5DN6tQQJwzOnx9B9rDhePHJIFKsix0qZIH2Q==
dependencies:
"@vueuse/shared" "7.5.5"
"@vueuse/shared" "7.6.2"
vue-demi "*"
"@vueuse/shared@7.5.5":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@vueuse/shared/-/shared-7.5.5.tgz#0e5c16b848b4a19e5b9ee9199a997e1f6dd39679"
integrity sha512-mzzTsotHQRPnPAChy8iCv6ek/90CKYhAFyMRgNsMxpT0afZJkbMO/X0OaOu/1NuGbgb8UVjlsWKmCUgKTOF5hA==
"@vueuse/shared@7.6.2":
version "7.6.2"
resolved "https://registry.yarnpkg.com/@vueuse/shared/-/shared-7.6.2.tgz#6d83bdb003cd8a56dc779fe501e73a4cb755b802"
integrity sha512-ThDld4Mx501tahRuHV6qJGkwCr17GknZrOzlD02Na9qJcH7Pq0quNTLx5cNDou7b1CKNvE3BXi2w/hz9KuPNTQ==
dependencies:
vue-demi "*"
@@ -822,18 +827,20 @@ electron-to-chromium@^1.4.17:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.64.tgz#8b1b5372f77ca208f2c498c6490da0e51176bd81"
integrity sha512-8mec/99xgLUZCIZZq3wt61Tpxg55jnOSpxGYapE/1Ma9MpFEYYaz4QNYm0CM1rrnCo7i3FRHhbaWjeCLsveGjQ==
element-plus@^1.3.0-beta.10:
version "1.3.0-beta.10"
resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-1.3.0-beta.10.tgz#10dd01586074c147df1b7902fd4d76b50f16e3cc"
integrity sha512-uPcre5liDfYvGbfaBDN2K7K5x6egBFdDQz0sv2cupcqzepUQoTMpq+mdTnHXzHChHhVwcLGp95kLYLL9yMkT8g==
element-plus@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.0.2.tgz#1e4a29fbc6629255b96845a99202773e774223a1"
integrity sha512-URjC0HwwiqtlLxqTmHXQ31WXrdAq4ChWyyn52OcQs3PRsnMPfahGVq2AWnfzzlzlhVeI5lY3HQiuB1zDathS+g==
dependencies:
"@ctrl/tinycolor" "^3.4.0"
"@element-plus/icons-vue" "^0.2.6"
"@popperjs/core" "^2.11.2"
"@vueuse/core" "^7.5.5"
"@vueuse/core" "^7.6.0"
async-validator "^4.0.7"
dayjs "^1.10.7"
lodash "^4.17.21"
lodash-es "^4.17.21"
lodash-unified "^1.0.1"
memoize-one "^6.0.0"
normalize-wheel-es "^1.1.1"
@@ -1563,6 +1570,16 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
lodash-unified@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/lodash-unified/-/lodash-unified-1.0.1.tgz#7c57e139ab475292c1731725386b929c819628a1"
integrity sha512-Py+twfpWn+2dFQWCuGcp21WiQRwZwnm1cyE3piSt/VtBVKVyxlR58WgOVRzXtmdmDRGJKH8F8GPaA29WK/yK8g==
lodash.merge@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"