课程说明云点播
This commit is contained in:
@@ -3,64 +3,34 @@
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<z-nav-bar :title="courseInfo.id ? courseTitle : '课程说明'">
|
||||
<uni-icons type="bars" class="topRight" slot="right" @click="showDrawer('showRight')" size="22"></uni-icons>
|
||||
<!-- <uni-icons type="bars" class="topRight" slot="right" @click="showDrawer('showRight')" size="22"></uni-icons> -->
|
||||
</z-nav-bar>
|
||||
<view class="containerBg">
|
||||
<view class="example-body">
|
||||
<!-- <button type="primary" @click="showDrawer('showRight')"><text class="word-btn-white">全部课程</text>
|
||||
</button> -->
|
||||
<uni-drawer ref="showRight" mode="right" :width="320" @change="changeD($event,'showRight')">
|
||||
<view class="close">
|
||||
<view class="zhan" style="width: 100%;"></view>
|
||||
<u-icon name="close" @click="closeDrawer('showRight')" color="#2979ff" size="28"></u-icon>
|
||||
</view>
|
||||
<view class="proTitle">
|
||||
<text>点击课程名称即可查看对应的课程说明</text>
|
||||
</view>
|
||||
<uni-collapse accordion v-model="accordionVal" v-if="treeList.length > 0" @change="collapseChange">
|
||||
<uni-collapse-item v-for="(item, index) in treeList" :key="index" :title="item.title"
|
||||
:show-animation="true">
|
||||
<view class="content">
|
||||
<!-- <text class="text">{{item.title}}</text> -->
|
||||
<view class="sub1List">
|
||||
<view :class="['item', 'leve2',curId == item1.id ? 'active' : '']"
|
||||
v-for="(item1, index1) in item.children" :key="index1"
|
||||
@click.stop="clickCourseInfo(item1)">
|
||||
<text class="textss"> {{item1.title}}</text>
|
||||
<view class="sub2List" v-if="item1.children">
|
||||
<view :class="['item', 'leve3',curId == item2.id ? 'active' : '']"
|
||||
v-for="(item2, index2) in item1.children" :key="index2"
|
||||
@click.stop="clickCourseInfo(item2)">
|
||||
<text class="textss">{{item2.title}}</text>
|
||||
<view class="sub3List" v-if="item2.children">
|
||||
<view :class="['item', 'leve4',curId == item3.id ? 'active' : '']"
|
||||
v-for="(item3, index3) in item2.children" :key="index3"
|
||||
@click.stop="clickCourseInfo(item3)">
|
||||
<text class="textss">{{item3.title}}33</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
</uni-drawer>
|
||||
<view class="" style="background: #55aaff;">
|
||||
<u-tabs :class="['tabList']" @click="tabChange" :current="curTagIndex"
|
||||
:activeStyle="activeStyle" :scrollable="scrollable" lineColor="#ef9f00" :list="tabList" :inactiveStyle="{
|
||||
color: '#fff', }"
|
||||
itemStyle="padding-left: 15px; padding-right: 15px; height: 50px;"></u-tabs>
|
||||
</view>
|
||||
|
||||
<view class="tabLeve1 subItem flexbox" v-if="Leve1.length > 0">
|
||||
<text :class="[leve1Index == index ? 'cur' : '']" v-for="(item, index) in Leve1" :key="index" @click="leve1Click(item, index)">{{item.title}}</text>
|
||||
</view>
|
||||
<view class="tabLeve2 subItem flexbox" v-if="Leve2.length > 0">
|
||||
<text :class="[leve2Index == index ? 'cur' : '']" v-for="(item, index) in Leve2" :key="index" @click="leve2Click(item, index)">{{item.title}}</text>
|
||||
</view>
|
||||
<view class="tabLeve3 subItem flexbox" v-if="Leve3.length > 0">
|
||||
<text :class="[leve3Index == index ? 'cur' : '']" v-for="(item, index) in Leve3" :key="index" @click="leve3Click(item, index)">{{item.title}}</text>
|
||||
</view>
|
||||
<view class="containerBg">
|
||||
<view class="infoBox" v-if="courseInfo.id">
|
||||
<uni-section :title="courseTitle" type="line" titleFontSize="16px">
|
||||
<rich-text v-if="courseInfo.content" class="content"
|
||||
:nodes="formatRichText(courseInfo.content)"></rich-text>
|
||||
<!-- <text>超强树选择器、树组件、树插件、无限级联树、单选树、多选树、自定义样式树、树形选择 </text> -->
|
||||
<view class="audio" v-if="courseInfo.mediaType == 2 && courseInfo.media != ''">
|
||||
<audio style="text-align: left" :src="current.src" :poster="current.poster" :name="current.name"
|
||||
:author="current.author" :action="audioAction" controls></audio>
|
||||
<view class="audio" style="margin-bottom: 20rpx;" v-if="courseInfo.mediaType == 2 && courseInfo.media != ''">
|
||||
<audio style="text-align: left" :src="courseInfo.media" :poster="audioPoster" :name="courseTitle"
|
||||
author="吴门医述" :action="audioAction" controls></audio>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view v-if="courseInfo.mediaType ==1 && courseInfo.media != ''" style="width: 100%;height: 100%;text-align: center;" v-html="videoHTML">
|
||||
</view>
|
||||
<!-- <view v-if="courseInfo.mediaType ==1 && courseInfo.media != ''" style="width: 100%;height: 100%;text-align: center;" v-html="videoHTML">
|
||||
</view> -->
|
||||
<!-- 视频播放器样式 -->
|
||||
<!-- <view class="videoTemp" v-show="showTemp">
|
||||
<u-icon name="play-circle" color="#fff" size="40" @click="clickToPlay"></u-icon>
|
||||
@@ -71,6 +41,12 @@
|
||||
enable-danmu danmu-btn controls @ended="playEnd"></video> -->
|
||||
<!-- </view> -->
|
||||
</view>
|
||||
<rich-text v-if="courseInfo.content" class="content"
|
||||
:nodes="formatRichText(courseInfo.content)"></rich-text>
|
||||
<!-- <text>超强树选择器、树组件、树插件、无限级联树、单选树、多选树、自定义样式树、树形选择 </text> -->
|
||||
|
||||
|
||||
|
||||
</uni-section>
|
||||
</view>
|
||||
</view>
|
||||
@@ -89,18 +65,44 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData: {},
|
||||
playData: {},
|
||||
Leve1:[],
|
||||
Leve2:[],
|
||||
Leve3:[],
|
||||
accordionVal: '',
|
||||
// extraIcon:{
|
||||
// color: '#4cd964',
|
||||
// size: '100',
|
||||
// }
|
||||
scrollable:true,
|
||||
treeList: [],
|
||||
tagId: null,
|
||||
pid: null,
|
||||
|
||||
bgiStyle: {
|
||||
background: '#fff'
|
||||
},
|
||||
curTagIndex:0,
|
||||
leve1Index:null,
|
||||
leve2Index:null,
|
||||
leve3Index:null,
|
||||
iconStyle: {
|
||||
fontSize: '40rpx',
|
||||
fontWeight: 'bold',
|
||||
color: '#258feb',
|
||||
},
|
||||
tabList:[
|
||||
|
||||
],
|
||||
activeStyle: {
|
||||
color: '#fff',
|
||||
fontWeight: 'bold', padding:'20rpx',
|
||||
transform: 'scale(1.2)',
|
||||
backgroundColor: '#ef9f00'
|
||||
|
||||
},
|
||||
courseInfo: {},
|
||||
poster:'../../static/videoF.jpg', //封面图
|
||||
audioPoster:'../../static/logo.png',
|
||||
current: {
|
||||
poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png',
|
||||
name: '致爱丽丝',
|
||||
@@ -114,6 +116,7 @@
|
||||
courseTitle: '',
|
||||
showTemp:true,
|
||||
videoContext:null,
|
||||
|
||||
videoUrl:'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4'
|
||||
};
|
||||
},
|
||||
@@ -153,34 +156,78 @@
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
showDrawer(e) {
|
||||
this.$refs[e].open()
|
||||
this.videoContext.pause()
|
||||
this.showTemp = true
|
||||
console.log(5555)
|
||||
},
|
||||
// 关闭窗口
|
||||
closeDrawer(e) {
|
||||
this.$refs[e].close()
|
||||
},
|
||||
collapseChange(e){
|
||||
console.log(e,'折叠面板点击');
|
||||
if(e){
|
||||
this.tagId = this.treeList[e].id
|
||||
this.getCourseInfo(this.tagId)
|
||||
// this.closeDrawer('showRight')
|
||||
tabChange(e){
|
||||
console.log(e,'e');
|
||||
let _index = e.index
|
||||
this.clickCourseInfo(this.treeList[_index])
|
||||
this.curTagIndex = _index
|
||||
this.leve1Index = null
|
||||
this.leve2Index = null
|
||||
this.leve3Index = null
|
||||
if(this.treeList[_index].isLast == 0 && this.treeList[_index].children.length > 0){
|
||||
this.Leve1 = this.treeList[_index].children
|
||||
if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){
|
||||
this.Leve2 = this.Leve1[0].children
|
||||
// console.log(this.Leve2,'Leve2');
|
||||
if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){
|
||||
this.Leve3 = this.Leve2[0].children
|
||||
}else{
|
||||
this.Leve3 = []
|
||||
}
|
||||
}else{
|
||||
this.Leve2 = []
|
||||
this.Leve3 = []
|
||||
}
|
||||
|
||||
}else{
|
||||
this.Leve1 = []
|
||||
this.Leve2 = []
|
||||
this.Leve3 = []
|
||||
}
|
||||
},
|
||||
changeD(e, type) {
|
||||
// console.log((type === 'showRight' ? '左窗口' : '右窗口') + (e ? '打开' : '关闭'));
|
||||
this[type] = e
|
||||
if(!e){
|
||||
this.showTemp = false
|
||||
console.log('关闭弹窗')
|
||||
this.videoContext.play()
|
||||
leve1Click(val, index){
|
||||
console.log(this.Leve1[index],'val');
|
||||
this.leve1Index = index
|
||||
this.leve2Index = null
|
||||
this.leve3Index = null
|
||||
this.clickCourseInfo(val)
|
||||
if(this.Leve1[index].isLast == 0 && this.Leve1[index].children.length > 0){
|
||||
this.Leve2 = this.Leve1[index].children
|
||||
console.log(this.Leve2,'Leve2');
|
||||
}else{
|
||||
this.Leve2 = []
|
||||
this.Leve3 = []
|
||||
}
|
||||
|
||||
},
|
||||
leve2Click(val, index){
|
||||
this.leve2Index = index
|
||||
if(this.leve1Index == null){
|
||||
this.leve1Index = 0
|
||||
}
|
||||
this.leve3Index = null
|
||||
// console.log(val,'三级点击');
|
||||
this.clickCourseInfo(val)
|
||||
if(this.Leve2[index].isLast == 0 && this.Leve2[index].children.length > 0){
|
||||
this.Leve3 = this.Leve2[index].children
|
||||
}else{
|
||||
this.Leve3 = []
|
||||
}
|
||||
},
|
||||
leve3Click(val, index){
|
||||
this.leve3Index = index
|
||||
// console.log(val,'四级点击');
|
||||
if(this.leve2Index == null){
|
||||
this.leve2Index = 0
|
||||
}
|
||||
if(this.leve1Index == null){
|
||||
this.leve1Index = 0
|
||||
}
|
||||
this.clickCourseInfo(val)
|
||||
// if(this.Leve3[index].isLast == 0){
|
||||
// this.Leve3 = this.Leve2[index].children
|
||||
// }
|
||||
},
|
||||
|
||||
formatRichText(html) { //控制图片大小
|
||||
let newContent = html.replace(/<img[^>]*>/gi, function (match, capture) {
|
||||
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
|
||||
@@ -198,15 +245,39 @@
|
||||
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
|
||||
return newContent;
|
||||
},
|
||||
getData() {
|
||||
getData() {
|
||||
this.$http
|
||||
.post('medical/home/getCourseMedicalTree')
|
||||
.then(res => {
|
||||
if (res.code == 0 && res.labels.length > 0) {
|
||||
this.tabList = []
|
||||
this.treeList = res.labels
|
||||
if(this.treeList[0].isLast == 0 && this.treeList[0].children.length > 0){
|
||||
this.Leve1 = this.treeList[0].children
|
||||
if(this.Leve1[0].isLast == 0 && this.Leve1[0].children.length > 0){
|
||||
this.Leve2 = this.Leve1[0].children
|
||||
// console.log(this.Leve2,'Leve2');
|
||||
if(this.Leve2[0].isLast == 0 && this.Leve2[0].children.length > 0){
|
||||
this.Leve3 = this.Leve2[0].children
|
||||
}else{
|
||||
this.Leve3 = []
|
||||
}
|
||||
}else{
|
||||
this.Leve2 = []
|
||||
this.Leve3 = []
|
||||
}
|
||||
|
||||
}else{
|
||||
this.Leve1 = []
|
||||
this.Leve2 = []
|
||||
this.Leve3 = []
|
||||
}
|
||||
res.labels.forEach( item => {
|
||||
this.tabList.push({id:item.id, name: item.title})
|
||||
})
|
||||
this.getCourseInfo(this.treeList[0].id)
|
||||
// console.log(this.treeList[0].id,'+++++')
|
||||
this.showDrawer('showRight')
|
||||
// this.showDrawer('showRight')
|
||||
} else {
|
||||
this.treeList = []
|
||||
}
|
||||
@@ -232,9 +303,10 @@
|
||||
this.courseTitle = this.courseInfo.title + '课程说明'
|
||||
this.curId = id
|
||||
if(this.courseInfo.mediaType == 1 && this.courseInfo.media != ''){
|
||||
// this.videoUrl = this.courseInfo.media
|
||||
this.videoUrl = this.courseInfo.media
|
||||
// this.poster = this.videoUrl +
|
||||
// "?x-oss-process=video/snapshot,t_0,f_jpg"
|
||||
// this.getVideoPath(this.courseInfo.media)
|
||||
}else{
|
||||
// this.videoUrl = ''
|
||||
this.poster = ''
|
||||
@@ -255,10 +327,31 @@
|
||||
console.log(e, '课程详情报错')
|
||||
});
|
||||
},
|
||||
clickCourseInfo(item) {
|
||||
|
||||
this.getCourseInfo(item.id)
|
||||
this.closeDrawer('showRight')
|
||||
// 获得播放地址
|
||||
getVideoPath(str){
|
||||
console.log(str,'str');
|
||||
$http.request({
|
||||
url: "sociology/course/checkVideo",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
id: str
|
||||
},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
})
|
||||
// this.$http
|
||||
// .post('sociology/course/checkVideo',{
|
||||
// id: str
|
||||
// })
|
||||
.then(res => {
|
||||
console.log(res,'res');
|
||||
}).catch(e => {
|
||||
console.log(e,'获取视频播放地址错误');
|
||||
})
|
||||
},
|
||||
clickCourseInfo(item) {
|
||||
this.getCourseInfo(item.id)
|
||||
},
|
||||
playEnd(){
|
||||
this.showTemp = true
|
||||
@@ -274,25 +367,25 @@
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
|
||||
::v-deep .containerBg {
|
||||
// .uni-collapse-item__title-box {
|
||||
// background-color: transparent !important;
|
||||
// }
|
||||
|
||||
// .uni-collapse-item__title {
|
||||
// background-image: linear-gradient(90deg, #258feb 0%, #00e1ec 100%) !important;
|
||||
|
||||
// text {
|
||||
// color: #fff !important;
|
||||
// font-size: 28rpx !important;
|
||||
// }
|
||||
// }
|
||||
::v-deep .containerBg {
|
||||
.uni-audio-default{width: 100% !important;}
|
||||
#myVideo {
|
||||
width: 100% !important;
|
||||
}
|
||||
video{width: 100% !important; }
|
||||
}
|
||||
|
||||
.flexbox{display: flex;}
|
||||
.subItem{
|
||||
background-color: #ebeef5; padding: 10rpx;
|
||||
flex-wrap: wrap;
|
||||
justify-content:start;
|
||||
text{display: inline-block; width: calc(25% - 8rpx); text-align: center; border-radius: 10rpx; color: #258feb; padding: 10rpx 20rpx; border: 1px solid #258feb;
|
||||
margin: 6rpx 0; font-size: 26rpx; margin-right: 10rpx;
|
||||
}
|
||||
text:last-child{margin-right: 0 !important;}
|
||||
.cur{background: #258feb; display: inline-block; color: #fff; border-radius: 10rpx; padding: 10rpx 20rpx; }
|
||||
|
||||
}
|
||||
.close {
|
||||
display: flex;
|
||||
justify-content: right;
|
||||
|
||||
Reference in New Issue
Block a user