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

const app = getApp();

Page({
  data: {
  },
  onLoad: function (options) {
    var idarr=options.idarr.split(",");
    var list = server.getProgramList();
    var arr=[];
    for(var i=0;i<list.length;i++){
      for(var j=0;j<idarr.length;j++){
        if (idarr[j]==list[i].ID){
          arr.push(list[i]);
        }
      }
    }

    this.setData({
      Containnerheight: common.getSystemHeight(),
      ProgramList: arr,
      ProgramID:app.globalData.ProgramID,
    });
  },
  switchProgram: function (e) {
    wx.navigateToMiniProgram({
      appId: e.currentTarget.dataset.appid,
      path: e.currentTarget.dataset.path,
      extraData: {
      },
      success(res) {
        // 打开成功
      }
    });
  },
  gotoFinish: function () {
    wx.reLaunch({
      url: '../../pages/index/index',
    });
  },
  onShareAppMessage: function () {
    return {
      title: app.globalData.ShareTitle,
      path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
      imageUrl: app.globalData.ShareImage,
    }
  },
})