123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- // 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.nickName,
- 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.nickName}邀请你一起来朗读课文`,
- 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)
- })
- }
- }
- })
|