|
@@ -6,7 +6,7 @@ const app = getApp()
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
fullScreenBtn: false,
|
|
fullScreenBtn: false,
|
|
- playBtn: false,
|
|
|
|
|
|
+ playBtn: true,
|
|
gesture: true,
|
|
gesture: true,
|
|
author: '',
|
|
author: '',
|
|
videoSrc: '',
|
|
videoSrc: '',
|
|
@@ -31,9 +31,8 @@ Page({
|
|
// shareFlag: false
|
|
// shareFlag: false
|
|
},
|
|
},
|
|
onLoad: function (option) {
|
|
onLoad: function (option) {
|
|
- console.log(option)
|
|
|
|
let id = option.id ? option.id : option.scene.replace('QR', '')
|
|
let id = option.id ? option.id : option.scene.replace('QR', '')
|
|
- if(option.scene || option.shareCard ){
|
|
|
|
|
|
+ if (option.scene || option.shareCard) {
|
|
this.setData({
|
|
this.setData({
|
|
goBackHome: true
|
|
goBackHome: true
|
|
})
|
|
})
|
|
@@ -42,31 +41,37 @@ Page({
|
|
title: option.title //页面标题为路由参数
|
|
title: option.title //页面标题为路由参数
|
|
})
|
|
})
|
|
this.uid = wx.getStorageSync('uid');
|
|
this.uid = wx.getStorageSync('uid');
|
|
|
|
+ let stackSize = 1;
|
|
|
|
+ console.log(option.stackSize)
|
|
|
|
+ if (option.stackSize) {
|
|
|
|
+ stackSize = option.stackSize;
|
|
|
|
+ }
|
|
this.setData({
|
|
this.setData({
|
|
title: option.title,
|
|
title: option.title,
|
|
id,
|
|
id,
|
|
- myUid: this.uid
|
|
|
|
|
|
+ myUid: this.uid,
|
|
|
|
+ stackSize
|
|
})
|
|
})
|
|
this.getWorks(this.uid, id);
|
|
this.getWorks(this.uid, id);
|
|
},
|
|
},
|
|
onHide: function () {
|
|
onHide: function () {
|
|
|
|
+ // this.data.stackSize >= 2
|
|
|
|
+ console.log(this.data.stackSize)
|
|
if (this.innerAudioContext) {
|
|
if (this.innerAudioContext) {
|
|
this.innerAudioContext.stop();
|
|
this.innerAudioContext.stop();
|
|
}
|
|
}
|
|
- let videoCtx = wx.createVideoContext('worksVideo',this);
|
|
|
|
|
|
+ let videoCtx = wx.createVideoContext('worksVideo', this);
|
|
videoCtx.stop();
|
|
videoCtx.stop();
|
|
},
|
|
},
|
|
onUnload: function () {
|
|
onUnload: function () {
|
|
if (this.innerAudioContext) {
|
|
if (this.innerAudioContext) {
|
|
this.innerAudioContext.stop();
|
|
this.innerAudioContext.stop();
|
|
}
|
|
}
|
|
- let videoCtx = wx.createVideoContext('worksVideo',this);
|
|
|
|
|
|
+ let videoCtx = wx.createVideoContext('worksVideo', this);
|
|
videoCtx.stop();
|
|
videoCtx.stop();
|
|
},
|
|
},
|
|
getWorks: function (uid, id) {
|
|
getWorks: function (uid, id) {
|
|
httpRequestApi.getWorksDetail(uid, id).success((res) => {
|
|
httpRequestApi.getWorksDetail(uid, id).success((res) => {
|
|
- console.log(res);
|
|
|
|
- console.log(id);
|
|
|
|
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;
|
|
@@ -84,6 +89,7 @@ Page({
|
|
totalRead: res.data.data.totalRead,
|
|
totalRead: res.data.data.totalRead,
|
|
author: author.wechatName,
|
|
author: author.wechatName,
|
|
authorAvatar: author.avatar,
|
|
authorAvatar: author.avatar,
|
|
|
|
+ authorProfession: author.profession,
|
|
authorUid: author.uid,
|
|
authorUid: author.uid,
|
|
videoSrc: works.originVideo,
|
|
videoSrc: works.originVideo,
|
|
audioSrc: works.audioPath,
|
|
audioSrc: works.audioPath,
|
|
@@ -100,8 +106,8 @@ Page({
|
|
this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
|
|
this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- onShow(options) {
|
|
|
|
- console.log(options)
|
|
|
|
|
|
+ onShow() {
|
|
|
|
+ console.log(this.data.stackSize)
|
|
this.setData({
|
|
this.setData({
|
|
replyList: [],
|
|
replyList: [],
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
@@ -148,9 +154,7 @@ Page({
|
|
},
|
|
},
|
|
videoPlay: function () {
|
|
videoPlay: function () {
|
|
this.innerAudioContext.play();
|
|
this.innerAudioContext.play();
|
|
- httpRequestApi.playWorks(this.uid, this.data.id).success(res => {
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
|
|
+ httpRequestApi.playWorks(this.uid, this.data.id);
|
|
},
|
|
},
|
|
videoEnd: function () {
|
|
videoEnd: function () {
|
|
this.innerAudioContext.stop();
|
|
this.innerAudioContext.stop();
|
|
@@ -169,20 +173,20 @@ Page({
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
// ios用户 并且没有购买过此书
|
|
// ios用户 并且没有购买过此书
|
|
- if(this.data.isIOS){
|
|
|
|
- wx.showModal({
|
|
|
|
- title: '暂不支持',
|
|
|
|
- content: '十分抱歉,由于相关规定,您暂时无法在这里朗读',
|
|
|
|
- success(res) {
|
|
|
|
- if (res.confirm) {
|
|
|
|
- console.log('用户点击确定')
|
|
|
|
- } else if (res.cancel) {
|
|
|
|
- console.log('用户点击取消')
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.data.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: '超值团购进行中,快去看看',
|
|
@@ -237,8 +241,6 @@ Page({
|
|
})
|
|
})
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
},
|
|
},
|
|
// 点赞评论
|
|
// 点赞评论
|
|
likeCommend: function (e) {
|
|
likeCommend: function (e) {
|
|
@@ -254,11 +256,30 @@ Page({
|
|
})
|
|
})
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ // 去用户主页
|
|
|
|
+ goToUsers: function (e) {
|
|
|
|
+ let uid = e.currentTarget.dataset.uid;
|
|
|
|
+ console.log(uid);
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: `../../user/myworks/myworks?uid=${uid}`
|
|
|
|
+ });
|
|
|
|
+ },
|
|
// 去其他用户的作品页
|
|
// 去其他用户的作品页
|
|
goToOthers: function (e) {
|
|
goToOthers: function (e) {
|
|
- wx.navigateTo({
|
|
|
|
- url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}`
|
|
|
|
- })
|
|
|
|
|
|
+ this.data.stackSize++;
|
|
|
|
+ console.log(this.data.stackSize)
|
|
|
|
+ if (this.data.stackSize >= 3) {
|
|
|
|
+ console.log('跳转',this.data.stackSize)
|
|
|
|
+ wx.redirectTo({
|
|
|
|
+ url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}&stackSize=${this.data.stackSize}`
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ console.log('下一个页面',this.data.stackSize)
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: `../../social/works/works?id=${e.currentTarget.dataset.uid}&title=${e.currentTarget.dataset.title}&stackSize=${this.data.stackSize}`
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
},
|
|
},
|
|
// 查询回复
|
|
// 查询回复
|
|
getReply: function () {
|
|
getReply: function () {
|
|
@@ -267,19 +288,19 @@ Page({
|
|
let pageNo = this.data.pageNo;
|
|
let pageNo = this.data.pageNo;
|
|
let pageSize = this.data.pageSize;
|
|
let pageSize = this.data.pageSize;
|
|
httpRequestApi.getReply(this.uid, columnId, pageNo, pageSize).success((res) => {
|
|
httpRequestApi.getReply(this.uid, columnId, pageNo, pageSize).success((res) => {
|
|
- console.log(res.data.data.list);
|
|
|
|
const replyList = res.data.data.list;
|
|
const replyList = res.data.data.list;
|
|
// const replyTemp = [];
|
|
// const replyTemp = [];
|
|
replyList.forEach((item) => {
|
|
replyList.forEach((item) => {
|
|
const temp = {};
|
|
const temp = {};
|
|
temp.nickName = item.user.wechatName;
|
|
temp.nickName = item.user.wechatName;
|
|
temp.avatar = item.user.avatar;
|
|
temp.avatar = item.user.avatar;
|
|
|
|
+ temp.profession = item.user.profession;
|
|
|
|
+ temp.uid = item.user.uid;
|
|
temp.text = 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.gmtModified, 3);
|
|
temp.time = formatDate(item.gmtModified, 3);
|
|
temp.likes = item.postsAttributeInfo.favors || 0;
|
|
temp.likes = item.postsAttributeInfo.favors || 0;
|
|
- console.log(temp.time)
|
|
|
|
this.data.replyList.push(temp);
|
|
this.data.replyList.push(temp);
|
|
});
|
|
});
|
|
this.setData({
|
|
this.setData({
|
|
@@ -293,7 +314,6 @@ Page({
|
|
goToDetail: function (e) {
|
|
goToDetail: function (e) {
|
|
let id = e.currentTarget.dataset.id;
|
|
let id = e.currentTarget.dataset.id;
|
|
let count = e.currentTarget.dataset.count;
|
|
let count = e.currentTarget.dataset.count;
|
|
- console.log(e);
|
|
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
url: `../../social/replyDetail/replyDetail?id=${id}&count=${count}`
|
|
url: `../../social/replyDetail/replyDetail?id=${id}&count=${count}`
|
|
})
|
|
})
|
|
@@ -306,7 +326,6 @@ Page({
|
|
},
|
|
},
|
|
// 发布回复
|
|
// 发布回复
|
|
sendHandler: function () {
|
|
sendHandler: function () {
|
|
- console.log(this.data.inputValue);
|
|
|
|
if (this.data.inputValue !== '') {
|
|
if (this.data.inputValue !== '') {
|
|
// let uid = wx.getStorageSync('uid');
|
|
// let uid = wx.getStorageSync('uid');
|
|
let data = {
|
|
let data = {
|
|
@@ -315,11 +334,10 @@ Page({
|
|
"detailDesc": this.data.inputValue
|
|
"detailDesc": this.data.inputValue
|
|
}
|
|
}
|
|
httpRequestApi.postReply(this.uid, data).success(res => {
|
|
httpRequestApi.postReply(this.uid, data).success(res => {
|
|
- console.log(res);
|
|
|
|
this.setData({
|
|
this.setData({
|
|
inputValue: '',
|
|
inputValue: '',
|
|
- pageNo: 1,
|
|
|
|
- replyList: [],
|
|
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ replyList: [],
|
|
})
|
|
})
|
|
this.getReply();
|
|
this.getReply();
|
|
});
|
|
});
|
|
@@ -342,7 +360,6 @@ Page({
|
|
},
|
|
},
|
|
// 设置点击时的id
|
|
// 设置点击时的id
|
|
setSBId: function (e) {
|
|
setSBId: function (e) {
|
|
- console.log(e)
|
|
|
|
this.setData({
|
|
this.setData({
|
|
replySBId: e.currentTarget.dataset.id,
|
|
replySBId: e.currentTarget.dataset.id,
|
|
replyModal: true,
|
|
replyModal: true,
|
|
@@ -356,7 +373,6 @@ Page({
|
|
content: this.data.inputSBValue
|
|
content: this.data.inputSBValue
|
|
}
|
|
}
|
|
httpRequestApi.postReplyComment(this.uid, data).success(res => {
|
|
httpRequestApi.postReplyComment(this.uid, data).success(res => {
|
|
- console.log(res)
|
|
|
|
const replyWho = this.data.replyList[this.data.replyIndex];
|
|
const replyWho = this.data.replyList[this.data.replyIndex];
|
|
const indexStr = `replyList[${this.data.replyIndex}]`;
|
|
const indexStr = `replyList[${this.data.replyIndex}]`;
|
|
replyWho.replyCount++;
|
|
replyWho.replyCount++;
|
|
@@ -398,14 +414,12 @@ Page({
|
|
},
|
|
},
|
|
// 奖励
|
|
// 奖励
|
|
rewardMoney: function () {
|
|
rewardMoney: function () {
|
|
- console.log(this.data.authorUid);
|
|
|
|
const data = {
|
|
const data = {
|
|
targetUid: this.data.authorUid,
|
|
targetUid: this.data.authorUid,
|
|
amount: this.data.howMuch
|
|
amount: this.data.howMuch
|
|
}
|
|
}
|
|
// let uid = wx.getStorageSync('uid');
|
|
// let uid = wx.getStorageSync('uid');
|
|
httpRequestApi.rewardMoney(this.uid, data).success(res => {
|
|
httpRequestApi.rewardMoney(this.uid, data).success(res => {
|
|
- console.log(res);
|
|
|
|
this.payMoneyt(res.data.data);
|
|
this.payMoneyt(res.data.data);
|
|
})
|
|
})
|
|
|
|
|
|
@@ -420,7 +434,6 @@ Page({
|
|
'signType': orderInfo.signType,
|
|
'signType': orderInfo.signType,
|
|
'paySign': orderInfo.sign,
|
|
'paySign': orderInfo.sign,
|
|
'success': function (res) {
|
|
'success': function (res) {
|
|
- console.log(res)
|
|
|
|
wx.showModal({
|
|
wx.showModal({
|
|
title: '提示',
|
|
title: '提示',
|
|
content: '支付成功',
|
|
content: '支付成功',
|
|
@@ -447,7 +460,7 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 回到首页
|
|
// 回到首页
|
|
- goBackHome: function(){
|
|
|
|
|
|
+ goBackHome: function () {
|
|
wx.redirectTo({
|
|
wx.redirectTo({
|
|
url: '../../index/index'
|
|
url: '../../index/index'
|
|
})
|
|
})
|