//获取所有评论列表
getCommentList() {
wx.cloud.callFunction({
name: "getpinglun",
})
.then(res => {
console.log("查询全部评论成功", res)
if (res && res.result) {
let dataList = res.result.data;
this.setData({
list: dataList
})
} else {
this.setData({
list: []
})
}
}).catch(res => {
console.log("查询全部评论失败", res)
})
},
//获取我的所有评论列表
getMyCommentList() {
let that = this;
//请求自己后台获取用户openid
DB.collection("pinglun").get()
.then(res => {
console.log("查询评论成功", res)
if (res && res.data) {
let dataList = res.data;
that.setData({
list: dataList
})
} else {
that.setData({
list: []
})
}
}).catch(res => {
console.log("查询评论失败", res)
})
},