update course detail style

This commit is contained in:
AceDataCloud committed 2022-10-08 00:51:18 +08:00
1 parent c2d30448d7
commit a94623baac
8 files changed
+136 -21

No files matched your search

+50 -1
View File
@@ -14,7 +14,29 @@
<img :src="course.thumbnail" class="thumbnail" /> <img :src="course.thumbnail" class="thumbnail" />
</div> </div>
<div class="right"> <div class="right">
<h2>{{ course.title }}</h2> <h2
class="title"
@click="
$router.push({
name: 'course-detail',
params: {
id: $route.params.courseId
}
})
"
>
{{ course.title }}
</h2>
<div class="info">
<div class="duration">
<el-icon class="icon"> <clock /> </el-icon>
<span class="value">{{ course?.duration }}{{ $t('common.entity.minute') }}</span>
</div>
<div class="level">
<el-icon class="icon"> <magic-stick /> </el-icon>
<span class="value">{{ course?.level }}</span>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -22,9 +44,14 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { ICourse } from '@/services/course/types'; import { ICourse } from '@/services/course/types';
import { Clock, MagicStick, Collection, ArrowRight } from '@element-plus/icons-vue';
export default defineComponent({ export default defineComponent({
name: 'CoursePreviewCard', name: 'CoursePreviewCard',
components: {
Clock,
MagicStick
},
props: { props: {
course: { course: {
type: Object as () => ICourse, type: Object as () => ICourse,
@@ -54,7 +81,29 @@ export default defineComponent({
padding: 10px 0; padding: 10px 0;
color: white; color: white;
float: left; float: left;
width: calc(100% - 100px); width: calc(100% - 100px);
.title {
cursor: pointer;
}
.info {
color: rgb(120, 144, 156);
margin-top: 5px;
.duration,
.level {
font-size: 12px;
display: inline-block;
margin-right: 5px;
.icon {
position: relative;
top: 1px;
}
.value {
display: inline-block;
margin-left: 5px;
}
}
}
} }
} }
</style> </style>
+8 -4
View File
@@ -6,12 +6,12 @@
:class="{ item: true, active: episode.id === active }" :class="{ item: true, active: episode.id === active }"
@click="onClick(episode)" @click="onClick(episode)"
> >
<el-col :span="6" class="left"> <el-col :span="5" class="left">
<span class="index"> <span class="index">
{{ episodeIndex + 1 }} {{ episodeIndex + 1 }}
</span> </span>
</el-col> </el-col>
<el-col :span="18" class="right"> <el-col :span="19" class="right">
<p class="title"> <p class="title">
{{ episode?.title }} {{ episode?.title }}
</p> </p>
@@ -21,6 +21,7 @@
<clock /> <clock />
</el-icon> </el-icon>
{{ episode.duration }} {{ episode.duration }}
{{ $t('common.entity.minute') }}
</span> </span>
</p> </p>
</el-col> </el-col>
@@ -77,8 +78,9 @@ export default defineComponent({
border: 1px solid rgba(50, 138, 241, 0.25); border: 1px solid rgba(50, 138, 241, 0.25);
} }
.left { .left {
width: 30px; width: 60px;
color: inherit; color: inherit;
flex: inherit;
.index { .index {
display: block; display: block;
width: 30px; width: 30px;
@@ -93,7 +95,7 @@ export default defineComponent({
} }
} }
.right { .right {
width: calc(100% - 30px); width: calc(100% - 60px);
.title { .title {
color: white; color: white;
font-size: 0.8em; font-size: 0.8em;
@@ -104,6 +106,8 @@ export default defineComponent({
font-size: 0.6em; font-size: 0.6em;
.icon { .icon {
display: inline-block; display: inline-block;
position: relative;
top: -1px;
} }
} }
} }
+3 -1
View File
@@ -11,5 +11,7 @@ export default {
info: '提示', info: '提示',
publish: '发布', publish: '发布',
watch: '观看', watch: '观看',
verify: '去实名认证' verify: '去实名认证',
learn: '学习',
buy: '购买'
}; };
+3 -1
View File
@@ -14,5 +14,7 @@ export default {
article: '文章', article: '文章',
course: '课程', course: '课程',
minute: '分钟', minute: '分钟',
order: '订单' order: '订单',
episode: '小节',
episodes: '小节'
}; };
+63 -11
View File
@@ -14,15 +14,24 @@
<div class="title mb-5"> <div class="title mb-5">
<p>{{ course.title }}</p> <p>{{ course.title }}</p>
</div> </div>
<div class="category">
<!-- <el-button>{{ course.category }}</el-button> -->
</div>
<div class="introduction mb-5"> <div class="introduction mb-5">
<p>{{ course.introduction }}</p> <p>{{ course.introduction }}</p>
</div> </div>
<div class="operation"> <div class="operation">
<p v-if="paid === false"> <p v-if="paid === false">
<el-button @click="onBuy">Buy</el-button> <el-button @click="onBuy">
<el-icon class="icon"> <arrow-right /> </el-icon>
{{ $t('course.button.startStudy') }}
</el-button>
</p> </p>
<p v-if="paid === true"> <p v-if="paid === true">
{{ $t('course.message.paid') }} <el-button>
<el-icon class="icon"> <arrow-right /> </el-icon>
{{ $t('course.button.startStudy') }}
</el-button>
</p> </p>
</div> </div>
</el-col> </el-col>
@@ -33,7 +42,20 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<div class="banner"></div> <div class="banner">
<div class="duration">
<el-icon class="icon"> <clock /> </el-icon>
<span class="value">{{ course?.duration }}{{ $t('common.entity.minute') }}</span>
</div>
<div class="level">
<el-icon class="icon"> <magic-stick /> </el-icon>
<span class="value">{{ course?.level }}</span>
</div>
<div class="number">
<el-icon class="icon"> <collection /> </el-icon>
<span class="value">{{ episodes?.length }}{{ $t('common.entity.episodes') }}</span>
</div>
</div>
</el-col> </el-col>
</el-row> </el-row>
<el-row :class="{ episodes: true, disabled: !verified }"> <el-row :class="{ episodes: true, disabled: !verified }">
@@ -54,12 +76,12 @@
" "
> >
<el-row> <el-row>
<el-col :span="3" class="left"> <el-col :span="4" class="left">
<span class="index"> <span class="index">
{{ episodeIndex + 1 }} {{ episodeIndex + 1 }}
</span> </span>
</el-col> </el-col>
<el-col :span="21" class="right"> <el-col :span="20" class="right">
<div class="title"> <div class="title">
<p> <p>
{{ episode.title }} {{ episode.title }}
@@ -88,7 +110,7 @@ import { episodeService } from '@/services/episode/service';
import { IEpisode, IEpisodeListResponse } from '@/services/episode/types'; import { IEpisode, IEpisodeListResponse } from '@/services/episode/types';
import { orderService } from '@/services/order/service'; import { orderService } from '@/services/order/service';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { Clock } from '@element-plus/icons-vue'; import { Clock, MagicStick, Collection, ArrowRight } from '@element-plus/icons-vue';
import VerificationAlert from '@/components/common/VerificationAlert.vue'; import VerificationAlert from '@/components/common/VerificationAlert.vue';
import { IOrder, IOrderDetailResponse } from '@/services/order/types'; import { IOrder, IOrderDetailResponse } from '@/services/order/types';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
@@ -105,7 +127,10 @@ export default defineComponent({
name: 'CourseDetail', name: 'CourseDetail',
components: { components: {
Clock, Clock,
VerificationAlert Collection,
MagicStick,
VerificationAlert,
ArrowRight
}, },
data(): IData { data(): IData {
return { return {
@@ -205,6 +230,26 @@ export default defineComponent({
margin-right: auto; margin-right: auto;
width: 100%; width: 100%;
height: 55px; height: 55px;
padding: 12px 50px;
.duration,
.level,
.number {
font-size: 13px;
color: white;
display: inline-block;
margin-right: 10px;
color: 10px;
.icon {
position: relative;
top: 1px;
// margin-right: 5px;
}
.value {
margin-left: 5px;
// font-weight: bold;
display: inline-block;
}
}
} }
.verification-alert { .verification-alert {
@@ -223,9 +268,10 @@ export default defineComponent({
.episode { .episode {
cursor: pointer; cursor: pointer;
margin-bottom: 2rem; margin-bottom: 2rem;
height: 100px; height: 140px;
border-radius: 0.934rem !important; border-radius: 0.934rem !important;
.left { .left {
position: relative;
.index { .index {
width: 50px; width: 50px;
height: 50px; height: 50px;
@@ -237,8 +283,9 @@ export default defineComponent({
font-size: 20px; font-size: 20px;
border: 2px solid #e5e5e5; border: 2px solid #e5e5e5;
position: absolute; position: absolute;
top: 5px; top: 50%;
left: 35px; left: 50%;
transform: translate(-50%, -50%);
} }
} }
.title { .title {
@@ -246,17 +293,22 @@ export default defineComponent({
font-size: 1.2rem; font-size: 1.2rem;
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
margin-top: 10px;
} }
} }
.introduction { .introduction {
p { p {
height: 28px;
overflow: hidden;
white-space: nowrap;
font-size: 0.8rem; font-size: 0.8rem;
color: rgb(161, 161, 161); color: rgb(161, 161, 161);
text-overflow: ellipsis;
} }
} }
.info { .info {
font-size: 12px; font-size: 12px;
color: #666; color: rgb(161, 161, 161);
.icon { .icon {
position: relative; position: relative;
top: 1px; top: 1px;
+2 -2
View File
@@ -1,6 +1,6 @@
<template> <template>
<el-row> <el-row>
<el-col :span="6" class="side"> <el-col :span="5" class="side">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<course-preview-card v-if="course" :course="course" /> <course-preview-card v-if="course" :course="course" />
@@ -8,7 +8,7 @@
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="18" class="main"> <el-col :span="19" class="main">
<div v-if="paid === true || episode?.isFree"> <div v-if="paid === true || episode?.isFree">
<episode-player v-if="episode?.resourceUrl" :resource="episode?.resourceUrl" :preview="episode?.thumbnail" /> <episode-player v-if="episode?.resourceUrl" :resource="episode?.resourceUrl" :preview="episode?.thumbnail" />
</div> </div>
+5
View File
@@ -1,9 +1,14 @@
export const COURSE_LEVEL_BEGINNER = 'Beginner';
export const COURSE_LEVEL_INTERMEDIATE = 'Intermediate';
export const COURSE_LEVEL_ADVANCED = 'Advanced';
export interface ICourse { export interface ICourse {
id: number; id: number;
tags?: string[]; tags?: string[];
title?: string; title?: string;
cover?: string; cover?: string;
thumbnail?: string; thumbnail?: string;
level?: typeof COURSE_LEVEL_BEGINNER | typeof COURSE_LEVEL_INTERMEDIATE | typeof COURSE_LEVEL_ADVANCED;
discount?: number; discount?: number;
price?: number; price?: number;
duration?: number; duration?: number;
+2 -1
View File
@@ -12,7 +12,8 @@ export interface IState {
const store = createStore({ const store = createStore({
state(): IState { state(): IState {
return { return {
accessToken: undefined, accessToken:
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjY1MTc5MTE2LCJqdGkiOiJlYjEzNGMzMjZlMTc0YzViODFhNGZlZDgxMjJlYzFhNiIsInVzZXJfaWQiOjQsInBlcm1pc3Npb25zIjpbInZpZXdfYWNhZGVteV9jb3Vyc2UiXSwiaXNfc3VwZXJ1c2VyIjpmYWxzZSwiaXNfdmVyaWZpZWQiOnRydWUsInJlYWxuYW1lIjoiXHU1ZDE0XHU1ZTg2XHU2MjRkIiwicGhvbmUiOiIxNzYwMDE1NTU2NyIsImlkY2FyZCI6IjM3MDc4MTE5OTQwNjI5MzI3MSJ9.Xc4B9GhgJ5i2I9R_6j7bD38yX3bPC_FI7kUVQzCDaq4',
refreshToken: undefined, refreshToken: undefined,
user: undefined user: undefined
}; };