week.js 963 B

12345678910111213141516171819202122232425262728293031
  1. import httpRequestApi from '../../../utils/APIClient';
  2. Page({
  3. data: {
  4. },
  5. onLoad: function (option) {
  6. const uid = wx.getStorageSync('uid');
  7. httpRequestApi.getIndex(uid).success(res => {
  8. const recommend = res.data.data.recommendLesson;
  9. const recommendTemp = [];
  10. recommend.forEach(item => {
  11. const oTemp = {};
  12. oTemp.img = item.boothContent;
  13. oTemp.classId = item.operationContent;
  14. oTemp.title = item.title;
  15. oTemp.grade = item.summary;
  16. recommendTemp.push(oTemp);
  17. });
  18. this.setData({
  19. recommend: recommendTemp
  20. })
  21. });
  22. },
  23. openClass: function(e) {
  24. let id = e.currentTarget.dataset.classid;
  25. let title = e.currentTarget.dataset.title;
  26. wx.navigateTo({
  27. url: `../class/class?id=${id}&title=${title}`
  28. })
  29. }
  30. })