|
@@ -1,12 +1,14 @@
|
|
|
import httpRequestApi from '../../../utils/APIClient';
|
|
|
-import {formatDate} from '../../../utils/util';
|
|
|
+import {
|
|
|
+ formatDate
|
|
|
+} from '../../../utils/util';
|
|
|
Page({
|
|
|
data: {
|
|
|
class1: 'commentItem commentItemFirst',
|
|
|
classNormal: 'commentItem',
|
|
|
postId: '',
|
|
|
- comment:[]
|
|
|
-
|
|
|
+ comment: []
|
|
|
+
|
|
|
},
|
|
|
onLoad: function (option) {
|
|
|
console.log(option)
|
|
@@ -14,14 +16,16 @@ Page({
|
|
|
postId: option.id
|
|
|
})
|
|
|
wx.setNavigationBarTitle({
|
|
|
- title: option.count + '条回复'//页面标题为路由参数
|
|
|
+ title: option.count + '条回复' //页面标题为路由参数
|
|
|
})
|
|
|
+ this.uid = wx.getStorageSync('uid');
|
|
|
this.getReplyDetail();
|
|
|
},
|
|
|
// 查询回复详情
|
|
|
getReplyDetail: function () {
|
|
|
- let uid = wx.getStorageSync('uid');
|
|
|
- httpRequestApi.getReplyComment(uid, this.data.postId).success((res) => {
|
|
|
+ // let uid = wx.getStorageSync('uid');
|
|
|
+ httpRequestApi.getReplyComment(this.uid, this.data.postId).success((res) => {
|
|
|
+ debugger;
|
|
|
console.log(res);
|
|
|
const replyList = res.data.data.replyVOList;
|
|
|
const replied = res.data.data;
|
|
@@ -29,7 +33,7 @@ Page({
|
|
|
const authorDetail = {};
|
|
|
authorDetail.name = replied.user.wechatName;
|
|
|
authorDetail.text = replied.detailDesc;
|
|
|
- authorDetail.time = formatDate(replied.gmtCreated,3);
|
|
|
+ authorDetail.time = formatDate(replied.gmtCreated, 3);
|
|
|
authorDetail.likes = replied.postsAttributeInfo.favors;
|
|
|
authorDetail.avatar = replied.user.avatar;
|
|
|
replyTemp.push(authorDetail);
|
|
@@ -37,7 +41,7 @@ Page({
|
|
|
const temp = {};
|
|
|
temp.name = item.user.wechatName;
|
|
|
temp.text = item.content;
|
|
|
- temp.time = formatDate(item.gmtCreated,3);
|
|
|
+ temp.time = formatDate(item.gmtCreated, 3);
|
|
|
temp.likes = 0;
|
|
|
temp.id = item.postId;
|
|
|
temp.avatar = item.user.avatar;
|
|
@@ -49,13 +53,13 @@ Page({
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
- // 点赞评论
|
|
|
- likeCommend: function (e) {
|
|
|
+ // 点赞评论
|
|
|
+ likeCommend: function (e) {
|
|
|
console.log(e);
|
|
|
- let uid = wx.getStorageSync('uid');
|
|
|
+ // let uid = wx.getStorageSync('uid');
|
|
|
let followUid = e.currentTarget.dataset.id;
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
- httpRequestApi.likeCommend(uid, followUid).success(res => {
|
|
|
+ httpRequestApi.likeCommend(this.uid, followUid).success(res => {
|
|
|
console.log(res);
|
|
|
const str = `comment[${index}].likes`;
|
|
|
this.setData({
|
|
@@ -63,4 +67,30 @@ Page({
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
+ // 设置点击时的id
|
|
|
+ setSBId: function (e) {
|
|
|
+ console.log(e)
|
|
|
+ this.setData({
|
|
|
+ // replySBId: e.currentTarget.dataset.id,
|
|
|
+ replyModal: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 回复某个评论
|
|
|
+ replySB: function () {
|
|
|
+ const data = {
|
|
|
+ postsId: this.data.postId,
|
|
|
+ content: this.data.inputSBValue
|
|
|
+ }
|
|
|
+ httpRequestApi.postReplyComment(this.uid, data).success(res => {
|
|
|
+ this.setData({
|
|
|
+ replyModal: false
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取回复楼中楼的内容
|
|
|
+ inputSBValue: function (e) {
|
|
|
+ this.setData({
|
|
|
+ inputSBValue: e.detail.value
|
|
|
+ });
|
|
|
+ },
|
|
|
})
|