english.js 3.5 KB

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