lessonlist.js 2.7 KB

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