|
@@ -2,6 +2,9 @@ import httpRequestApi from '../../../utils/APIClient';
|
|
import {
|
|
import {
|
|
formatDate
|
|
formatDate
|
|
} from '../../../utils/util';
|
|
} from '../../../utils/util';
|
|
|
|
+import {
|
|
|
|
+ getOpenidSessionKey
|
|
|
|
+ } from '../../../utils/httpUtil';
|
|
const app = getApp()
|
|
const app = getApp()
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
@@ -30,6 +33,7 @@ Page({
|
|
isIOS: app.globalData.isIOS,
|
|
isIOS: app.globalData.isIOS,
|
|
alertFlag: false,
|
|
alertFlag: false,
|
|
modalType: "text",
|
|
modalType: "text",
|
|
|
|
+ noScroll: '',
|
|
modalText: [{
|
|
modalText: [{
|
|
text: '您还不是本课程的会员',
|
|
text: '您还不是本课程的会员',
|
|
type: 'bigOrange'
|
|
type: 'bigOrange'
|
|
@@ -39,9 +43,10 @@ Page({
|
|
type: 'normal'
|
|
type: 'normal'
|
|
}
|
|
}
|
|
],
|
|
],
|
|
- modalBtnText:'去开团',
|
|
|
|
|
|
+ modalBtnText: '去开团',
|
|
isModalShow: false,
|
|
isModalShow: false,
|
|
- modalCloseShow: true
|
|
|
|
|
|
+ modalCloseShow: true,
|
|
|
|
+ hide: true
|
|
// shareFlag: false
|
|
// shareFlag: false
|
|
},
|
|
},
|
|
showAlert: function () {
|
|
showAlert: function () {
|
|
@@ -50,27 +55,35 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
onLoad: function (option) {
|
|
onLoad: function (option) {
|
|
- let id = option.id ? option.id : option.scene.replace('QR', '')
|
|
|
|
- if (option.scene || option.shareCard) {
|
|
|
|
|
|
+ getOpenidSessionKey((res) => {
|
|
|
|
+ let id = option.id ? option.id : option.scene.replace('QR', '')
|
|
|
|
+ if (option.scene || option.shareCard) {
|
|
|
|
+ this.setData({
|
|
|
|
+ goBackHome: true
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // wx.setNavigationBarTitle({
|
|
|
|
+ // title: option.title //页面标题为路由参数
|
|
|
|
+ // })
|
|
|
|
+ this.uid = wx.getStorageSync('uid');
|
|
|
|
+ let stackSize = 1;
|
|
|
|
+ if (option.stackSize) {
|
|
|
|
+ stackSize = option.stackSize;
|
|
|
|
+ }
|
|
this.setData({
|
|
this.setData({
|
|
- goBackHome: true
|
|
|
|
|
|
+ // title: option.title,
|
|
|
|
+ id,
|
|
|
|
+ myUid: this.uid,
|
|
|
|
+ stackSize
|
|
})
|
|
})
|
|
- }
|
|
|
|
- wx.setNavigationBarTitle({
|
|
|
|
- title: option.title //页面标题为路由参数
|
|
|
|
- })
|
|
|
|
- this.uid = wx.getStorageSync('uid');
|
|
|
|
- let stackSize = 1;
|
|
|
|
- if (option.stackSize) {
|
|
|
|
- stackSize = option.stackSize;
|
|
|
|
- }
|
|
|
|
- this.setData({
|
|
|
|
- title: option.title,
|
|
|
|
- id,
|
|
|
|
- myUid: this.uid,
|
|
|
|
- stackSize
|
|
|
|
- })
|
|
|
|
- this.getWorks(this.uid, id);
|
|
|
|
|
|
+ this.getWorks(this.uid, id);
|
|
|
|
+ }, (error) => {
|
|
|
|
+ this.setData({
|
|
|
|
+ hide: !this.data.hide,
|
|
|
|
+ onLoadOption: option
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
onHide: function () {
|
|
onHide: function () {
|
|
// this.data.stackSize >= 2
|
|
// this.data.stackSize >= 2
|
|
@@ -78,21 +91,24 @@ Page({
|
|
if (this.innerAudioContext) {
|
|
if (this.innerAudioContext) {
|
|
this.innerAudioContext.pause();
|
|
this.innerAudioContext.pause();
|
|
}
|
|
}
|
|
- let videoCtx = wx.createVideoContext('worksVideo', this);
|
|
|
|
- videoCtx.stop();
|
|
|
|
|
|
+ this.videoCtx = null
|
|
},
|
|
},
|
|
onUnload: function () {
|
|
onUnload: function () {
|
|
if (this.innerAudioContext) {
|
|
if (this.innerAudioContext) {
|
|
this.innerAudioContext.destroy();
|
|
this.innerAudioContext.destroy();
|
|
}
|
|
}
|
|
- let videoCtx = wx.createVideoContext('worksVideo', this);
|
|
|
|
- videoCtx.stop();
|
|
|
|
|
|
+ this.videoCtx = null
|
|
|
|
+ // let videoCtx = wx.createVideoContext('worksVideo', this);
|
|
|
|
+ // videoCtx.stop();
|
|
},
|
|
},
|
|
getWorks: function (uid, id) {
|
|
getWorks: function (uid, id) {
|
|
httpRequestApi.getWorksDetail(uid, id).success((res) => {
|
|
httpRequestApi.getWorksDetail(uid, id).success((res) => {
|
|
const others = res.data.data.otherRead;
|
|
const others = res.data.data.otherRead;
|
|
const author = res.data.data.user;
|
|
const author = res.data.data.user;
|
|
const works = res.data.data.userRead;
|
|
const works = res.data.data.userRead;
|
|
|
|
+ wx.setNavigationBarTitle({
|
|
|
|
+ title: works.title //页面标题为路由参数
|
|
|
|
+ })
|
|
const othersTemp = [];
|
|
const othersTemp = [];
|
|
others.forEach((item) => {
|
|
others.forEach((item) => {
|
|
const temp = {};
|
|
const temp = {};
|
|
@@ -115,13 +131,24 @@ Page({
|
|
classId: works.lessonId,
|
|
classId: works.lessonId,
|
|
isLike: res.data.data.isLike,
|
|
isLike: res.data.data.isLike,
|
|
isFans: res.data.data.isFans,
|
|
isFans: res.data.data.isFans,
|
|
|
|
+ title: works.title
|
|
})
|
|
})
|
|
|
|
+ httpRequestApi.checkLesson(works.lessonId).success(res => {
|
|
|
|
+ const productId = res.data.data[0];
|
|
|
|
+ this.setData({
|
|
|
|
+ productId
|
|
|
|
+ })
|
|
|
|
+ });
|
|
// 设置音频路径
|
|
// 设置音频路径
|
|
this.innerAudioContext = wx.createInnerAudioContext();
|
|
this.innerAudioContext = wx.createInnerAudioContext();
|
|
- this.innerAudioContext.onError((res) => {
|
|
|
|
|
|
+ this.innerAudioContext.onPause((res) => {
|
|
// 播放音频失败的回调
|
|
// 播放音频失败的回调
|
|
|
|
+ console.log('音频暂停')
|
|
})
|
|
})
|
|
this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
|
|
this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
});
|
|
});
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
@@ -166,30 +193,47 @@ Page({
|
|
},
|
|
},
|
|
// 弹出分享框
|
|
// 弹出分享框
|
|
openShare: function (e) {
|
|
openShare: function (e) {
|
|
- this.shareDialog = this.selectComponent("#share-dialog");
|
|
|
|
- const data = {
|
|
|
|
- avatar: this.data.authorAvatar,
|
|
|
|
- author: this.data.author,
|
|
|
|
- iconImg: this.data.iconImg,
|
|
|
|
- title: this.data.title,
|
|
|
|
- path: `pages/social/works/works`,
|
|
|
|
- scene: this.data.id
|
|
|
|
- // tip: this.data.tip,
|
|
|
|
|
|
+ console.log(this.data.authorAvatar)
|
|
|
|
+ console.log(this.data.author)
|
|
|
|
+ console.log(this.data.iconImg)
|
|
|
|
+ console.log(this.data.title)
|
|
|
|
+ console.log(this.data.id)
|
|
|
|
+ if (this.data.authorAvatar && this.data.author && this.data.iconImg && this.data.title && this.data.id) {
|
|
|
|
+ this.shareDialog = this.selectComponent("#share-dialog");
|
|
|
|
+ const data = {
|
|
|
|
+ avatar: this.data.authorAvatar,
|
|
|
|
+ author: this.data.author,
|
|
|
|
+ iconImg: this.data.iconImg,
|
|
|
|
+ title: this.data.title,
|
|
|
|
+ path: `pages/social/works/works`,
|
|
|
|
+ scene: this.data.id,
|
|
|
|
+ // tip: this.data.tip,
|
|
|
|
+ }
|
|
|
|
+ // console.log(data)
|
|
|
|
+ this.setData({
|
|
|
|
+ noScroll: 'noScroll'
|
|
|
|
+ })
|
|
|
|
+ this.shareDialog.share(data);
|
|
}
|
|
}
|
|
- this.shareDialog.share(data);
|
|
|
|
|
|
+ },
|
|
|
|
+ // 分享框关闭
|
|
|
|
+ shareDialogClose: function (e) {
|
|
|
|
+ this.setData({
|
|
|
|
+ noScroll: ''
|
|
|
|
+ })
|
|
},
|
|
},
|
|
videoPlay: function () {
|
|
videoPlay: function () {
|
|
// 视频开始 先结束 再开始
|
|
// 视频开始 先结束 再开始
|
|
|
|
+ // this.innerAudioContext.play();
|
|
|
|
+ // this.innerAudioContext.pause();
|
|
|
|
+ // wx.showToast({
|
|
|
|
+ // title: '加载中',
|
|
|
|
+ // icon: 'loading',
|
|
|
|
+ // duration: 600
|
|
|
|
+ // })
|
|
|
|
+ // setTimeout(() => {
|
|
this.innerAudioContext.play();
|
|
this.innerAudioContext.play();
|
|
- this.innerAudioContext.pause();
|
|
|
|
- wx.showToast({
|
|
|
|
- title: '加载中',
|
|
|
|
- icon: 'loading',
|
|
|
|
- duration: 600
|
|
|
|
- })
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.innerAudioContext.play();
|
|
|
|
- }, 800)
|
|
|
|
|
|
+ // }, 800)
|
|
httpRequestApi.playWorks(this.uid, this.data.id).success(() => {
|
|
httpRequestApi.playWorks(this.uid, this.data.id).success(() => {
|
|
console.log('容个错')
|
|
console.log('容个错')
|
|
});
|
|
});
|
|
@@ -199,67 +243,83 @@ Page({
|
|
this.innerAudioContext.stop();
|
|
this.innerAudioContext.stop();
|
|
},
|
|
},
|
|
videoPause: function () {
|
|
videoPause: function () {
|
|
|
|
+ console.log('视频暂停')
|
|
this.innerAudioContext.pause();
|
|
this.innerAudioContext.pause();
|
|
},
|
|
},
|
|
|
|
+ videoWaiting: function () {
|
|
|
|
+ console.log('视频缓冲')
|
|
|
|
+ this.innerAudioContext.pause();
|
|
|
|
+ },
|
|
|
|
+ videoProgress: function (e) {
|
|
|
|
+ console.log('视频加载进度变化')
|
|
|
|
+ console.log(e)
|
|
|
|
+ if (e.detail.buffered <= 10) {
|
|
|
|
+ this.innerAudioContext.pause();
|
|
|
|
+ } else {
|
|
|
|
+ this.innerAudioContext.play();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ videoTimeupdate: function (e) {
|
|
|
|
+ console.log('视频播放进度发生变化')
|
|
|
|
+ console.log('视频当前时长', e.detail.currentTime);
|
|
|
|
+ console.log('音频当前时长', this.innerAudioContext.currentTime)
|
|
|
|
+ if (e.detail.currentTime - this.innerAudioContext.currentTime >= 1) {
|
|
|
|
+ this.innerAudioContext.seek(e.detail.currentTime - 0.1);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
goToReading: function () {
|
|
goToReading: function () {
|
|
const classId = this.data.classId;
|
|
const classId = this.data.classId;
|
|
- httpRequestApi.checkLesson(classId).success(res => {
|
|
|
|
- const productId = res.data.data[0];
|
|
|
|
- this.setData({
|
|
|
|
- productId
|
|
|
|
- })
|
|
|
|
- httpRequestApi.areYouSuper(res.data.data).success(res => {
|
|
|
|
- if (res.data.success) {
|
|
|
|
- wx.navigateTo({
|
|
|
|
- url: `../../main/reading/reading?id=${classId}`
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- // ios用户 并且没有购买过此书
|
|
|
|
- // if (this.data.isIOS) {
|
|
|
|
- // wx.showModal({
|
|
|
|
- // title: '暂不支持',
|
|
|
|
- // content: '十分抱歉,由于相关规定,您暂时无法在这里朗读',
|
|
|
|
- // success(res) {
|
|
|
|
- // if (res.confirm) {
|
|
|
|
- // console.log('用户点击确定')
|
|
|
|
- // } else if (res.cancel) {
|
|
|
|
- // console.log('用户点击取消')
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- console.log('chulaiba')
|
|
|
|
- this.setData({
|
|
|
|
- isModalShow: true
|
|
|
|
- })
|
|
|
|
- // wx.showModal({
|
|
|
|
- // title: '您未购买过本书,不能朗读',
|
|
|
|
- // content: '超值团购进行中,快去看看',
|
|
|
|
- // success(res) {
|
|
|
|
- // if (res.confirm) {
|
|
|
|
- // console.log('用户点击确定')
|
|
|
|
- // wx.navigateTo({
|
|
|
|
- // url: `../../groupPage/grade-details/grade-details?productId=${productId}`
|
|
|
|
- // })
|
|
|
|
- // } else if (res.cancel) {
|
|
|
|
- // console.log('用户点击取消')
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ httpRequestApi.areYouSuper(this.data.productId).success(res => {
|
|
|
|
+ if (res.data.success) {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: `../../main/reading/reading?id=${classId}`
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ // ios用户 并且没有购买过此书
|
|
|
|
+ // if (this.data.isIOS) {
|
|
|
|
+ // wx.showModal({
|
|
|
|
+ // title: '暂不支持',
|
|
|
|
+ // content: '十分抱歉,由于相关规定,您暂时无法在这里朗读',
|
|
|
|
+ // success(res) {
|
|
|
|
+ // if (res.confirm) {
|
|
|
|
+ // console.log('用户点击确定')
|
|
|
|
+ // } else if (res.cancel) {
|
|
|
|
+ // console.log('用户点击取消')
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ console.log('chulaiba')
|
|
|
|
+ this.setData({
|
|
|
|
+ isModalShow: true
|
|
|
|
+ })
|
|
|
|
+ // wx.showModal({
|
|
|
|
+ // title: '您未购买过本书,不能朗读',
|
|
|
|
+ // content: '超值团购进行中,快去看看',
|
|
|
|
+ // success(res) {
|
|
|
|
+ // if (res.confirm) {
|
|
|
|
+ // console.log('用户点击确定')
|
|
|
|
+ // wx.navigateTo({
|
|
|
|
+ // url: `../../groupPage/grade-details/grade-details?productId=${productId}`
|
|
|
|
+ // })
|
|
|
|
+ // } else if (res.cancel) {
|
|
|
|
+ // console.log('用户点击取消')
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- onShareAppMessage: function (res) {
|
|
|
|
- if (res.from === 'button') {
|
|
|
|
- // 来自页面内转发按钮
|
|
|
|
- console.log(res.target)
|
|
|
|
- }
|
|
|
|
|
|
+ onShareAppMessage: function () {
|
|
|
|
+ console.log(this.data.productId);
|
|
|
|
+
|
|
return {
|
|
return {
|
|
title: '一样的课文,不一样的味道!我的配音表演已开始,求各位大咖围观、点评!',
|
|
title: '一样的课文,不一样的味道!我的配音表演已开始,求各位大咖围观、点评!',
|
|
path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
|
|
path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
|
|
- imageUrl: '../../../static/share/works_icon.jpg'
|
|
|
|
|
|
+ imageUrl: `https://efunbox.lingjiao.cn/reader/resource/share/read_${this.data.productId}.jpg`
|
|
}
|
|
}
|
|
},
|
|
},
|
|
follow: function () {
|
|
follow: function () {
|
|
@@ -343,7 +403,8 @@ Page({
|
|
temp.avatar = item.user.avatar;
|
|
temp.avatar = item.user.avatar;
|
|
temp.profession = item.user.profession;
|
|
temp.profession = item.user.profession;
|
|
temp.uid = item.user.uid;
|
|
temp.uid = item.user.uid;
|
|
- temp.text = decodeURI(item.detailDesc);
|
|
|
|
|
|
+ // temp.text = decodeURI(item.detailDesc);
|
|
|
|
+ temp.text = item.detailDesc;
|
|
temp.id = item.id;
|
|
temp.id = item.id;
|
|
temp.replyCount = item.replyCount;
|
|
temp.replyCount = item.replyCount;
|
|
temp.time = formatDate(item.gmtCreated, 3);
|
|
temp.time = formatDate(item.gmtCreated, 3);
|
|
@@ -379,7 +440,8 @@ Page({
|
|
let data = {
|
|
let data = {
|
|
"columnId": this.data.id,
|
|
"columnId": this.data.id,
|
|
colunmNames: 'what',
|
|
colunmNames: 'what',
|
|
- "detailDesc": encodeURI(this.data.inputValue)
|
|
|
|
|
|
+ // "detailDesc": encodeURI(this.data.inputValue)
|
|
|
|
+ "detailDesc": this.data.inputValue
|
|
}
|
|
}
|
|
httpRequestApi.postReply(this.uid, data).success(res => {
|
|
httpRequestApi.postReply(this.uid, data).success(res => {
|
|
this.setData({
|
|
this.setData({
|
|
@@ -488,6 +550,12 @@ Page({
|
|
},
|
|
},
|
|
//支付
|
|
//支付
|
|
payMoney: function (orderInfo) {
|
|
payMoney: function (orderInfo) {
|
|
|
|
+ if (this.data.haveTapMoney) {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ this.setData({
|
|
|
|
+ haveTapMoney: true
|
|
|
|
+ })
|
|
wx.requestPayment({
|
|
wx.requestPayment({
|
|
'appId': orderInfo.appId,
|
|
'appId': orderInfo.appId,
|
|
'timeStamp': orderInfo.timeStamp,
|
|
'timeStamp': orderInfo.timeStamp,
|
|
@@ -500,7 +568,9 @@ Page({
|
|
modalType: 'image',
|
|
modalType: 'image',
|
|
isModalShow: true,
|
|
isModalShow: true,
|
|
modalCloseShow: false,
|
|
modalCloseShow: false,
|
|
- modalBtnText: '确定'
|
|
|
|
|
|
+ modalBtnText: '确定',
|
|
|
|
+ haveTapMoney: false,
|
|
|
|
+ ifReward: false
|
|
})
|
|
})
|
|
// wx.showModal({
|
|
// wx.showModal({
|
|
// title: '提示',
|
|
// title: '提示',
|
|
@@ -519,9 +589,9 @@ Page({
|
|
// })
|
|
// })
|
|
|
|
|
|
},
|
|
},
|
|
- 'fail': function (res) {
|
|
|
|
|
|
+ 'fail': res => {
|
|
this.setData({
|
|
this.setData({
|
|
- ifReward: false
|
|
|
|
|
|
+ haveTapMoney: false,
|
|
})
|
|
})
|
|
console.log('支付失败', res)
|
|
console.log('支付失败', res)
|
|
}
|
|
}
|
|
@@ -534,14 +604,15 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
modalConfirmHandler: function () {
|
|
modalConfirmHandler: function () {
|
|
-
|
|
|
|
|
|
+
|
|
if (this.data.modalType === 'image') {
|
|
if (this.data.modalType === 'image') {
|
|
this.setData({
|
|
this.setData({
|
|
modalType: 'text',
|
|
modalType: 'text',
|
|
isModalShow: false,
|
|
isModalShow: false,
|
|
ifReward: false,
|
|
ifReward: false,
|
|
modalCloseShow: true,
|
|
modalCloseShow: true,
|
|
- modalBtnText: "去开团"
|
|
|
|
|
|
+ modalBtnText: "去开团",
|
|
|
|
+ // ifReward: false
|
|
})
|
|
})
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
@@ -557,4 +628,12 @@ Page({
|
|
isModalShow: false
|
|
isModalShow: false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ jurisdiction: function () {
|
|
|
|
+ //隐藏弹框
|
|
|
|
+ this.setData({
|
|
|
|
+ hide: !this.data.hide
|
|
|
|
+ })
|
|
|
|
+ //登录页信息
|
|
|
|
+ this.onLoad(this.data.onLoadOption);
|
|
|
|
+ },
|
|
})
|
|
})
|