123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import httpRequestApi from '../../../utils/APIClient';
- import {formatDate} from '../../../utils/util';
- Page({
- data: {
- class1: 'commentItem commentItemFirst',
- classNormal: 'commentItem',
- postId: '',
- comment:[]
-
- },
- onLoad: function (option) {
- console.log(option)
- this.setData({
- postId: option.id
- })
- wx.setNavigationBarTitle({
- title: option.count + '条回复'//页面标题为路由参数
- })
- this.getReplyDetail();
- },
- // 查询回复详情
- getReplyDetail: function () {
- let uid = wx.getStorageSync('uid');
- httpRequestApi.getReplyComment(uid, this.data.postId).success((res) => {
- console.log(res);
- const replyList = res.data.data.replyVOList;
- const replied = res.data.data;
- const replyTemp = [];
- const authorDetail = {};
- authorDetail.name = replied.user.wechatName;
- authorDetail.text = replied.detailDesc;
- authorDetail.time = formatDate(replied.gmtCreated,3);
- authorDetail.likes = replied.postsAttributeInfo.favors;
- authorDetail.avatar = replied.user.avatar;
- replyTemp.push(authorDetail);
- replyList.forEach(item => {
- const temp = {};
- temp.name = item.user.wechatName;
- temp.text = item.content;
- temp.time = formatDate(item.gmtCreated,3);
- temp.likes = 0;
- temp.avatar = item.user.avatar;
- replyTemp.push(temp);
- console.log(replyTemp);
- });
- this.setData({
- comment: replyTemp
- })
- });
- }
- })
|