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

const app = getApp();

Page({
  data: {
    FileUrl: app.globalData.imageUrl,
    Version: app.globalData.Version,
    ProgramName: app.globalData.ProgramName,
  },
  onLoad: function (options) {
    this.setData({
      Containnerheight: common.getSystemHeight(),
      ProgramList: server.getProgramList(),
      ProgramID:app.globalData.ProgramID,
      IsShow: app.globalData.IsShow,
      IsLocked: app.globalData.IsLocked,
    });
  },
  goto:function(e){
    var url=e.currentTarget.dataset.url;
    wx.navigateTo({
      url: url,
    })
  },
  switchProgram: function (e) {
    wx.navigateToMiniProgram({
      appId: e.currentTarget.dataset.appid,
      path: e.currentTarget.dataset.path,
      extraData: {
      },
      success(res) {
        // 打开成功
      }
    });
  },
  gotoFeedback: function () {
    server.gotoFeedback();
  },
  updateMember: function () {
    if (app.globalData.userInfo.UserID == 1) {
      if (app.globalData.userInfo.IsMember == 1) {
        app.globalData.userInfo.IsMember = 0;
        this.setData({
          IsMember: 0,
        });
      }
      else {
        app.globalData.userInfo.IsMember = 1;
        this.setData({
          IsMember: 1,
        });
      }
    }
  },
});