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.
95 lines
2.4 KiB
95 lines
2.4 KiB
import { getCommentList, gettopicCommentList } from '../../../../../api/issue'
|
|
|
|
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) {
|
|
let that = this;
|
|
if (searchData.pageIndex == 1) {
|
|
that.setData({
|
|
list: [],
|
|
});
|
|
}
|
|
let orderType = 0;// 排序方式 0: 获取最新列表,1: 获取最热列表
|
|
console.log(':::::::::' + searchData.currenttab)
|
|
if (searchData.currenttab == 'new') {
|
|
orderType = 0;
|
|
} else {
|
|
orderType = 1;
|
|
}
|
|
|
|
|
|
if (searchData.pageName == 'topicDetail'){
|
|
let params = {
|
|
topicId: searchData.eventId,
|
|
pageIndex: searchData.pageIndex,
|
|
pageSize: searchData.pageSize,
|
|
timestamp: searchData.date,
|
|
orderType: orderType
|
|
}
|
|
gettopicCommentList(params).then((res: any) => {
|
|
if (res.code == 0) {
|
|
that.setData({
|
|
list: that.data.list.concat(res.data.commentsList)
|
|
})
|
|
}
|
|
var myEventDetail = {
|
|
listLength: that.data.list.length,
|
|
loadType: 'none'
|
|
}
|
|
that.triggerEvent('myevent', myEventDetail)
|
|
})
|
|
}else{
|
|
let params = {
|
|
eventId: searchData.eventId,
|
|
pageIndex: searchData.pageIndex,
|
|
pageSize: searchData.pageSize,
|
|
timestamp: searchData.date,
|
|
orderType: orderType
|
|
}
|
|
getCommentList(params).then((res: any) => {
|
|
if (res.code == 0) {
|
|
that.setData({
|
|
list: that.data.list.concat(res.data),
|
|
loadType: 'none'
|
|
})
|
|
}
|
|
var myEventDetail = {
|
|
listLength: that.data.list.length,
|
|
}
|
|
that.triggerEvent('myevent', myEventDetail)
|
|
})
|
|
}
|
|
},
|
|
// toCommentsContent(options) {
|
|
// const commentId = options.currentTarget.dataset.commentid;
|
|
// wx.navigateTo({
|
|
// url: `../../pages/comments/commentsContent/commentsContent?commentId=${commentId}`
|
|
// })
|
|
// }
|
|
}
|
|
|
|
})
|