Files
AGuestSaas/pages/user/companyMine/myTeam/myTeam.js
2020-12-31 16:10:36 +08:00

91 lines
1.9 KiB
JavaScript

/**
* Web二雪
* 趁时光不老 努力活成自己想要成为的样子
*/
Page({
/**
* 页面的初始数据
*/
data: {
lists: [],
page: 1,
has_more: true
},
onShow() {
// this.getList();
},
// 获取活动列表
getList() {
wx.$api.companyModule.getCrowdfundsLike(this.data.page).then(res => {
setTimeout(() => {
wx.hideLoading({})
}, 1000);
var lists = this.data.lists.concat(res.data)
if (res.page.has_more) {
this.setData({
has_more: res.page.has_more,
page: this.data.page + 1,
lists: lists
})
} else {
this.setData({
has_more: res.page.has_more,
lists: lists
})
}
})
},
// 触底加载更多
onReachBottom() {
// if (this.data.has_more) {
// this.getList();
// } else {
// wx.showToast({
// icon: 'none',
// title: '没有更多',
// })
// }
},
//跳转到详情页
goUrl(e) {
wx.navigateTo({
url: '/pages/home/activeDetail/activeDetail?id=' + e.currentTarget.dataset.id,
})
},
// 取消项目
crowdfundsUnLike(e) {
var id = e.currentTarget.dataset.id
var index = e.currentTarget.dataset.index
var arr = this.data.lists
var temp = []
for (var i = 0; i < arr.length; i++) {
if (i != index) {
temp.push(arr[i]);
}
}
console.log(temp)
wx.showModal({
title: '提示',
content: '确认取消关注么?',
success: res => {
if (res.confirm) {
wx.showLoading({
title: '取消中',
})
wx.$api.companyModule.crowdfundsUnLike(id).then(res => {
this.setData({
lists: temp
})
wx.showToast({
title: '取消成功',
icon: 'none'
})
wx.hideLoading({})
});
}
}
})
}
})