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.
69 lines
1.5 KiB
69 lines
1.5 KiB
var api = require('../../api/comment.js')
|
|
const app = getApp()
|
|
Component({
|
|
properties: {
|
|
state: Number
|
|
},
|
|
data: {
|
|
list: [],
|
|
},
|
|
attached: function () {
|
|
|
|
},
|
|
lifetimes: {
|
|
attached: function () {
|
|
// this.getCommentList()
|
|
},
|
|
moved: function () { },
|
|
detached: function () { },
|
|
},
|
|
|
|
ready: function () {
|
|
|
|
},
|
|
pageLifetimes: {
|
|
// 组件所在页面的生命周期函数
|
|
show: function () { },
|
|
},
|
|
methods: {
|
|
getCommentList: function (searchData) {
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
})
|
|
let that = this;
|
|
if (searchData.clear == 0){//数据清空
|
|
that.setData({
|
|
list: []
|
|
})
|
|
}
|
|
let orderType = 0;// 排序方式 0: 获取最新列表,1: 获取最热列表
|
|
if (searchData.currenttab == 'new'){
|
|
orderType = 0;
|
|
}else{
|
|
orderType = 1;
|
|
}
|
|
let params = {
|
|
"eventId": searchData.eventId,
|
|
"pageIndex": searchData.pageIndex,
|
|
"pageSize": app.globalData.pageSize,
|
|
"timestamp": searchData.date,
|
|
"orderType": orderType
|
|
}
|
|
api.getCommentList(params).then(function (res) {
|
|
if (res.code == 0){
|
|
that.setData({
|
|
list: that.data.list.concat(res.data)
|
|
})
|
|
}
|
|
wx.hideLoading()
|
|
})
|
|
},
|
|
toCommentsContent(options){
|
|
const commentId = options.currentTarget.dataset.commentid;
|
|
wx.navigateTo({
|
|
url: `../../pages/comments/commentsContent/commentsContent?commentId=${commentId}`
|
|
})
|
|
}
|
|
}
|
|
|
|
})
|