|
@@ -30,6 +30,7 @@ Component({
|
|
|
list: [],
|
|
|
count: {},
|
|
|
detailDesc: '',
|
|
|
+ onceId: '',
|
|
|
postId: '',
|
|
|
postIndex: '',
|
|
|
ifGetFocus: false,
|
|
@@ -50,6 +51,7 @@ Component({
|
|
|
animationData: animation.export(),
|
|
|
columnId,
|
|
|
type,
|
|
|
+ onceId,
|
|
|
show: true,
|
|
|
})
|
|
|
setTimeout(() => {
|
|
@@ -84,7 +86,8 @@ Component({
|
|
|
let type = currentTarget.dataset.type
|
|
|
this.setData({
|
|
|
type,
|
|
|
- firstData: {}
|
|
|
+ firstData: {},
|
|
|
+ onceId: ''
|
|
|
})
|
|
|
this.resetData()
|
|
|
},
|
|
@@ -140,14 +143,12 @@ Component({
|
|
|
})
|
|
|
},
|
|
|
async topping(id) {
|
|
|
- console.log(this.data.type);
|
|
|
let res
|
|
|
if (this.data.type == 'like') {
|
|
|
res = await getLikeNote(id)
|
|
|
} else {
|
|
|
res = await getCommentNote(id)
|
|
|
}
|
|
|
- console.log(res);
|
|
|
this.setData({
|
|
|
firstData: res
|
|
|
})
|
|
@@ -242,23 +243,61 @@ Component({
|
|
|
wx.showActionSheet({
|
|
|
itemList: ['删除评论'],
|
|
|
success: async () => {
|
|
|
- let res2 = await delPost({
|
|
|
+ await delPost({
|
|
|
id,
|
|
|
type
|
|
|
})
|
|
|
- console.log(res2);
|
|
|
+ if (type == '1') {
|
|
|
+ let index = this.data.list.findIndex(item => {
|
|
|
+ return item.id == id
|
|
|
+ })
|
|
|
+ this.data.list.splice(index, 1);
|
|
|
+ this.setData({
|
|
|
+ 'count.commentNum': --this.data.count.commentNum,
|
|
|
+ list: this.data.list
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let {
|
|
|
+ parent
|
|
|
+ } = currentTarget.dataset
|
|
|
+ let index = this.data.list.findIndex(item => {
|
|
|
+ return item.id == parent
|
|
|
+ })
|
|
|
+ let index2 = this.data.list[index].replyVOList.findIndex(item2 => {
|
|
|
+ return item2.id == id
|
|
|
+ })
|
|
|
+ this.data.list[index].replyVOList.splice(index2, 1);
|
|
|
+ this.setData({
|
|
|
+ list: this.data.list
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- async setFans() {
|
|
|
-
|
|
|
- return
|
|
|
- }
|
|
|
- await setFans({
|
|
|
- uid: this.data.videoInfoCopy.user.uid
|
|
|
- })
|
|
|
- this.triggerEvent('setListFans', this.data.videoInfoCopy.user.uid) */
|
|
|
+ async setFans({
|
|
|
+ currentTarget
|
|
|
+ }) {
|
|
|
+ let user = currentTarget.dataset.user
|
|
|
+ if (user.isFans) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ await setFans({
|
|
|
+ uid: user.user.uid
|
|
|
+ })
|
|
|
+ let listCopy = JSON.parse(JSON.stringify(this.data.list));
|
|
|
+ listCopy.forEach(item => {
|
|
|
+ if (item.user.uid == user.user.uid) {
|
|
|
+ item.isFans = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ list: listCopy
|
|
|
+ });
|
|
|
+ wx.showToast({
|
|
|
+ title: '已关注',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
},
|
|
|
}
|
|
|
})
|