import common from '../../utils/util';
import server from '../../utils/main';

const app = getApp();

Page({
  data: {
  },
  onLoad: function (options) {
    var paytype = options.paytype;
    this.setData({
      Containnerheight: common.getSystemHeight(),
      Paytype: paytype
    });
    wx.showLoading({
      title: '请勿退出',
      mask:true,
    }); 
    setTimeout(function(){
      wx.hideLoading();
    },5000);

    if (paytype == "4") {
      wx.setStorageSync("HasActivate", 1);
    }
    else if (paytype=="3"){
      app.globalData.userInfo.IsMember = 1;
    }
  }, 
  onUnload: function () {
    if (this.data.Paytype == "4") 
      app.globalData.IsRefresh = true;
  },
  gotoDefault: function() {
    wx.redirectTo({
      url: "../../pages/main/default",
    });
  },
  goto: function () {
    if (this.data.Paytype == "3") {
      wx.redirectTo({
        url: "./limited?IsShowButton=1",
      });
    }
    if (this.data.Paytype == "4") {
      wx.redirectTo({
        url: "./activate",
      });
    }
    if (this.data.Paytype == "5") {
      wx.redirectTo({
        url: "./giftlist",
      });
    }
  },
  onShareAppMessage: function () {
    return {
      title: app.globalData.ShareTitle,
      path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
      imageUrl: app.globalData.ShareImage,
    }
  },
})