|
|
@ -20,16 +20,17 @@ Page({ |
|
|
|
position:String, |
|
|
|
detail: String, |
|
|
|
imgArr:[], |
|
|
|
comments:[], |
|
|
|
unStar: '/images/common/star.png', |
|
|
|
star: '/images/common/star_light.png', |
|
|
|
isStar:false, |
|
|
|
topicId:String, |
|
|
|
collectionId:String, |
|
|
|
isCollect:Number, |
|
|
|
currPage: 1, |
|
|
|
commentList: [], |
|
|
|
unPraise: '/images/common/zan.png', |
|
|
|
praise: '/images/common/star_light.png' |
|
|
|
praise: '/images/common/zan.png', |
|
|
|
hiddenmodalput:true, |
|
|
|
currentComment:'', |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -60,6 +61,7 @@ Page({ |
|
|
|
let data = res.result |
|
|
|
this.setData({ |
|
|
|
topicId: data.id, |
|
|
|
collectionId: data.collectionId, |
|
|
|
isCollect: data.isCollect, |
|
|
|
title:data.title, |
|
|
|
time: data.createTime, |
|
|
@ -82,9 +84,8 @@ Page({ |
|
|
|
let tempDatas = [] |
|
|
|
datas.forEach(item => { |
|
|
|
tempDatas.push({ |
|
|
|
isPraise: false, |
|
|
|
id:item.id, |
|
|
|
userIcon: item.commentAvator, |
|
|
|
commentAvator: item.commentAvator, |
|
|
|
userName: item.username, |
|
|
|
detail: item.comment, |
|
|
|
time: item.createTime, |
|
|
@ -112,6 +113,7 @@ Page({ |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this.data.commentList) |
|
|
|
wx.stopPullDownRefresh() |
|
|
|
}) |
|
|
|
}, |
|
|
@ -130,8 +132,8 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
fetchTopicUnCollect(){ |
|
|
|
let topicId = this.data.topicId |
|
|
|
topicModel.topicUnCollect(topicId, res => { |
|
|
|
let collectionId = this.data.collectionId |
|
|
|
topicModel.topicUnCollect(collectionId, res => { |
|
|
|
console.log('取消收藏') |
|
|
|
if (res.code === 200) { |
|
|
|
this.fetchDetail() |
|
|
@ -170,19 +172,18 @@ Page({ |
|
|
|
const tempList = [] |
|
|
|
commentList.forEach( (item,index)=>{ |
|
|
|
if (sIndex === index){ |
|
|
|
item.isPraise = !item.isPraise |
|
|
|
this.fetchTopicCommentPraise(selectItem.id) |
|
|
|
} |
|
|
|
tempList.push(item) |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
commentList:tempList, |
|
|
|
// tempList.push(item)
|
|
|
|
}) |
|
|
|
this.fetchTopicCommentPraise(selectItem.id) |
|
|
|
// this.setData({
|
|
|
|
// commentList:tempList,
|
|
|
|
// })
|
|
|
|
// this.fetchTopicCommentPraise(selectItem.id)
|
|
|
|
// 评论点赞
|
|
|
|
}, |
|
|
|
onTapComment(){ |
|
|
|
|
|
|
|
}, |
|
|
|
// 点击查看图片
|
|
|
|
previewImg: function (e) { |
|
|
|
console.log(e.currentTarget.dataset.index); |
|
|
|
var index = e.currentTarget.dataset.index; |
|
|
@ -194,5 +195,47 @@ Page({ |
|
|
|
fail: function (res) { }, |
|
|
|
complete: function (res) { }, |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 点击评论
|
|
|
|
onTapComment(){ |
|
|
|
this.setData({ |
|
|
|
hiddenmodalput: !this.data.hiddenmodalput |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 弹出框 取消
|
|
|
|
cancel: function () { |
|
|
|
this.setData({ |
|
|
|
hiddenmodalput: true, |
|
|
|
currentComment: '' |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 弹出框 确认
|
|
|
|
confirm: function () { |
|
|
|
|
|
|
|
if (!this.data.currentComment){ |
|
|
|
wx.showToast({ |
|
|
|
title: '请输入评论', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
topicModel.topicAddComment(this.data.currentComment, this.data.topicId,res=>{ |
|
|
|
if(res.code === 200){ |
|
|
|
this.setData({ |
|
|
|
hiddenmodalput: true, |
|
|
|
currentComment: '' |
|
|
|
}) |
|
|
|
this.fetchDetailComment() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 评论输入框
|
|
|
|
bingTextAreaInput(e){ |
|
|
|
console.log(e.detail.value) |
|
|
|
this.setData({ |
|
|
|
currentComment: e.detail.value |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |