|
@@ -8,7 +8,7 @@ Page({
|
|
fullScreenBtn: false,
|
|
fullScreenBtn: false,
|
|
playBtn: true,
|
|
playBtn: true,
|
|
gesture: true,
|
|
gesture: true,
|
|
- centerBtn: false,
|
|
|
|
|
|
+ centerBtn: true,
|
|
controls: true,
|
|
controls: true,
|
|
videoLoad: false,
|
|
videoLoad: false,
|
|
autoPlay: true,
|
|
autoPlay: true,
|
|
@@ -23,15 +23,16 @@ Page({
|
|
totalNo: 0,
|
|
totalNo: 0,
|
|
collectFlag: false,
|
|
collectFlag: false,
|
|
goBackHome: false,
|
|
goBackHome: false,
|
|
- lazyVideoUrl: ''
|
|
|
|
|
|
+ lazyVideoUrl: '',
|
|
|
|
+ isIOS: app.globalData.isIOS
|
|
},
|
|
},
|
|
onLoad: function (option) {
|
|
onLoad: function (option) {
|
|
console.log(option);
|
|
console.log(option);
|
|
- if(option.scene || option.shareCard){
|
|
|
|
|
|
+ if (option.scene || option.shareCard) {
|
|
this.setData({
|
|
this.setData({
|
|
- goBackHome: true
|
|
|
|
|
|
+ goBackHome: true
|
|
})
|
|
})
|
|
- }
|
|
|
|
|
|
+ }
|
|
this.setData({
|
|
this.setData({
|
|
// title: option.title,
|
|
// title: option.title,
|
|
id: option.id
|
|
id: option.id
|
|
@@ -40,31 +41,31 @@ Page({
|
|
this.uid = wx.getStorageSync('uid');;
|
|
this.uid = wx.getStorageSync('uid');;
|
|
|
|
|
|
|
|
|
|
- httpRequestApi.getClassDetail(this.uid, option.id).success(res => {
|
|
|
|
- console.log(res);
|
|
|
|
- this.setData({
|
|
|
|
- title: res.data.data.title,
|
|
|
|
- videoUrl: res.data.data.playUrl,
|
|
|
|
- iconImg: res.data.data.iconImg
|
|
|
|
- })
|
|
|
|
- wx.setNavigationBarTitle({
|
|
|
|
- title: res.data.data.title //页面标题为路由参数
|
|
|
|
- })
|
|
|
|
- this.getReadInfo(1, 10);
|
|
|
|
- this.checkLike();
|
|
|
|
|
|
+ httpRequestApi.getClassDetail(this.uid, option.id).success(res => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ this.setData({
|
|
|
|
+ title: res.data.data.title,
|
|
|
|
+ videoUrl: res.data.data.playUrl,
|
|
|
|
+ iconImg: res.data.data.iconImg
|
|
|
|
+ })
|
|
|
|
+ wx.setNavigationBarTitle({
|
|
|
|
+ title: res.data.data.title //页面标题为路由参数
|
|
})
|
|
})
|
|
|
|
+ this.getReadInfo(1, 10);
|
|
|
|
+ this.checkLike();
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- // video组件在获得url时迅速退出页面会导致小程序闪退,官方还没修复(11/28),处理办法:懒加载思路,在用户点击时再获取videoUrl
|
|
|
|
|
|
+ // video组件在获得url时迅速退出页面会导致小程序闪退,官方还没修复(11/28),处理办法:懒加载思路,在用户点击时再获取videoUrl
|
|
// setVideoUrl: function(){
|
|
// setVideoUrl: function(){
|
|
// console.log('视频地址>>>>>>>>',this.data.lazyVideoUrl)
|
|
// console.log('视频地址>>>>>>>>',this.data.lazyVideoUrl)
|
|
// this.setData({
|
|
// this.setData({
|
|
// videoUrl: this.data.lazyVideoUrl,
|
|
// videoUrl: this.data.lazyVideoUrl,
|
|
// })
|
|
// })
|
|
// },
|
|
// },
|
|
- videoPlayHandler: function(){
|
|
|
|
|
|
+ videoPlayHandler: function () {
|
|
this.setData({
|
|
this.setData({
|
|
videoLoad: true
|
|
videoLoad: true
|
|
- },()=>{
|
|
|
|
|
|
+ }, () => {
|
|
this.videoCtx = wx.createVideoContext('classVideo', this);
|
|
this.videoCtx = wx.createVideoContext('classVideo', this);
|
|
this.videoCtx.play();
|
|
this.videoCtx.play();
|
|
})
|
|
})
|
|
@@ -80,35 +81,39 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
goToReading: function () {
|
|
goToReading: function () {
|
|
-
|
|
|
|
|
|
+
|
|
let classId = this.data.id;
|
|
let classId = this.data.id;
|
|
- httpRequestApi.checkLesson(classId).success(res=>{
|
|
|
|
|
|
+ httpRequestApi.checkLesson(classId).success(res => {
|
|
const productId = res.data.data[0];
|
|
const productId = res.data.data[0];
|
|
|
|
+ // wx.navigateTo({
|
|
|
|
+ // url: `../../main/reading/reading?id=${classId}`
|
|
|
|
+ // })
|
|
|
|
+ // return;
|
|
httpRequestApi.areYouSuper(res.data.data).success(res => {
|
|
httpRequestApi.areYouSuper(res.data.data).success(res => {
|
|
- if(res.data.success){
|
|
|
|
|
|
+ if (res.data.success) {
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
url: `../../main/reading/reading?id=${classId}`
|
|
url: `../../main/reading/reading?id=${classId}`
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
- // ios用户 并且没有购买过此书
|
|
|
|
- if(app.globalData.isIOS){
|
|
|
|
- wx.showModal({
|
|
|
|
- title: '暂不支持',
|
|
|
|
- content: '十分抱歉,由于相关规定,您暂时无法在这里朗读',
|
|
|
|
- success(res) {
|
|
|
|
- if (res.confirm) {
|
|
|
|
- console.log('用户点击确定')
|
|
|
|
- } else if (res.cancel) {
|
|
|
|
- console.log('用户点击取消')
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ // ios用户 并且没有购买过此书
|
|
|
|
+ // if (app.globalData.isIOS) {
|
|
|
|
+ // wx.showModal({
|
|
|
|
+ // title: '暂不支持',
|
|
|
|
+ // content: '十分抱歉,由于相关规定,您暂时无法在这里朗读',
|
|
|
|
+ // success(res) {
|
|
|
|
+ // if (res.confirm) {
|
|
|
|
+ // console.log('用户点击确定')
|
|
|
|
+ // } else if (res.cancel) {
|
|
|
|
+ // console.log('用户点击取消')
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
wx.showModal({
|
|
wx.showModal({
|
|
title: '您未购买过本书,不能朗读',
|
|
title: '您未购买过本书,不能朗读',
|
|
content: '超值团购进行中,快去看看',
|
|
content: '超值团购进行中,快去看看',
|
|
- success (res) {
|
|
|
|
|
|
+ success(res) {
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
console.log('用户点击确定')
|
|
console.log('用户点击确定')
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
@@ -122,7 +127,7 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
openShare: function (e) {
|
|
openShare: function (e) {
|
|
// this.setData({
|
|
// this.setData({
|
|
@@ -141,20 +146,20 @@ Page({
|
|
},
|
|
},
|
|
onShareAppMessage: function (res) {
|
|
onShareAppMessage: function (res) {
|
|
if (res.from === 'button') {
|
|
if (res.from === 'button') {
|
|
- // 来自页面内转发按钮
|
|
|
|
- console.log(res.target)
|
|
|
|
|
|
+ // 来自页面内转发按钮
|
|
|
|
+ console.log(res.target)
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
- title: '老师同学都在玩的配音show,你还在等什么?',
|
|
|
|
- path: `pages/main/class/class?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
|
|
|
|
- imageUrl: '../../../static/share/class_icon.jpg'
|
|
|
|
|
|
+ title: '老师同学都在玩的配音show,你还在等什么?',
|
|
|
|
+ path: `pages/main/class/class?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
|
|
|
|
+ imageUrl: '../../../static/share/class_icon.jpg'
|
|
}
|
|
}
|
|
-},
|
|
|
|
|
|
+ },
|
|
goToWorks: function (e) {
|
|
goToWorks: function (e) {
|
|
console.log(this.data.works)
|
|
console.log(this.data.works)
|
|
// this.videoCtx = wx.createVideoContext('myVideo', this);
|
|
// this.videoCtx = wx.createVideoContext('myVideo', this);
|
|
- if(this.videoCtx){
|
|
|
|
- this.videoCtx.stop();
|
|
|
|
|
|
+ if (this.videoCtx) {
|
|
|
|
+ this.videoCtx.stop();
|
|
}
|
|
}
|
|
console.log(e);
|
|
console.log(e);
|
|
let readId = e.currentTarget.dataset.id;
|
|
let readId = e.currentTarget.dataset.id;
|
|
@@ -215,7 +220,7 @@ Page({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onHide: function () {
|
|
onHide: function () {
|
|
- let videoCtx = wx.createVideoContext('classVideo',this);
|
|
|
|
|
|
+ let videoCtx = wx.createVideoContext('classVideo', this);
|
|
videoCtx.stop();
|
|
videoCtx.stop();
|
|
-},
|
|
|
|
|
|
+ },
|
|
})
|
|
})
|