// pages/user/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { userInfo: {}, pageData:{}, rankList: [], menuList: [ {name: '需求优先', icon: '../../../images/menu1.png'}, {name: '收益分成', icon: '../../../images/menu2.png'}, {name: '上架特权', icon: '../../../images/menu3.png'}, {name: '活动特权', icon: '../../../images/menu4.png'}, {name: '精品项目', icon: '../../../images/menu5.png'}, {name: '专属推荐码', icon: '../../../images/menu6.png'}, {name: '会员特价', icon: '../../../images/menu7.png'}, {name: '专属活动', icon: '../../../images/menu8.png'}, {name: '增值收益', icon: '../../../images/menu9.png'} ], shareFlag: false }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ userInfo: wx.getStorageSync('userInfo') }) this.getPageData(); this.getShareFlag(); wx.hideShareMenu() }, getShareFlag(){ app.http('get','user/getShareFlag').then((res)=>{ if(res.data.success){ this.setData({ shareFlag: res.data.data }) } }) }, getPageData(){ app.http('get','user/myProfit').then((res)=>{ if(res.data.success){ if(res.data.data.userProfitList.length >= 3 ){ this.setData({ rankList: res.data.data.userProfitList.slice(3) }) console.log(res.data.data.userProfitList.slice(3)) console.log(this.data.rankList) } this.setData({ pageData: res.data.data }) console.log(this.data.pageData[3]) } }) }, toMoreMenu(){ wx.navigateTo({ url: './agreement/index', }) }, toIncomeDetail(){ wx.navigateTo({ url: './incomeDetail/index', }) }, tixian(){ wx.showToast({ title: '提现功能暂未开放!', icon: 'none' }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function (res) { if(this.data.shareFlag){ return { imageUrl: '../../../images/shareImg.png', path: '/pages/user/agreement/index?id='+this.data.userInfo.uid // 路径,传递参数到指定页面。 } } else{ wx.showToast({ title: '暂时不能分享哦~', icon: 'none' }) } } })