Commit c7ce0ff6 authored by Mac's avatar Mac

1

parent a5b89663
......@@ -8,21 +8,21 @@
:src="selectcourse.FilePath"
@error="videoErrorCallback" controls
enable-play-gesture='true'
show-center-play-btn='false'
:controls= "selectcourse.IsPay !=1 ? false:true"
:enable-progress-gesture="selectcourse.IsPay !=1 ? false:true"
@play='play'
></video>
<view class="studybg" v-if="selectcourse.Type==1 && selectcourse.IsPay !=1 && studybg==true">
<text style="font-size: 13px;color: #FFF;" v-if="studytext=='立即购买'">试看结束</text>
<view class="studybg-t" @click="trysee()" :style="{'background':mc}">
<text>{{studytext}}</text>
</view>
</view>
<view v-if="selectcourse.Type!=1" class="studyimg">
<!-- <swiper
indicator-dots
:autoplay="true"
:interval="5000"
style="height:100%;"
>
<block v-for="(item, index) in selectcourse.ImageList" :key="index">
<swiper-item>
<image @click="previewImage(index)" v-if="item.Path" style="width:100%;height:100%;" :src="item.Path" mode=""></image>
</swiper-item>
</block>
</swiper> -->
<image @click="previewImage(index)" style="width:100%;height:100%;" :src="selectcourse.ImageList[0].Path" mode=""></image>
<image @click="previewImage(index)" v-if="selectcourse.ImageList.length>0 && selectcourse.ImageList[0].Path" style="width:100%;height:100%;" :src="selectcourse.ImageList[0].Path" mode=""></image>
<image style="width:100%;height:100%;" v-else src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/xuexibanner%20.png" mode=""></image>
</view>
</view>
......@@ -110,6 +110,8 @@
showCoupons: false,
couponMessage: "",
img:[],
studybg:true,
studytext:'立即试看'
}
},
onLoad(options) {
......@@ -120,10 +122,10 @@
this.name = options.name
this.getGoodsCourseList()//获取课程目录
this.getAppletCourseCollect()//获取课程是否收藏
// this.setMyStudyTime()//增加课程学习时间
// this.timer = setInterval(()=>{
// this.setMyStudyTime(10)
// },10000)
this.setMyStudyTime()//增加课程学习时间
this.timer = setInterval(()=>{
this.setMyStudyTime(10)
},10000)
}
// 多反了个字段 IsRead 是否已学习, 1是 2否
......@@ -142,6 +144,9 @@
console.log('清楚定时器')
}
},
onReady: function (res) {
this.videoContext = uni.createVideoContext('myVideo')
},
methods:{
onShareAppMessage() {
setTimeout(() => {
......@@ -163,12 +168,31 @@
imageUrl: ''
};
},
//图片预览
previewImage(index) {
uni.previewImage({
urls: this.img,
current: index,
});
//图片预览和文档的打开
previewImage(index=0) {
console.log(this.selectcourse)
if(this.selectcourse.IsPay!=1){
if(this.img.length>0){
uni.previewImage({
urls: this.img,
current: index,
});
}
}else{
uni.downloadFile({
url: this.selectcourse.FilePath,
success: function (res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
success: function (res) {
console.log('打开文档成功');
}
});
}
});
}
},
goback(){
uni.navigateBack({})
......@@ -229,7 +253,8 @@
item.ImageList.forEach((x) => {
this.img.push(x.Path);
});
console.log('进入',this.selectcourse.ImageList)
this.studybg = true;
this.studytext='立即试看'
this.setMyCourseStudyOK()//在换章节的时候标记
}else{
let that =this
......@@ -322,6 +347,41 @@
closeBtn() {
this.showCoupons = false;
},
play(){
if(this.selectcourse.IsPay!=1){//没有购买试看的时候处理
setTimeout(()=>{
this.videoContext.pause();
this.studybg = true;
if(this.selectcourse.IsPay==2){
this.studytext='立即去支付'
}else{
this.studytext='立即购买'
}
},this.selectcourse.Number*1000)
}
},
trysee(){
if(this.studytext=='立即试看'){
this.videoContext.play();
this.studybg = false;
}else if(this.studytext=='立即购买'){
let DetailList = [];
let obj={
GoodsId:this.id,
Number:1,
}
DetailList.push(obj)
uni.navigateTo({
url:'/pages/school/course-submit?DetailList='+encodeURIComponent(JSON.stringify(DetailList))
})
}else if(this.studytext=='立即去支付'){
uni.navigateTo({
url:'/pages/school/personal/orderList?status=1'
})
}
}
}
}
</script>
......@@ -330,6 +390,7 @@
.courseContent .course-top{
width: 100%;
height: 230px;
position: relative;
}
.courseContent .goback{
margin-left: 15px;
......@@ -399,4 +460,29 @@
width: 100%;
height: 100%;
}
.courseContent .studybg{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background-image: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/gmbanner%20.png');
background-repeat: no-repeat;
background-size: cover;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.courseContent .studybg-t{
width: 115px;
height: 30px;
border-radius: 6px;
font-size: 14px;
margin-top: 10px;
color:#FFF;
display: flex;
align-items: center;
justify-content: center;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment