lessonlist.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {},
  6. onLoad: function (options) {
  7. var that = this;
  8. that.setData({
  9. CheckListUserID: app.globalData.userInfo.UserID,
  10. Containnerheight: main.getWindowHeight(),
  11. UserID: app.globalData.userInfo.UserID,
  12. ListType: options.listtype,
  13. });
  14. var userid = app.globalData.userInfo.UserID;
  15. main.getData("GetMiaoguoLesson2?UserID=" + userid, function (data) {
  16. if (data) {
  17. var arr = [];
  18. if (that.data.ListType == "simple") {
  19. arr.push(data[0]);
  20. arr.push(data[1]);
  21. arr[0].Text = "前言";
  22. arr[1].Text = "基本操作";
  23. arr[1].Time = "时长约10分钟";
  24. arr[1].List[5] = data[2].List[4];
  25. arr[1].List[4] = data[1].List[2];
  26. arr[1].List[3] = data[1].List[1];
  27. arr[1].List[2] = data[1].List[0];
  28. arr[1].List[0] = data[2].List[0];
  29. arr[1].List[1] = data[2].List[1];
  30. arr[1].List.splice(6, 1);
  31. arr[1].List[4].Title = "通过【知识】生成字词、古诗词、英语题卡";
  32. arr[1].List[3].Title = "通过【加资料】制作字词、古诗词、英语题卡";
  33. arr[1].List[2].Title = "制作任何知识点的普通题卡";
  34. wx.setNavigationBarTitle({
  35. title: '简要版',
  36. });
  37. } else {
  38. wx.setNavigationBarTitle({
  39. title: '完整版',
  40. });
  41. for (var i = 0; i < 4; i++)
  42. arr.push(data[i]);
  43. }
  44. that.setData({
  45. List: arr,
  46. });
  47. wx.setStorageSync("LessonList", data);
  48. }
  49. });
  50. },
  51. gotoLesson: function (e) {
  52. var id = e.currentTarget.dataset.id;
  53. var idchild = "";
  54. if (e.currentTarget.dataset.idchild && id > 1)
  55. idchild = '&LessonPage=' + e.currentTarget.dataset.idchild;
  56. if (e.currentTarget.dataset.url) {
  57. if (this.data.ListType == "simple") {
  58. switch (e.currentTarget.dataset.idchild) {
  59. case 1:
  60. id = 3;
  61. idchild = "&LessonPage=1";
  62. break;
  63. case 2:
  64. id = 3;
  65. idchild = "&LessonPage=2";
  66. break;
  67. case 3:
  68. id = 2;
  69. idchild = "&LessonPage=1";
  70. break;
  71. case 4:
  72. id = 2;
  73. idchild = "&LessonPage=2";
  74. break;
  75. case 5:
  76. id = 2;
  77. idchild = "&LessonPage=3";
  78. break;
  79. case 6:
  80. id = 3;
  81. idchild = "&LessonPage=5";
  82. break;
  83. }
  84. }
  85. wx.navigateTo({
  86. url: '../other/video?LessonID=' + id + idchild +"&title=" + e.currentTarget.dataset.title+ "&imageurl=" + e.currentTarget.dataset.imageurl + "&url=" + e.currentTarget.dataset.url,
  87. });
  88. } else {
  89. if (id != 2 && id != 3) {
  90. wx.navigateTo({
  91. url: '../other/lesson?LessonID=' + id + idchild,
  92. });
  93. }
  94. }
  95. },
  96. onShareAppMessage: function () {
  97. var title = "完整版教学课程";
  98. if (this.data.ListType == "simple") {
  99. title = "简要版教学课程";
  100. }
  101. var url = app.globalData.SharePath + '?type=lesson&LessonID=all&ListType=' + this.data.ListType + '&UserID=' + app.globalData.userInfo.UserID;
  102. console.log(url);
  103. return {
  104. title: title,
  105. path: url,
  106. imageUrl: app.globalData.uploadImageUrl + "web/program_screenshot_lesson_a00.png",
  107. }
  108. },
  109. })