// pages/vipActivity/vipActivity.js import httpRequestApi from '../../utils/APIClient'; const app = getApp() Page({ /** * 页面的初始数据 */ data: { peopleNumData: [], isIOS: app.globalData.isIOS, date: '' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getVipData(); this.getHelp(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { this.getVipData(); this.getHelp(); wx.showNavigationBarLoading() //在标题栏中显示加载 //模拟加载 setTimeout(function () { wx.hideNavigationBarLoading() //完成停止加载 wx.stopPullDownRefresh() //停止下拉刷新 }, 1000); }, /** * 点击分享e */ shareRead(e) { this.triggerEvent('openShare', e) this.shareDialog = this.selectComponent("#share-dialog"); const user = wx.getStorageSync('user'); const type = this.data.isIOS ? 'ios' : 'iphone'; const data = { avatar: user.avatar, name: user.wechatName, uid: user.uid, type, path: `pages/index/index` } this.setData({ noScroll: 'noScroll' }) this.shareDialog.share(data); }, onShareAppMessage: function (res) { if (res.from === 'button') { const type = this.data.isIOS ? 'ios' : 'iphone'; const user = wx.getStorageSync('user'); return { title: `${user.wechatName}邀请你一起来朗读课文`, path: `/pages/index/index?type=${type}&uid=${user.uid}`, imageUrl: 'http://reader-wx.ai160.com/images/reader/pay/share_read_bg.png' } } }, // 获取会员信息 getVipData() { httpRequestApi.getAuthActivity().success(res => { if (!res.data.data) { wx.setStorageSync('vip', false) wx.setStorageSync('date', '') } else { wx.setStorageSync('vip', true) wx.setStorageSync('date', res.data.data) this.setData({ date: res.data.data }) } }).fail(error => { console.log(error) }) }, // 获取帮助的人 getHelp() { if (this.data.isIOS) { httpRequestApi.getHelpNum().success(res => { this.setData({ peopleNumData: res.data.data.list }) }).fail(error => { console.log(error) }) } else { httpRequestApi.getOrderNum().success(res => { this.setData({ peopleNumData: res.data.data.list }) }).fail(error => { console.log(error) }) } } })