var Api = require('../../utils/common.js'); var re = require('../../utils/request.js'); Page({ /** * 页面的初始数据 */ data: { club:{time:'18:17',content:'双哥哥:会员成功加入',pay:'微信'}, order:{time:'10-20 18:17',content:'您的订单已完成'}, system:{time:'10-20 18:17',content:'提现成功'}, active:{time:'10-20 18:17',content:'您有一个新的活动'}, host:{time:'10-20 18:17',content:'您好'}, }, toclub:function(){ wx.navigateTo({ url: './clubmessage/clubmessage' }) }, toorder:function(){ wx.navigateTo({ url: '../center/order/order' }) }, tosystem:function(){ wx.navigateTo({ url: './sysmessage/sysmessage' }) }, toactive:function(){ wx.navigateTo({ url: './activemessage/activemessage' }) }, tohost:function(){ wx.navigateTo({ url: './hostmessage/hostmessage' }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.activeMassage(); this.orderMassage(); this.sysMassage(); this.clubMassage(); }, activeMassage:function(){ var that = this; const imgUrl = wx.getStorageSync('imgUrl') var header = { token:wx.getStorageSync('token'), "Content-Type": "application/x-www-form-urlencoded" }; var postData = { pageSize: 3, } re.request(Api.activeMassage(), postData, header).then((res) => { let datas = res.data.data; that.setData({ active:datas[0], }) }) }, orderMassage: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.orderMassage(), '', header).then((res) => { console.log(res) let datas = res.data.data; that.setData({ order:datas[0], }) }) }, sysMassage: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.sysMassage(), '', header).then((res) => { console.log(res) let datas = res.data.data; that.setData({ system:datas[0], }) }) }, clubMassage: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.clubMassage(), '', header).then((res) => { console.log(res) let datas = res.data.data; that.setData({ club:datas[0], }) }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })