lessonlist.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. ImagePath: app.globalData.uploadImageUrl,
  7. },
  8. onLoad: function () {
  9. var that = this;
  10. that.setData({
  11. CheckListUserID: app.globalData.userInfo.UserID,
  12. Containnerheight: main.getWindowHeight(),
  13. UserID: app.globalData.userInfo.UserID,
  14. });
  15. var userid = app.globalData.userInfo.UserID;
  16. main.getData("GetMiaoguoLesson2?UserID=" + userid, function (data) {
  17. if (data) {
  18. var arr=[];
  19. for(var i=0;i<4;i++)
  20. arr.push(data[i]);
  21. that.setData({
  22. List: arr,
  23. });
  24. wx.setStorageSync("LessonList", data);
  25. }
  26. });
  27. },
  28. gotoLesson: function (e) {
  29. var id = e.currentTarget.dataset.id;
  30. var idchild="";
  31. if (e.currentTarget.dataset.idchild && id>1)
  32. idchild = '&LessonPage=' +e.currentTarget.dataset.idchild;
  33. if (e.currentTarget.dataset.url){
  34. wx.navigateTo({
  35. url: '../other/video?LessonID=' + id +idchild+"&imageurl="+e.currentTarget.dataset.imageurl+"&url="+e.currentTarget.dataset.url,
  36. });
  37. }
  38. else{
  39. if (id!=2 && id!=3){
  40. wx.navigateTo({
  41. url: '../other/lesson?LessonID=' + id +idchild,
  42. });
  43. }
  44. }
  45. },
  46. onShareAppMessage: function () {
  47. return {
  48. title: "教学课程",
  49. path: app.globalData.SharePath + '?type=lesson&LessonID=all&UserID=' + app.globalData.userInfo.UserID,
  50. imageUrl: app.globalData.uploadImageUrl+"web/program_screenshot_lesson_a00.png",
  51. }
  52. },
  53. })