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.
 

145 lines
3.5 KiB

var Api = require('../../../utils/common.js');
var re = require('../../../utils/request.js');
Page({
/**
* 页面的初始数据
*/
data: {
logo:'../../../images/logo.jpg',
otheractive:[
{img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22',issign:true,times:1,total:9},
{img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22',issign:false},
{img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22',issign:true}
],
navTab: ['可签到','已签到'],
currentTab: 0,
},
currentTab: function (e) {
var that = this;
if (that.data.currentTab == e.currentTarget.dataset.idx){
return;
}
that.setData({
currentTab: e.currentTarget.dataset.idx,
})
if(e.currentTarget.dataset.idx==1){
that.getSigningList();
}else{
that.getcanSignList();
}
},
tocode:function(){
wx.navigateTo({
url: '../scave/scave'
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
getSigningList:function(){
var that = this;
const imgUrl = wx.getStorageSync('imgUrl');
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
re.request(Api.getSigningList(), '', header).then((res) => {
let datas = res.data.data;
for(let i=0;i<datas.length;i++){
if(datas[i].activityLogo){
datas[i].activityLogo = imgUrl + datas[i].activityLogo
}
}
that.setData({
otheractive:datas
})
})
},
getcanSignList:function(){
var that = this;
const imgUrl = wx.getStorageSync('imgUrl');
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
re.request(Api.getcanSignList(), '', header).then((res) => {
let datas = res.data.data;
for(let i=0;i<datas.length;i++){
if(datas[i].activityLogo){
datas[i].activityLogo = imgUrl + datas[i].activityLogo
}
}
that.setData({
otheractive:datas
})
})
},
tosign:function(e){
var header = {
token:wx.getStorageSync('token'),
"Content-Type": "application/x-www-form-urlencoded"
};
var postData = {
activityId:e.currentTarget.dataset.id
}
re.request(Api.toSign(), postData, header).then((res) => {
wx.showToast({
title: '操作成功',
icon: 'none'
})
this.getcanSignList();
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getcanSignList();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})