english.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // pages/art/art.js
  2. const app = getApp()
  3. const util = require('../../utils/util.js');
  4. const APIClient = require('../../utils/APIClient.js');
  5. const login = require('../../utils/loginSchedule.js');
  6. Page({
  7. data: {
  8. flag: false,
  9. questionsData: {},
  10. courseData: {},
  11. num1: 0,
  12. position: '',
  13. questionsdian: '',
  14. list: [],
  15. lessonListHeight: '',
  16. previewHeight: '',
  17. questionsMore: '',
  18. wxObjectives: [],
  19. flag: true,
  20. materialData: [],
  21. loginType: 1
  22. },
  23. /* 区分答疑和分享 */
  24. distinction: function(type, columnId, pageNo, pageSize, success) {
  25. login.getOpenidSessionKey(function(res) {
  26. //console.log(res.data.data.uid);
  27. APIClient.getProductionSchedule({
  28. uid: res.data.data.uid
  29. }, {
  30. "type": type,
  31. "category": columnId,
  32. "pageNo": pageNo,
  33. "pageSize": pageSize
  34. }).success(success)
  35. }, function() {
  36. });
  37. },
  38. /*加载更多点击*/
  39. onMyEvent: function(e){
  40. let type = e.currentTarget.dataset.type;
  41. const columnId = util.column('4').columnId;
  42. if(type == 1) {
  43. this.data.num1++
  44. this.setData({
  45. num1: this.data.num1
  46. })
  47. this.distinction(type, columnId, 1, 5*this.data.num1, res => {
  48. if(res.data.success) {
  49. console.log(res.data.data)
  50. this.setData({
  51. questionsData: res.data.data,
  52. })
  53. if(res.data.data) {
  54. this.setData({
  55. questionsdian: util.replyNo(res.data.data.list)
  56. })
  57. }
  58. if(5*this.data.num1 > res.data.data.totalSize) {
  59. this.setData({
  60. questionsMore: ''
  61. })
  62. }
  63. }
  64. });
  65. }
  66. },
  67. /*点击定位*/
  68. location: function (e) {
  69. const position = e.currentTarget.dataset.id;
  70. console.log(position)
  71. this.setData({
  72. position: position
  73. })
  74. },
  75. onLoad: function (options) {
  76. if(options.type == "noTv") {
  77. this.setData({
  78. loginType: ""
  79. })
  80. }
  81. },
  82. onShow: function () {
  83. const columnId = util.column('4').columnId;
  84. /* 答疑 */
  85. this.distinction(1, columnId, 1, 2, res => {
  86. if(res.data.success) {
  87. console.log(res.data.data)
  88. this.setData({
  89. questionsData: res.data.data,
  90. })
  91. if(res.data.data) {
  92. this.setData({
  93. questionsdian: util.replyNo(res.data.data.list)
  94. })
  95. if(res.data.data.totalSize > 2) {
  96. this.setData({
  97. questionsMore: true
  98. })
  99. }
  100. }
  101. }
  102. });
  103. /*科目信息*/
  104. login.getOpenidSessionKey((res) => {
  105. //console.log(res.data.data.uid);
  106. APIClient.getEachSchedule({
  107. uid: res.data.data.uid
  108. }, {
  109. "category": 4
  110. }).success((res) => {
  111. //console.log('科目信息' + JSON.stringify(res));
  112. const lessonListLength = util.studyPageTime(res.data.data.lessonPage.list).length;
  113. const previewLength = util.filter(res.data.data.lessonPage.list).length;
  114. console.log(res)
  115. if(lessonListLength > 4) {
  116. this.setData({
  117. lessonListHeight: 280
  118. })
  119. }
  120. if(previewLength > 4){
  121. this.setData({
  122. previewHeight: 280
  123. })
  124. }
  125. this.setData({
  126. courseData: res.data.data,
  127. materialData: util.filter(res.data.data.lessonPage.list),
  128. list: util.studyPageTime(res.data.data.lessonPage.list),
  129. wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
  130. })
  131. })
  132. }, () => {
  133. this.setData({
  134. flag: !this.data.flag
  135. })
  136. }, this.data.loginType);
  137. },
  138. /*获取个人信息弹框*/
  139. jurisdiction: function () {
  140. this.setData({
  141. flag: !this.data.flag
  142. })
  143. this.onShow();
  144. }
  145. })