163 lines
3.6 KiB
JavaScript
163 lines
3.6 KiB
JavaScript
// packageC/Myshaky/Mylove/Mylove.js
|
|
var app = getApp();
|
|
import util from '../../../utils/util.js';
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
page:1,
|
|
id: wx.getStorageSync('yz_uid'),
|
|
nowTime: Date.parse(new Date())/1000
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
this.getdata();
|
|
console.log(this.data.nowTime);
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
|
|
},
|
|
goxq(e) {
|
|
let activity_id = e.currentTarget.id;
|
|
wx.navigateTo({
|
|
url: '/packageC/Myshaky/enrollEnter/enrollEnter?id=' + activity_id,
|
|
});
|
|
},
|
|
// 获取关注列表
|
|
getdata() {
|
|
let urlStr = app.getNetAddresss("plugin.activity-apply.api.lecturer.getMyActivity");
|
|
let that = this;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
member_id: that.data.id,
|
|
page: this.data.page
|
|
},
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
console.log(res.data);
|
|
for (let a = 0; a < res.data.data.length; a++) {
|
|
res.data.data[a].has_many_activity[0].start_time = util.formatTimeTwo(res.data.data[a].has_many_activity[0].start_time, 'Y/M/D h:m:s');
|
|
}
|
|
console.log(res.data.data);
|
|
that.setData({
|
|
dataLis: res.data.data,
|
|
current_page:res.data.current_page,
|
|
last_page:res.data.last_page
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
var that = this;
|
|
if(that.data.current_page < that.data.last_page){
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
mask: true,
|
|
});
|
|
that.setData({
|
|
page:that.data.page+1
|
|
});
|
|
// console.log(that.data.page)
|
|
that.getNext();
|
|
}else{
|
|
wx.showToast({
|
|
title: '没有更多',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
getNext() {
|
|
let urlStr = app.getNetAddresss("plugin.activity-apply.api.lecturer.getMyActivity");
|
|
let that = this;
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
member_id: that.data.id,
|
|
page:this.data.page
|
|
},
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
console.log(res.data);
|
|
for (let a = 0; a < res.data.data.length; a++) {
|
|
console.log(res.data.data[a].has_many_activity[0]);
|
|
}
|
|
if(res.data.current_page > res.data.last_page){
|
|
wx.hideLoading();
|
|
wx.showToast({
|
|
title: '没有更多',
|
|
icon: 'none'
|
|
});
|
|
that.setData({
|
|
current_page: res.data.current_page,
|
|
last_page: res.data.last_page
|
|
});
|
|
return;
|
|
}else{
|
|
wx.hideLoading();
|
|
that.setData({
|
|
dataLis: that.data.dataLis.concat(res.data.data),
|
|
current_page: res.data.current_page,
|
|
last_page: res.data.last_page
|
|
});
|
|
}
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
}
|
|
}); |