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.
74 lines
1.9 KiB
74 lines
1.9 KiB
2 years ago
|
var api = require('../../utils/activity.js')
|
||
|
|
||
|
const app = getApp()
|
||
|
Component({
|
||
|
properties: {
|
||
|
state: Number
|
||
|
},
|
||
|
data: {
|
||
|
activityList: [],
|
||
|
nomore: false
|
||
|
},
|
||
|
attached: function() {},
|
||
|
ready: function() {},
|
||
|
pageLifetimes: {
|
||
|
show: function() {},
|
||
|
},
|
||
|
methods: {
|
||
|
getActivityList(params) {
|
||
|
let that = this
|
||
|
if (params.qkdat == true) {
|
||
|
console.log('清空')
|
||
|
that.setData({
|
||
|
activityList: [],
|
||
|
nomore: false
|
||
|
})
|
||
|
}
|
||
|
|
||
|
api.getActivityList(params).then((res) => {
|
||
|
console.log(res.data)
|
||
|
that.setData({
|
||
|
activityList: that.data.activityList.concat(res.data)
|
||
|
})
|
||
|
console.log(res.data.length)
|
||
|
//数据访问成功
|
||
|
var myEventDetail = {
|
||
|
listLength: res.data.length
|
||
|
}
|
||
|
that.triggerEvent('toActDetail', myEventDetail)
|
||
|
if (res.data.length == 0) {
|
||
|
that.setData({
|
||
|
nomore: true
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
|
||
|
toActDetail(e) {
|
||
|
const id = e.currentTarget.dataset.id
|
||
|
const actcurrentstate = e.currentTarget.dataset.actcurrentstate
|
||
|
const signupflag = e.currentTarget.dataset.signupflag
|
||
|
this.triggerEvent('toActDetail', {
|
||
|
actId: id
|
||
|
})
|
||
|
wx.navigateTo({
|
||
|
url: `/subpages/heart/pages/heartDetail/heartDetail?id=${id}&actcurrentstate=${actcurrentstate}&signupflag=${signupflag}`
|
||
|
})
|
||
|
},
|
||
|
updateActivityList(params) {
|
||
|
api.getActivityList(params).then(res => {
|
||
|
console.log('详情回列表刷新数据', res)
|
||
|
const index = this.data.activityList.findIndex(item => item.id === res.data[0].id)
|
||
|
if (index > -1) {
|
||
|
this.data.activityList.splice(index, 1, res.data[0])
|
||
|
} else {
|
||
|
this.data.activityList.splice(index, 1)
|
||
|
}
|
||
|
this.setData({
|
||
|
activityList: this.data.activityList
|
||
|
})
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
})
|