yb课堂 视频详情页模块开发《三十八》
CourseDetail基础模块开发
CourseDetail模块开发,拆分组件
- CourseDetail.vue
- Header.vue
- Course.vue
- Tab.vue
- Summary.vue
- Calalog
创建文件夹
CourseDetail开发
<template>
<div>
<!--视频顶部组件-->
<detail-header :videoInfo="videoInfo"></detail-header>
<!-- 视频详情组件 -->
<detail-course :videoInfo="videoInfo"></detail-course>
<!--视频tab简介组件-->
<detail-tab :videoInfo="videoInfo" :chapterList="chapterList"></detail-tab>
<!--底部立即购买-->
<footer>
<router-link :to="{path:'/pay',query:{video_id:this.$route.query.video_id}}" class="user_buy">
<button>立刻购买</button>
</router-link>
</footer>
</div>
</template>
<script>
//引入组件
import DetailHeader from "./Components/Header";
import DetailCourse from "./Components/Course";
import DetailTab from "./Components/Tab";
import { getVideoDetail } from "@/api/getData.js";
export default {
//注册组件
components: {
DetailHeader,
DetailCourse,
DetailTab
},
data() {
return {
//视频信息
videoInfo: {},
chapterList: []
};
},
methods: {
//获取视频详情
async getDetail(vid) {
try {
const result = await getVideoDetail(vid);
if (result.data.code == 0) {
this.videoInfo = result.data.data;
this.chapterList = result.data.data.chapter_list;
}
} catch (error) {
console.log(error);
}
}
},
mounted() {
//渲染之后拿到数据
this.getDetail(this.$route.query.video_id);
console.log(this.$route.query.video_id);
}
};
</script>
<style lang="scss" scoped>
//底部
footer {
// fixed固定在底部
position: fixed;
bottom: 0;
width: 100%;
padding: 8px 0;
background-color: #fff;
z-index: 999;
box-shadow: 0 -2px 4px 0 rgba(0, 0, 0, 0.05);
}
//设置购买按钮样式
button {
display: block;
color: #fff;
margin: 0 auto;
background-color: #d93f30;
height: 34px;
line-height: 34px;
border-radius: 17px;
width: 80%;
border: none;
font-size: 15px;
text-align: center;
}
</style>
Header开发
<template>
<div>
<header>
<div class="header">
<span @click="$router.back(-1)"><i class="cubeic-back"/></span>
<div class="title">
{{videoInfo.title}}
</div>
</div>
</header>
</div>
</template>
<script>
export default {
props: {
videoInfo: {
type: Object,
required: true
}
}
};
</script>
<style lang="scss" scoped>
.header {
display: flex; //flex左右布局
background-color: #07111b;
padding: 10px 20px;
color: #fff;
}
// 返回箭头
.cubeic-back {
color: #fff;
margin-right: 5px;
}
//视频标题
.title {
font-size: 16px;
width: 80%;
//超出省略
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
</style>
Summary开发
<template>
<div>
<img class="summary" :src="videoInfo.summary" />
</div>
</template>
<script>
export default {
props: {
videoInfo: {
type: Object,
required: true
}
}
};
</script>
<style lang="scss" scoped>
.summary {
width: 100%;
padding-bottom: 50px;
margin: 15px 0;
}
</style>
Course开发
<template>
<div class="c_wapper">
<div class="course">
<div class="l_img">
<img :src="videoInfo.cover_img" :title="videoInfo.title"/>
</div>
<div class="r_txt">
<div class="txt">
<span>综合评分:</span>
<p>{{videoInfo.point}}</p>
</div>
<div class="txt">
<span>价格:</span>
<p>¥{{videoInfo.price/100}}</p>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
//从父组件传值
props: {
videoInfo: {
type: Object,
required: true
}
}
};
</script>
<style lang="scss" scoped>
//包裹层
.c_wrapper {
padding: 0 14px;
}
//视频信息包裹层
.course {
margin: 14px 0;
display: flex; //设置flex,左右布局
}
//视频左边图⽚层
.l_img {
height: 88px;
margin-right: 14px;
& img {
height: 100%;
border-radius: 15px;
}
}
// 视频右边⽂字包裹层
.r_txt {
padding: 6px 0;
font-size: 12px;
flex: 1; //设置1可⾃动伸缩占⽤剩余空间
}
//每⾏⽂字层(综合评分、价格)
.txt {
// 设置flex让⽂字两端对⻬
display: flex;
justify-content: space-between;
line-height: 16px;
& p {
text-align: center;
width: 40%;
color: #3bb149;
}
& i {
color: #666;
font-weight: bolder;
width: 60%;
& span {
color: #2b333b;
font-size: 12px;
}
}
}
</style>
tab动态组件开发
不同组件之间的动态切换:https://cn.vuejs.org/v2/guide/components-dynamic-async.html
组件的过渡:https://cn.vuejs.org/v2/guide/transitions.html#ad
Tab开发
<template>
<div>
<cube-tab-bar v-model="selectedLabel" show-slider>
<cube-tab v-for="item in tabs" :label="item.label" :key="item.label"> </cube-tab>
</cube-tab-bar>
<component :videoInfo="videoInfo" :chapterList="chapterList" :is='selectedLabel==="简介"?"Summary":"Catalog"'> </component>
</div>
</template>
<script>
import Summary from "./Summary";
import Catalog from "./Catalog";
export default {
components: {
Summary,
Catalog
},
props: {
videoInfo: {
type: Object,
required: true
},
chapterList: {
type: Array,
required: true
}
},
data() {
return {
selectedLabel: "简介",
tabs: [
{
label: "简介"
},
{
label: "目录"
}
]
};
}
};
</script>
Catalog开发
<template>
<div class="cate_box">
<div>
<ul class="content" v-for="(item,index) in chapterList" :key="item.id">
<h1>第{{index+1}}章 {{item.title}}</h1>
<li class="sub_cate" v-for="(subitem,subindex) in chapterList[index].episode_List" :key="subitem.id">
<span class="sub_title">{{index+1}}-{{subindex+1}} {{subitem.title}}</span>
</li>
</ul>
</div>
</div>
</template>
<script>
export default {
props: {
chapterList: {
type: Array,
required: true
}
}
};
</script>
<style lang="scss" scoped>
// ⽬录包裹层设置边距
.cate_box {
padding: 0 15px 50px;
background-color: #fff;
margin: 15px 0;
}
//每⼀章包裹层
.content {
padding: 10px;
// 章标题
& h1 {
font-size: 16px;
width: 100%;
margin-bottom: 15px;
font-weight: bolder;
// 设置章标题过⻓,超过⾏宽度省略隐藏
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
//集包裹层
.sub_cate {
font-size: 12px;
padding: 10px 0;
//集标题
.sub_title {
// 设置集标题过⻓,超过⾏宽度省略隐藏
display: block;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
</style>
yb课堂 视频详情页模块开发《三十八》的更多相关文章
- NeHe OpenGL教程 第三十八课:资源文件
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- Java进阶(三十八)快速排序
Java进阶(三十八)快速排序 前言 有没有既不浪费空间又可以快一点的排序算法呢?那就是"快速排序"啦!光听这个名字是不是就觉得很高端呢. 假设我们现在对"6 1 2 7 ...
- 《手把手教你》系列技巧篇(三十八)-java+ selenium自动化测试-日历时间控件-下篇(详解教程)
1.简介 理想很丰满现实很骨感,在应用selenium实现web自动化时,经常会遇到处理日期控件点击问题,手工很简单,可以一个个点击日期控件选择需要的日期,但自动化执行过程中,完全复制手工这样的操作就 ...
- SQL注入之Sqli-labs系列第三十八关、第三十九关,第四十关(堆叠注入)
0x1 堆叠注入讲解 (1)前言 国内有的称为堆查询注入,也有称之为堆叠注入.个人认为称之为堆叠注入更为准确.堆叠注入为攻击者提供了很多的攻击手段,通过添加一个新 的查询或者终止查询,可以达到修改数据 ...
- 微信小程序把玩(三十八)获取设备信息 API
原文:微信小程序把玩(三十八)获取设备信息 API 获取设备信息这里分为四种, 主要属性: 网络信息wx.getNetWorkType, 系统信息wx.getSystemInfo, 重力感应数据wx. ...
- 【FastDev4Android框架开发】打造QQ6.X最新版本号側滑界面效果(三十八)
转载请标明出处: http://blog.csdn.net/developer_jiangqq/article/details/50253925 本文出自:[江清清的博客] (一).前言: [好消息] ...
- Deep learning:三十八(Stacked CNN简单介绍)
http://www.cnblogs.com/tornadomeet/archive/2013/05/05/3061457.html 前言: 本节主要是来简单介绍下stacked CNN(深度卷积网络 ...
- Android UI开发第二十八篇——Fragment中使用左右滑动菜单
Fragment实现了Android UI的分片管理,尤其在平板开发中,好处多多.这一篇将借助Android UI开发第二十六篇——Fragment间的通信. Android UI开发第二十七篇——实 ...
- bp(net core)+easyui+efcore实现仓储管理系统——入库管理之二(三十八)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- android音视频点/直播模块开发
音视频 版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 随着音视频领域的火热,在很多领域(教育,游戏,娱乐,体育,跑步,餐饮,音乐等)尝试做音视频直播/点播功能,那么作为开发一个小白, ...
随机推荐
- 微信小程序开发入门(一),Nodejs搭建本地服务器
1. 如何模拟真实环境中,读取服务端数据,首先需要使用Nodejs搭建一个本地服务器的环境. 在搭建web服务器之前,需要先安装node.js(安装版本最好为6.9.x) 安装后node.js,接下 ...
- 在jeecg-boot中密码的使用
1.生成密码并入库保存 String id= SnowflakeIdUtil.nextValue();//生成id operatCompany.setId(id); String salt = oCo ...
- 2023年的Clion内建立多个子项目(保姆级教程)
目录 下载插件C/C++ Single File Execution 项目操作 其他操作 下载插件C/C++ Single File Execution 项目操作 1.新建项目-->如图所示操作 ...
- AIRIOT物联网平台助力油库自动化升级 实现业务场景全覆盖
随着我国石油工业的飞速发展,油库规模迅速扩大,油库系统逐渐完善起来.石油行业属于高风险行业,所以石油化工产品在储存.运输和生产各个环节,均有极高的安监.环保.应急的管理要求.通常情况下,油库容量. ...
- kubernets之高级调度
一 节点的污点以及pod的容忍度以及节点的亲缘性对比 1.1 首先需要介绍的是节点的污点以及pod的污点容忍度 污点是节点的属性,容忍度是pod的属性,只有当一个pod的容忍度包含节点的污点,pod才 ...
- CSS 溢出文本
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Android OpenMAX(二)OMX Component实现基础
Android OpenMAX IL提供的API位于 frameworks/native/headers/media_plugin/media/openmax ,目录下存放有预定义的类型.组件句柄定义 ...
- 在kubernetes里使用seccomp限制容器的系统调用
目录 一.系统环境 二.前言 三.系统调用简介 四.使用seccomp限制docker容器系统调用 五.在kubernetes里使用seccomp限制容器的系统调用 5.1 配置seccomp允许po ...
- C++笔记(4)友元
通常情况下,公有类方法是访问类对象私有部分的唯一途径.除此之外,C++还提供了另外一种形式的访问权限:友元. 友元有三种: 友元函数 友元类 友元成员函数 通过让函数成为类的友元,可以赋予该函数与类的 ...
- RHCSA题目大纲
1.配置IP地址2.配置软件仓库3.调试SELinux4.创建用户账户5. 配置cron计划任务6.创建共享目录7.配置NTP时间客户端 "chronyd服务"8. auto自动 ...