市北人才赋能平台 --小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

68 lines
1.6 KiB

// pages/topics/common/goodIdea/cell/index.js
import { TopicModel } from '../../../../models/topic.js'
let topicModel = new TopicModel()
Component({
/**
* 组件的属性列表
*/
properties: {
itemData:Object,
itemIndex:Number
},
/**
* 组件的初始数据
*/
data: {
unPraise: '/images/common/zan.png',
praise: '/images/common/star_light.png',
currentPage:1
},
/**
* 组件的方法列表
*/
methods: {
onTap() {
this.triggerEvent('clickListItem', { itemData: this.properties.itemData })
},
onClickPraise(e) {
const sIndex = e.currentTarget.dataset.index
var selectItem = e.currentTarget.dataset.item
console.log(selectItem)
// var isPraise = "itemData.isPraise"
// this.setData({
// [isPraise]:!isPraise
// })
console.log('啦啦啦')
this.triggerEvent('tapGoodIdeaPraise', {index:sIndex})
// const commentList = this.data.commentList
// const tempList = []
// commentList.forEach((item, index) => {
// if (sIndex === index) {
// item.isPraise = !item.isPraise
// }
// tempList.push(item)
// })
// this.setData({
// commentList: tempList,
// })
this.fetchGoodIdeaPraise(selectItem.groupId)
// 评论点赞
},
fetchGoodIdeaPraise(id) {
topicModel.topicCommentPraise(id, res => {
console.log(res)
if (res.code === 200) {
wx.showToast({
title: res.message,
icon: 'none'
})
// this.fetchDetailComment()
}
})
},
}
})