|
@@ -1,63 +1,19 @@
|
|
|
import httpRequestApi from '../../../utils/APIClient';
|
|
|
+import {formatDate} from '../../../utils/util';
|
|
|
Page({
|
|
|
data: {
|
|
|
fullScreenBtn: false,
|
|
|
playBtn: false,
|
|
|
gesture: true,
|
|
|
- user: [{
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- },
|
|
|
- {
|
|
|
- nickName: '萝莉小猫咪',
|
|
|
- image: '../../../static/image/timg.jpg',
|
|
|
- }
|
|
|
- ],
|
|
|
+ author: '',
|
|
|
+ videoSrc: '',
|
|
|
+ total: '',
|
|
|
+ authorAvatar: '',
|
|
|
+ user: [],
|
|
|
inputValue: 'smdx',
|
|
|
- text: '总有一天我将实质性操作死去而你我的\xa0\xa0\xa0\xa0\xa0\xa0\xa0儿子自行车在啊实打实大苏打撒旦将加冕为王'
|
|
|
+ replyList: [],
|
|
|
},
|
|
|
onLoad: function (option) {
|
|
|
- console.log(option)
|
|
|
if (option.title) {
|
|
|
wx.setNavigationBarTitle({
|
|
|
title: option.title //页面标题为路由参数
|
|
@@ -67,12 +23,46 @@ Page({
|
|
|
id: option.id
|
|
|
})
|
|
|
}
|
|
|
- let uid = 1;
|
|
|
- httpRequestApi.getWorksDetail(uid, option.id).success((res) => {
|
|
|
- console.log(res);
|
|
|
+ let uid = wx.getStorageSync('uid');
|
|
|
+ this.getWorks(uid, option.id);
|
|
|
+ },
|
|
|
+ getWorks: function (uid, id) {
|
|
|
+ httpRequestApi.getWorksDetail(uid, id).success((res) => {
|
|
|
+ const others = res.data.data.otherRead;
|
|
|
+ const author = res.data.data.user;
|
|
|
+ const works = res.data.data.userRead;
|
|
|
+ const othersTemp = [];
|
|
|
+ others.forEach((item) => {
|
|
|
+ const temp = {};
|
|
|
+ temp.image = item.user.avatar;
|
|
|
+ temp.nickName = item.user.wechatName;
|
|
|
+ othersTemp.push(temp);
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ user: othersTemp,
|
|
|
+ author: author.wechatName,
|
|
|
+ authorAvatar: author.avatar,
|
|
|
+ videoSrc: works.originVideo,
|
|
|
+ audioSrc: works.audioPath
|
|
|
+ })
|
|
|
+ // 设置音频路径
|
|
|
+ this.innerAudioContext = wx.createInnerAudioContext();
|
|
|
+ this.innerAudioContext.onError((res) => {
|
|
|
+ // 播放音频失败的回调
|
|
|
+ })
|
|
|
+ this.innerAudioContext.src = this.data.audioSrc; // 这里可以是录音的临时路径
|
|
|
this.getReply();
|
|
|
});
|
|
|
},
|
|
|
+ videoPlay: function () {
|
|
|
+ this.innerAudioContext.play();
|
|
|
+ },
|
|
|
+ videoEnd: function () {
|
|
|
+ this.innerAudioContext.stop();
|
|
|
+ },
|
|
|
+ videoPause: function () {
|
|
|
+ this.innerAudioContext.pause();
|
|
|
+ },
|
|
|
goToReading: function () {
|
|
|
let id = this.data.id;
|
|
|
let title = this.data.title;
|
|
@@ -91,7 +81,7 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
follow: function () {
|
|
|
- let uid = 1;
|
|
|
+ let uid = wx.getStorageSync('uid');
|
|
|
let followUid = 2;
|
|
|
httpRequestApi.followUser(uid, followUid).success((res) => {
|
|
|
console.log(res)
|
|
@@ -105,21 +95,38 @@ Page({
|
|
|
},
|
|
|
// 查询回复
|
|
|
getReply: function () {
|
|
|
- let uid = 1;
|
|
|
- let columnId = 1001;
|
|
|
+ let uid = wx.getStorageSync('uid');
|
|
|
+ let columnId = this.data.id;
|
|
|
let pageNo = 1;
|
|
|
let pageSize = 10;
|
|
|
httpRequestApi.getReply(uid, columnId, pageNo, pageSize).success((res) => {
|
|
|
- console.log(res);
|
|
|
+ console.log(res.data.data.list);
|
|
|
+ const replyList = res.data.data.list;
|
|
|
+ const replyTemp = [];
|
|
|
+ replyList.forEach((item)=>{
|
|
|
+ const temp = {};
|
|
|
+ temp.nickName = item.user.wechatName;
|
|
|
+ temp.avatar = item.user.avatar;
|
|
|
+ temp.text = item.detailDesc;
|
|
|
+ temp.id = item.id;
|
|
|
+ temp.replyCount=item.replyCount;
|
|
|
+ temp.time = formatDate(item.gmtCreated,3);
|
|
|
+ console.log(temp.time)
|
|
|
+ replyTemp.push(temp);
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ replyList: replyTemp,
|
|
|
+ total: res.data.data.totalSize
|
|
|
+ })
|
|
|
});
|
|
|
},
|
|
|
// 打开回复详情页
|
|
|
goToDetail: function (e) {
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
- let num = e.currentTarget.dataset.num;
|
|
|
+ let count = e.currentTarget.dataset.count;
|
|
|
console.log(e);
|
|
|
wx.navigateTo({
|
|
|
- url: `../../social/replyDetail/replyDetail?id=${id}&num=${num}`
|
|
|
+ url: `../../social/replyDetail/replyDetail?id=${id}&count=${count}`
|
|
|
})
|
|
|
},
|
|
|
// 绑定输入框内容
|
|
@@ -132,18 +139,10 @@ Page({
|
|
|
sendHandler: function () {
|
|
|
console.log(this.data.inputValue);
|
|
|
if (this.data.inputValue !== '') {
|
|
|
- // let uid = 1;
|
|
|
- // let data = {
|
|
|
- // "postId": 1,
|
|
|
- // "content": this.data.inputValue
|
|
|
- // }
|
|
|
- // httpRequestApi.postReplyComment(uid, data).success(res => {
|
|
|
- // console.log(res);
|
|
|
- // });
|
|
|
- let uid = 1;
|
|
|
+ let uid = wx.getStorageSync('uid');
|
|
|
let data = {
|
|
|
- "columnId": '1541403885738293',
|
|
|
- colunmNames: '金色巴掌',
|
|
|
+ "columnId": this.data.id,
|
|
|
+ colunmNames: 'what',
|
|
|
"detailDesc": this.data.inputValue
|
|
|
}
|
|
|
httpRequestApi.postReply(uid, data).success(res => {
|