store/packageA/member/signrecord/signrecord.js

116 lines
2.4 KiB
JavaScript

// pages/signrecord/signrecord.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
continue_days: '', //连续签到天数
sign_total: '', //累计签到天数
cumulative: '', //累计奖励
sign_log: '', //签到记录
sign_name: '', //签到名字
integral: '',
love_name:"",
love_return:"",
sign_model:{},
is_love:false,//爱心值插件开关
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let integral = '';
try {
integral = wx.getStorageSync('integral');
} catch (error) {
console.log(error);
}
this.data.integral = integral;
this.setData({integral});
this.getData();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
getData() {
let urlStr = app.getNetAddresss("plugin.sign.Frontend.Modules.Sign.Controllers.sign-log.log");
var that = this;
app._getNetWork({
url: urlStr,
success: function(res) {
if(res.data.result !=1) return;
let d = res.data.data;
let sign_log = res.data.data.sign_log;
sign_log.forEach((item,key)=>{
console.log(item);
item.award_content = that.data.integral+item.award_content.substr(2);
});
that.setData({
love_return:d.love_return,
love_name:d.love_name,
sign_model:d.sign_model,
continue_days: res.data.data.continue_days,
sign_total: res.data.data.sign_total,
cumulative: that.data.integral+res.data.data.cumulative.substr(2),
sign_log,
sign_name: res.data.data.sign_name,
is_love:res.data.data.is_love
});
wx.setNavigationBarTitle({
title: that.data.sign_name ? (that.data.sign_name + '记录') : '记录'
});
}
});
}
});