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

const app = getApp();

Page({
  data: {
  },
  onLoad: function (options) {
    var that = this;

    that.setData({
      Containnerheight: main.getWindowHeight(),
      Menu:constant.arrMenuText[options.Type],
    });

    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: "#0B8457",
    })
  },
  goto:function(e){
    var that = this;
    var url = e.currentTarget.dataset.url;

    if (url.indexOf("studyplan")>0){
      var cardType=url.substr(url.length-1);
      wx.setStorageSync("CardType", Number(cardType));
  
      main.UploadUserConfig(function () {
        that.onClose();
      });
    }
    else{
      wx.redirectTo({
        url: url,
      });
    }
  },
  onClose: function () {
    wx.navigateBack({
      delta: 1,
    });
  },
  onShareAppMessage: function () {
    return {
      title: app.globalData.ShareTitle,
      path: app.globalData.SharePath + '?LessonID=all&UserID=' + app.globalData.userInfo.UserID,
      imageUrl: app.globalData.ShareImage,
    }
  },
})
