You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
yanzong_qianduan/pages/merchantTutorial/tutorial.vue

317 lines
7.4 KiB

<template>
<view class="park">
<view class="park-top">
<view class="park-navbar">
<u-navbar title="商家教程" :border-bottom="false" :background="background"></u-navbar>
</view>
<view class="top-title">
软件操作 流量运营教学
</view>
<view class="top-marker">
系统教学 · 通俗易懂 · 一学就会
</view>
<view class="top-marker">
软件操作教学 · 流量运营课堂
</view>
</view>
<view class="park-center">
<u-tabs name="name" count="cate_count" :list="courseTypeList" :is-scroll="false" height="90"
active-color="rgba(243, 74, 64, 1)" inactive-color="rgba(102, 102, 102, 1)" font-size="32"
bar-width="55" bar-height="6" :current="current" @change="change">
</u-tabs>
<view class="center-box" v-if="courseList.length>0">
<view class="list" v-for="(a,i) in courseList" :key="i" @click="onLookCord(a.video_url.external_url)">
<image :src="a.image_url?a.image_url.external_url:''" mode="heightFix" class="img"></image>
<view class="infor">
<view class="title">
{{a.course_name}}
</view>
<view class="subtitle">
{{a.course_detail}}
</view>
</view>
<view class="look">
观看
</view>
</view>
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
</view>
<u-empty text="暂无数据显示哦~" v-else mode="list"></u-empty>
</view>
<u-mask :show="show" @click="pauseVideo">
<view class="warp">
<video @tap.stop style="width: 100%;" :loop='true' id="myVideo" :src="video_url"></video>
</view>
</u-mask>
</view>
</template>
<script>
import * as api from '@/api/tutorial'
export default {
data() {
return {
background: {
background: 'none'
},
courseTypeList: [],
current: 0,
courseList: [],
show: false,
video_url: '',
page: 1,
pageSize: 15,
iconType: 'flower',
status: 'loadmore',
total: 0,
loadText: {
loadmore: '上拉加载更多',
loading: '正在加载',
nomore: '亲,没有更多了 '
}
}
},
onLoad() {
this.getCourseType()
},
onShow() {
},
// 下拉刷新
onPullDownRefresh() {
this.courseList = [];
this.page = 1;
this.getCourseList();
uni.stopPullDownRefresh(); //停止刷新
},
onReachBottom() {
if (this.page * this.pageSize >= this.total) return
this.page++;
this.status = 'loading'
this.getCourseList();
},
methods: {
pauseVideo() {
uni.createSelectorQuery().select('#myVideo').boundingClientRect(function(rect) {
uni.createVideoContext('myVideo', this).pause();
}).exec();
this.show = false
},
change(index) {
this.courseList = [];
this.page = 1;
this.current = index;
this.getCourseList()
},
onLookCord(url) {
if (url) {
this.show = true;
let videoContext = wx.createVideoContext('myVideo')
videoContext.seek(0);
this.video_url = url
} else {
this.$toast('暂无可观看的视频')
}
},
// 分类
async getCourseType() {
let {
status,
message,
data
} = await api.courseType();
if (status == 200) {
this.courseTypeList = data.courseTypes ? data.courseTypes : []
this.getCourseList()
} else {
this.courseTypeList = []
this.$toast(message)
}
},
// 列表
async getCourseList() {
let that = this;
let pames = {
courseCategoryId: that.courseTypeList[that.current].course_category_id,
page: that.page,
pageSize: that.pageSize
}
let {
status,
message,
data
} = await api.courseList(pames);
if (status == 200) {
const newData = data.list.data || [];
that.courseList = [...that.courseList, ...newData]; // 将新数据添加到已有数据的尾部
that.total = data.list.total;
if (that.courseList.length >= that.total) {
that.status = 'nomore'
} else {
that.status = 'loadmore'
}
} else {
that.total = 0
that.$toast(message)
}
},
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
::v-deep .u-empty {
padding: 100rpx 0;
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
position: relative;
background: black;
z-index: 999;
}
.park {
height: 100%;
width: 100%;
background: rgba(255, 255, 255, 1);
.park-top {
width: 100%;
height: 450rpx;
background: url(https://www.royaum.com.cn/static/user/courseBg.png);
background-size: 100%;
.top-title {
opacity: 1;
font-size: 64rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
text-align: left;
vertical-align: top;
padding: 30rpx 0rpx 20rpx 48rpx;
}
.top-marker {
padding-top: 15rpx;
padding-left: 48rpx;
font-size: 32rpx;
font-weight: 400;
line-height: 44rpx;
color: rgba(102, 102, 102, 1);
text-align: left;
vertical-align: top;
}
}
.park-center {
background: #fff;
width: 100%;
overflow: hidden;
padding-bottom: 50rpx;
.center-box {
overflow: hidden;
padding: 20rpx 30rpx;
.list {
position: relative;
overflow: hidden;
height: 152rpx;
border-radius: 28rpx;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(250, 177, 173, 0.07) 59.66%, rgba(243, 74, 64, 0.06) 100%);
display: flex;
align-items: center;
padding: 30rpx 20rpx;
margin-bottom: 50rpx;
.look {
right: 0;
bottom: 0;
position: absolute;
width: 136rpx;
height: 50rpx;
border-radius: 17rpx 0rpx 28rpx 0rpx;
background: linear-gradient(125.45deg, rgba(255, 138, 102, 1) 0%, rgba(243, 74, 64, 1) 100%);
font-size: 28rpx;
font-weight: 500;
letter-spacing: 0rpx;
line-height: 50rpx;
color: rgba(255, 255, 255, 1);
text-align: center;
vertical-align: top;
}
.img {
width: 164rpx;
height: 124rpx;
border-radius: 20rpx;
margin-right: 40rpx;
}
.infor {
overflow: hidden;
width: 478rpx;
.title {
font-size: 32rpx;
font-weight: 500;
letter-spacing: 0rpx;
line-height: 44rpx;
color: rgba(51, 51, 51, 1);
text-align: left;
vertical-align: middle;
overflow: hidden;
/* 确保内容超出容器时会被隐藏 */
display: -webkit-box;
/* 作为弹性伸缩盒子模型显示 */
-webkit-line-clamp: 2;
/* 限制在两行 */
-webkit-box-orient: vertical;
/* 垂直排列盒子 */
text-overflow: ellipsis;
/* 超出部分显示省略号 */
white-space: normal;
/* 使用正常的白空格处理方式,允许换行 */
}
.subtitle {
margin-top: 10rpx;
/** 文本1 */
font-size: 26rpx;
font-weight: 400;
letter-spacing: 0rpx;
color: rgba(102, 102, 102, 1);
text-align: left;
vertical-align: middle;
overflow: hidden;
/* 确保内容超出容器时会被隐藏 */
display: -webkit-box;
/* 作为弹性伸缩盒子模型显示 */
-webkit-line-clamp: 1;
/* 限制在两行 */
-webkit-box-orient: vertical;
/* 垂直排列盒子 */
text-overflow: ellipsis;
/* 超出部分显示省略号 */
white-space: normal;
/* 使用正常的白空格处理方式,允许换行 */
max-width: 320rpx;
}
}
}
}
}
}
</style>