import httpRequestApi from '../../../utils/APIClient';
Page({
    data: {

    },
    onLoad: function (option) {
        const uid = wx.getStorageSync('uid');
        httpRequestApi.getIndex(uid).success(res => {
            const recommend = res.data.data.recommendLesson;
            const recommendTemp = [];
            recommend.forEach(item => {
              const oTemp = {};
              oTemp.img = item.boothContent;
              oTemp.classId = item.operationContent;
              oTemp.title = item.title;
              oTemp.grade = item.summary;
              recommendTemp.push(oTemp);
            });
            this.setData({
              recommend: recommendTemp
            })
        });
    },
    openClass: function(e) {
          let id = e.currentTarget.dataset.classid;
          let title = e.currentTarget.dataset.title;
          wx.navigateTo({
            url: `../class/class?id=${id}&title=${title}`
          })
      }
})